VideoExtractor (json_output.py)

Dumb-downloader-that-scrapes-the-web · files

Extracts video metadata to JSON output; saves info for CLI and ffmpeg integration.

# Source: https://github.com/nerdy-tech-com-gitub/Dumb-downloader-that-scrapes-the-web | License: MIT | Copyright 2012-2024 Mort Yao <mort.yao@gmail.com> and other contributors
# Provided via justclaw.it.com; keep this notice with the code.

import json

# save info from common.print_info()
last_info = None

def output(video_extractor, pretty_print=True):
    ve = video_extractor
    out = {}
    out['url'] = ve.url
    out['title'] = ve.title
    out['site'] = ve.name
    out['streams'] = ve.streams
    try:
        if ve.dash_streams:
            out['streams'].update(ve.dash_streams)
    except AttributeError:
        pass
    try:
        if ve.audiolang:
            out['audiolang'] = ve.audiolang
    except AttributeError:
        pass
    extra = {}
    if getattr(ve, 'referer', Non

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key