Skip to content

Commit 68b91e2

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

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

+3311
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.*
9+
yt_dlp.compat.types.*
10+
yt_dlp.compat.urllib.*
11+
yt_dlp.dependencies.*
12+
yt_dlp.downloader.FileDownloader.parse_bytes
13+
yt_dlp.jsinterp.Debugger.sys
14+
yt_dlp.utils.xattr
15+
yt_dlp.networking.impersonate.ImpersonateTarget._DT
16+
yt_dlp.downloader.bunnycdn
17+
# Deprecated
18+
yt_dlp.networking.common.Response.getcode
19+
yt_dlp.networking.common.Response.code
20+
yt_dlp.networking.common.Response.getheader
21+
yt_dlp.networking.common.Response.geturl
22+
yt_dlp.networking.common.Response.info
23+
yt_dlp.networking.Response.code
24+
yt_dlp.networking.Response.getcode
25+
yt_dlp.networking.Response.geturl
26+
yt_dlp.networking.Response.getheader
27+
yt_dlp.networking.Response.info
28+
yt_dlp.utils._legacy.decode_png
29+
# except IndexError is sufficient.
30+
yt_dlp.utils._utils.PlaylistEntries.IndexError
31+
yt_dlp.utils._utils.PagedList.IndexError
32+
yt_dlp.utils._utils.LazyList.IndexError
33+
yt_dlp.utils.LazyList.IndexError
34+
yt_dlp.utils.PagedList.IndexError
35+
yt_dlp.utils.PlaylistEntries.IndexError
36+
# Custom __all__
37+
yt_dlp.utils.__all__
38+
yt_dlp.networking.__all__
39+
# websockets is not typed or stubbed.
40+
yt_dlp.networking._websockets

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

0 commit comments

Comments
 (0)