]> jfr.im git - yt-dlp.git/commitdiff
[extractor] Allow extracting multiple groups in `_search_regex`
authorfelix <redacted>
Tue, 13 Jul 2021 07:17:39 +0000 (09:17 +0200)
committerpukkandan <redacted>
Tue, 13 Jul 2021 23:32:42 +0000 (05:02 +0530)
From #497, Authored by: fstirlitz

yt_dlp/extractor/common.py

index 8ad657fe517ca74974591fd704f99807d33b3aa6..81b88e4fa9d59ba3b37968ed729299b9ef5fdbe9 100644 (file)
@@ -1111,6 +1111,8 @@ def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, f
             if group is None:
                 # return the first matching group
                 return next(g for g in mobj.groups() if g is not None)
+            elif isinstance(group, (list, tuple)):
+                return tuple(mobj.group(g) for g in group)
             else:
                 return mobj.group(group)
         elif default is not NO_DEFAULT: