Skip to content

Commit

Permalink
Fixed groups() call on potentially empty regex search object (#30676)
Browse files Browse the repository at this point in the history
* Fixed groups() call on potentially empty regex search object.
- #30521

* minimising lines changed

Co-authored-by: yayorbitgum <[email protected]>
  • Loading branch information
dirkf and 7MinutesDead-Git authored Feb 24, 2022
1 parent 923292b commit 1f13ccf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion youtube_dl/extractor/myspass.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def _real_extract(self, url):
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(
Expand Down

0 comments on commit 1f13ccf

Please sign in to comment.