Take the first result without breaking from a loop

Co-authored-by: dirkf <fieldhouse@gmx.net>
This commit is contained in:
Bart Broere 2025-05-19 17:29:18 +02:00 committed by GitHub
parent 35857bf76b
commit 86118717af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -357,11 +357,9 @@ class VPROIE(NPOIE):
def _real_extract(self, url): def _real_extract(self, url):
video_id = url.rstrip('/').split('/')[-1] video_id = url.rstrip('/').split('/')[-1]
page = self._download_webpage(url, video_id) page = self._download_webpage(url, video_id)
results = re.findall(r'data-media-id="([a-zA-Z0-9_]+)"\s', page) format = traverse_obj(re.search(r'data-media-id="([a-zA-Z0-9_]+)"\s', page), (
formats = [] 1, T(lambda x: self._extract_formats_by_product_id(x, video_id)),
for result in results: Ellipsis))
formats.extend(self._extract_formats_by_product_id(result, video_id))
break
self._sort_formats(formats) self._sort_formats(formats)