Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Clarify extractors returning None #9963
Comments
|
A vote for printing generic no-videos-found error messages. This simplifies error handling in individual extractors and avoid possible duplicated/similar codes.
YoutubeDL reports a warning at https://github.com/rg3/youtube-dl/blob/master/youtube_dl/YoutubeDL.py#L854-L856. If there's a working extractor that returns a |
|
previously muliple members told me that i should raise an error if there are no formats to extract(at least here and here).
instead of repeat the same thing in every extractor just handle it once. |
It does not take skipped tests into account so there still may be such extractors. |
|
You're right. Checking all extractors is the only way. |
|
I'd also prefer a generic error since it offers explicit indication at the same time providing a room for customization (particular extractor may throw own |
|
If an extractor is quite sure there are no videos, it can raise a different error, for example a new method named |
What is the purpose of your issue?
There are some extractors in youtube-dl's codebase that may return
Noneresulting in youtube-dl exiting silently. This pattern is used for a long time already even in non-legacy code.InfoExtractoris sort of ambiguous about returningNoneand thus should be clarified.As such we can allow returning
Nonefrom extractor and print generic no-videos-found error message (or raise exception). Or we can forbid this at all and always require extractor to return a standard info dict. What are the opinions?Extractors that may technically return
None:We may also finally drop
compat_listcompatibility code since we don't have such extractors anymore (or do we?).compat_listextractors: