diff options
author | dirkf <fieldhouse@gmx.net> | 2022-02-24 18:26:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-24 18:26:58 +0000 |
commit | 1f13ccfd7fcafbfd79ddd652967e02f9eda7ce79 (patch) | |
tree | 9ceed414b06ddf6339458e70a2fa1bc0f27b3013 | |
parent | 923292ba643bf2a5c1fade797bd87a0de4f58d25 (diff) | |
download | youtube-dl-1f13ccfd7fcafbfd79ddd652967e02f9eda7ce79.tar.gz youtube-dl-1f13ccfd7fcafbfd79ddd652967e02f9eda7ce79.tar.xz |
Fixed groups() call on potentially empty regex search object (#30676)
* Fixed groups() call on potentially empty regex search object.
- https://github.com/ytdl-org/youtube-dl/issues/30521
* minimising lines changed
Co-authored-by: yayorbitgum <50963144+yayorbitgum@users.noreply.github.com>
-rw-r--r-- | youtube_dl/extractor/myspass.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/extractor/myspass.py b/youtube_dl/extractor/myspass.py index db7ebc94c..f540c52ee 100644 --- a/youtube_dl/extractor/myspass.py +++ b/youtube_dl/extractor/myspass.py @@ -35,7 +35,9 @@ class MySpassIE(InfoExtractor): title = xpath_text(metadata, 'title', fatal=True) video_url = xpath_text(metadata, 'url_flv', 'download url', True) video_id_int = int(video_id) - for group in re.search(r'/myspass2009/\d+/(\d+)/(\d+)/(\d+)/', video_url).groups(): + + grps = re.search(r'/myspass2009/\d+/(\d+)/(\d+)/(\d+)/', video_url) + for group in grps.groups() if grps else []: group_int = int(group) if group_int > video_id_int: video_url = video_url.replace( |