Improved documentation for _VALID_URL

Co-authored-by: dirkf <fieldhouse@gmx.net>
This commit is contained in:
nixxo 2023-01-12 21:37:07 +01:00
parent 518d585eb7
commit a73ef8c776
No known key found for this signature in database
GPG key ID: E0DE62EF9A9BFAB2

View file

@ -447,8 +447,11 @@ class InfoExtractor:
Subclasses of this should also be added to the list of extractors and
should define a _VALID_URL regexp (a single string or a list) and, re-define the _real_extract() and
(optionally) _real_initialize() methods.
should define _VALID_URL as a regexp, or list (or tuple) of regexps, and
re-define the _real_extract() and (optionally) _real_initialize() methods.
The list syntax for _VALID_URL simplifies matching disparate URL patterns
where conditional groups or subclass IEs would be needed to target the
different locations of the ID field with a single regexp.
Subclasses may also override suitable() if necessary, but ensure the function
signature is preserved and that this function imports everything it needs