From 198f7ea89e89f0b3bc1f890cd4e5b98006fe9fa2 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 13 Jul 2021 09:17:39 +0200 Subject: [PATCH] [extractor] Allow extracting multiple groups in `_search_regex` From #497, Authored by: fstirlitz --- yt_dlp/extractor/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 8ad657fe51..81b88e4fa9 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -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: