Skip to content

Commit 1c4f3f0

Browse files
committed
Add yt-dlp stubs
1 parent a46eea7 commit 1c4f3f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3231
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Extractors do not need to be stubbed.
2+
yt_dlp.extractor.*
3+
# Postprocessors will not be stubbed at this time.
4+
yt_dlp.postprocessor.*
5+
# Won't be covered.
6+
yt_dlp.__main__
7+
yt_dlp.__pyinstaller.*
8+
yt_dlp.compat.(shutil|types|urllib).*
9+
yt_dlp.dependencies.*
10+
yt_dlp.jsinterp.Debugger.sys
11+
yt_dlp.networking.impersonate.ImpersonateTarget._DT
12+
yt_dlp.utils.xattr
13+
# Deprecated
14+
yt_dlp.YoutubeDL.(YoutubeDL.)?parse_outtmpl
15+
yt_dlp.downloader.(common.)?FileDownloader.parse_bytes
16+
yt_dlp.networking.(common.)?Response.(code|info|get(code|url|header))
17+
yt_dlp.utils._legacy.decode_png
18+
# except IndexError is sufficient.
19+
yt_dlp.utils.(_utils.)?(PlaylistEntries|(Lazy|Paged)List).IndexError
20+
# Reports 'not a function'.
21+
yt_dlp.networking.(common.)?(HEAD|PATCH|PUT)Request

stubs/yt-dlp/METADATA.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version = "2025.05.*"
2+
upstream_repository = "https://github.com/yt-dlp/yt-dlp"

stubs/yt-dlp/yt_dlp/YoutubeDL.pyi

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
from _typeshed import Incomplete
2+
from collections.abc import Collection, Mapping
3+
from functools import cached_property
4+
from types import TracebackType
5+
from typing_extensions import Self
6+
from urllib.request import Request
7+
8+
from yt_dlp.cache import Cache
9+
from yt_dlp.cookies import YoutubeDLCookieJar
10+
from yt_dlp.networking import RequestDirector, RequestHandler, Response
11+
12+
from . import _Params
13+
from .extractor.common import InfoExtractor, _InfoDict
14+
from .postprocessor.common import PostProcessor
15+
from .utils._utils import _ProgressState
16+
17+
class YoutubeDL:
18+
params: _Params
19+
cache: Cache
20+
format_selector: Incomplete
21+
archive: Incomplete
22+
def __init__(self, params: _Params | None = ..., auto_init: bool = ...) -> None: ...
23+
def warn_if_short_id(self, argv: list[str]) -> None: ...
24+
def add_info_extractor(self, ie: InfoExtractor) -> None: ...
25+
def get_info_extractor(self, ie_key: str) -> InfoExtractor: ...
26+
def add_default_info_extractors(self) -> None: ...
27+
def add_post_processor(self, pp: PostProcessor, when: str = "post_process") -> None: ...
28+
def add_post_hook(self, ph) -> None: ...
29+
def add_close_hook(self, ch) -> None: ...
30+
def add_progress_hook(self, ph) -> None: ...
31+
def add_postprocessor_hook(self, ph) -> None: ...
32+
def to_stdout(self, message: str, skip_eol: bool = False, quiet: bool | None = None) -> None: ...
33+
def to_screen(self, message: str, skip_eol: bool = False, quiet: bool | None = None, only_once: bool = False) -> None: ...
34+
def to_stderr(self, message: str, only_once: bool = False) -> None: ...
35+
def to_console_title(
36+
self, message: str | None = None, progress_state: _ProgressState | None = None, percent: int | None = None
37+
) -> None: ...
38+
def save_console_title(self) -> None: ...
39+
def restore_console_title(self) -> None: ...
40+
def __enter__(self) -> Self: ...
41+
def save_cookies(self) -> None: ...
42+
def __exit__(self, *args: object) -> None: ...
43+
def close(self) -> None: ...
44+
def trouble(self, message: str | None = None, tb: TracebackType | None = None, is_error: bool = True) -> None: ...
45+
Styles: Incomplete
46+
def report_warning(self, message: str, only_once: bool = False) -> None: ...
47+
def deprecation_warning(self, message: str, *, stacklevel: int = 0) -> None: ...
48+
def deprecated_feature(self, message: str) -> None: ...
49+
def report_error(self, message: str, *args: object, **kwargs: object) -> None: ...
50+
def write_debug(self, message: str, only_once: bool = False) -> None: ...
51+
def report_file_already_downloaded(self, file_name: str) -> None: ...
52+
def report_file_delete(self, file_name: str) -> None: ...
53+
def raise_no_formats(self, info: str, forced: bool = False, *, msg: str | None = None) -> None: ...
54+
def get_output_path(self, dir_type: str = "", filename: str | None = None) -> str: ...
55+
@staticmethod
56+
def escape_outtmpl(outtmpl: str) -> str: ...
57+
@classmethod
58+
def validate_outtmpl(cls, outtmpl: str) -> ValueError | None: ...
59+
def prepare_outtmpl(self, outtmpl: str, info_dict: _InfoDict, sanitize: bool = False) -> tuple[str, dict[str, object]]: ...
60+
def evaluate_outtmpl(self, outtmpl: str, info_dict: _InfoDict, *args, **kwargs) -> str: ...
61+
def prepare_filename(
62+
self, info_dict: _InfoDict, dir_type: str = "", *, outtmpl: str | None = None, warn: bool = False
63+
) -> str: ...
64+
@staticmethod
65+
def add_extra_info(info_dict: _InfoDict, extra_info: Mapping[str, object]) -> None: ...
66+
def extract_info(
67+
self,
68+
url,
69+
download: bool = True,
70+
ie_key: str | None = None,
71+
extra_info: object | None = None,
72+
process: bool = True,
73+
force_generic_extractor: bool = False,
74+
): ...
75+
def add_default_extra_info(self, ie_result: _InfoDict, ie: InfoExtractor, url: str) -> None: ...
76+
def process_ie_result(self, ie_result: _InfoDict, download: bool = True, extra_info: Mapping[str, object] | None = None): ...
77+
tokens: Incomplete
78+
counter: int
79+
def build_format_selector(self, format_spec): ...
80+
def sort_formats(self, info_dict: _InfoDict) -> None: ...
81+
def process_video_result(self, info_dict: _InfoDict, download: bool = True): ...
82+
def process_subtitles(
83+
self, video_id: str, normal_subtitles: Mapping[str, object], automatic_captions: Mapping[str, object]
84+
) -> dict[str, object] | None: ...
85+
def dl(self, name: str, info, subtitle: bool = False, test: bool = False) -> bool: ...
86+
def existing_file(self, filepaths, *, default_overwrite: bool = True) -> object | None: ...
87+
def process_info(self, info_dict: _InfoDict) -> None: ...
88+
def download(self, url_list: Collection[str]) -> None: ...
89+
def download_with_info_file(self, info_filename: str) -> int: ...
90+
@staticmethod
91+
def sanitize_info(info_dict: _InfoDict, remove_private_keys: bool = False) -> _InfoDict | None: ...
92+
@staticmethod
93+
def filter_requested_info(info_dict: _InfoDict, actually_filter: bool = True) -> _InfoDict | None: ...
94+
@staticmethod
95+
def post_extract(info_dict: _InfoDict) -> None: ...
96+
def run_pp(self, pp, infodict: _InfoDict): ...
97+
def run_all_pps(self, key: str, info: _InfoDict, *, additional_pps: Collection[PostProcessor] | None = None): ...
98+
def pre_process(self, ie_info, key: str = "pre_process", files_to_move: Mapping[str, object] | None = None): ...
99+
def post_process(self, filename, info: _InfoDict, files_to_move: Mapping[str, object] | None = None): ...
100+
def in_download_archive(self, info_dict: _InfoDict): ...
101+
def record_download_archive(self, info_dict: _InfoDict) -> None: ...
102+
@staticmethod
103+
def format_resolution(format, default: str = "unknown"): ...
104+
def render_formats_table(self, info_dict: _InfoDict): ...
105+
def render_thumbnails_table(self, info_dict: _InfoDict): ...
106+
def render_subtitles_table(self, video_id: str, subtitles): ...
107+
def list_formats(self, info_dict: _InfoDict) -> None: ...
108+
def list_thumbnails(self, info_dict: _InfoDict) -> None: ...
109+
def list_subtitles(self, video_id: str, subtitles, name: str = "subtitles") -> None: ...
110+
def print_debug_header(self) -> None: ...
111+
@cached_property
112+
def proxies(self) -> dict[str, object]: ...
113+
@cached_property
114+
def cookiejar(self) -> YoutubeDLCookieJar: ...
115+
def urlopen(self, req: Request | str) -> Response: ...
116+
def build_request_director(
117+
self, handlers: Collection[RequestHandler], preferences: Collection[object] | None = None
118+
) -> RequestDirector: ...
119+
def encode(self, s: str) -> bytes: ...
120+
def get_encoding(self) -> str: ...

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy