From a73ef8c77671ff08742dad337716392ad3c96568 Mon Sep 17 00:00:00 2001 From: nixxo Date: Thu, 12 Jan 2023 21:37:07 +0100 Subject: [PATCH] Improved documentation for _VALID_URL Co-authored-by: dirkf --- yt_dlp/extractor/common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 958674574..a4483576e 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -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