From 86118717af925f046bb34f68dbc426da62d1da91 Mon Sep 17 00:00:00 2001 From: Bart Broere Date: Mon, 19 May 2025 17:29:18 +0200 Subject: [PATCH] Take the first result without breaking from a loop Co-authored-by: dirkf --- youtube_dl/extractor/npo.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/npo.py b/youtube_dl/extractor/npo.py index ffa98e769..26d31afb4 100644 --- a/youtube_dl/extractor/npo.py +++ b/youtube_dl/extractor/npo.py @@ -357,11 +357,9 @@ class VPROIE(NPOIE): def _real_extract(self, url): video_id = url.rstrip('/').split('/')[-1] page = self._download_webpage(url, video_id) - results = re.findall(r'data-media-id="([a-zA-Z0-9_]+)"\s', page) - formats = [] - for result in results: - formats.extend(self._extract_formats_by_product_id(result, video_id)) - break + format = traverse_obj(re.search(r'data-media-id="([a-zA-Z0-9_]+)"\s', page), ( + 1, T(lambda x: self._extract_formats_by_product_id(x, video_id)), + Ellipsis)) self._sort_formats(formats)