Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add yt-dlp stubs#14216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Tatsh wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromTatsh:yt-dlp
Open

Add yt-dlp stubs#14216

Tatsh wants to merge1 commit intopython:mainfromTatsh:yt-dlp

Conversation

Tatsh
Copy link
Contributor

@TatshTatsh commentedJun 3, 2025
edited
Loading

Porting over fromTatsh/yt-dlp-types.

Upstream is unlikely to have full types any time soon. Though it may seem like an insular project, there is utility in using yt-dlp outside as I do in some of my projects. Examples:

  • Use yt-dlp in addition to other code when archiving a site (yt-dlp does a good job collecting metadata with the videos)
  • Use yt-dlp but write an extractor you do not wish to contribute to yt-dlp (added viaYoutubeDL.add_info_extractor()).

Private methods are included inyt_dlp.extractor.common.InfoExtractor because it is normal to extend this class and override them.

There is no intention to stub all the different extractors and post-processors. Generally they are only called by yt-dlp's 'main'.

Deprecated functions and methods are generally not included.

Once accepted I will deprecate and archive yt-dlp-types on Github and on PyPI.

cc@Sky-NiniKo@thcrt

Usages:

@github-actionsGitHub Actions

This comment has been minimized.

@TatshTatshforce-pushed theyt-dlp branch 2 times, most recently fromd61f3aa todca5efbCompareJune 4, 2025 00:07
@github-actionsGitHub Actions

This comment has been minimized.

@thcrt
Copy link

Cheers for cc-ing me, appreciate it. It would indeed be nice to have the stubs maintained in typeshed and hence more easily discoverable for devs callingyt-dlp directly.

@TatshTatshforce-pushed theyt-dlp branch 4 times, most recently from768a80d to9386a7dCompareJune 7, 2025 06:11
@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@TatshTatshforce-pushed theyt-dlp branch 3 times, most recently fromc85fb47 tof75d465CompareJune 7, 2025 08:58
@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@TatshTatshforce-pushed theyt-dlp branch 6 times, most recently fromb2beb7e todbb88acCompareJune 8, 2025 04:53
@github-actionsGitHub Actions

This comment has been minimized.

@Tatsh
Copy link
ContributorAuthor

@srittau this is ready for review.

@github-actionsGitHub Actions
Copy link
Contributor

Diff frommypy_primer, showing the effect of this PR on open source code:

core (https://github.com/home-assistant/core)+ homeassistant/components/media_extractor/__init__.py:63: error: Incompatible types (expression has type "Logger", TypedDict item "logger" has type "_LoggerProtocol")  [typeddict-item]+ homeassistant/components/media_extractor/__init__.py:63: note: "Logger" is missing following "_LoggerProtocol" protocol members:+ homeassistant/components/media_extractor/__init__.py:63: note:     stderr, stdout+ homeassistant/components/media_extractor/__init__.py:63: note: Following member(s) of "Logger" have conflicts:+ homeassistant/components/media_extractor/__init__.py:63: note:     Expected:+ homeassistant/components/media_extractor/__init__.py:63: note:         def warning(self, message: str, *, once: bool = ..., only_once: bool = ...) -> None+ homeassistant/components/media_extractor/__init__.py:63: note:     Got:+ homeassistant/components/media_extractor/__init__.py:63: note:         def warning(self, msg: object, *args: object, exc_info: bool | tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None] | BaseException | None = ..., stack_info: bool = ..., stacklevel: int = ..., extra: Mapping[str, object] | None = ...) -> None+ homeassistant/components/media_extractor/__init__.py:186: error: Argument 1 to "YoutubeDL" has incompatible type "dict[str, object]"; expected "_Params | None"  [arg-type]+ homeassistant/components/media_extractor/__init__.py:196: error: TypedDict "_InfoDict" has no key "entries"  [typeddict-item]+ homeassistant/components/media_extractor/__init__.py:215: error: TypedDict "_InfoDict" has no key "extractor"  [typeddict-item]+ homeassistant/components/media_extractor/__init__.py:216: error: Argument 1 to "get_best_stream_youtube" has incompatible type "list[object] | None"; expected "list[dict[str, Any]]"  [arg-type]+ homeassistant/components/media_extractor/__init__.py:217: error: Argument 1 to "get_best_stream" has incompatible type "list[object] | None"; expected "list[dict[str, Any]]"  [arg-type]

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Tatsh@thcrt

[8]ページ先頭

©2009-2025 Movatter.jp