From 43aebb7db45c346f0285d4b3bd50227dd3397416 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sun, 7 Aug 2022 03:29:19 +0530 Subject: [PATCH] Bugfix for bfd973ece3369c593b5e82a88cc16de80088a73e `_extract_embed_urls` is not a list Closes #4581 --- yt_dlp/extractor/foxnews.py | 9 ++++----- yt_dlp/extractor/francetv.py | 2 +- yt_dlp/extractor/heise.py | 2 +- yt_dlp/extractor/vk.py | 12 ++++++------ 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/yt_dlp/extractor/foxnews.py b/yt_dlp/extractor/foxnews.py index 2343dd20d..a0b116608 100644 --- a/yt_dlp/extractor/foxnews.py +++ b/yt_dlp/extractor/foxnews.py @@ -58,14 +58,13 @@ class FoxNewsIE(AMPIE): @classmethod def _extract_embed_urls(cls, url, webpage): - return [ - f'https://video.foxnews.com/v/video-embed.html?video_id={mobj.group("video_id")}' - for mobj in re.finditer( + for mobj in re.finditer( r'''(?x) <(?:script|(?:amp-)?iframe)[^>]+\bsrc=["\'] (?:https?:)?//video\.foxnews\.com/v/(?:video-embed\.html|embed\.js)\? (?:[^>"\']+&)?(?:video_)?id=(?P\d+) - ''', webpage)] + ''', webpage): + yield f'https://video.foxnews.com/v/video-embed.html?video_id={mobj.group("video_id")}' def _real_extract(self, url): host, video_id = self._match_valid_url(url).groups() @@ -125,4 +124,4 @@ def _real_extract(self, url): 'http://video.foxnews.com/v/' + video_id, FoxNewsIE.ie_key()) return self.url_result( - FoxNewsIE._extract_embed_urls(url, webpage)[0], FoxNewsIE.ie_key()) + next(FoxNewsIE._extract_embed_urls(url, webpage)), FoxNewsIE.ie_key()) diff --git a/yt_dlp/extractor/francetv.py b/yt_dlp/extractor/francetv.py index ba9e69161..56a00a238 100644 --- a/yt_dlp/extractor/francetv.py +++ b/yt_dlp/extractor/francetv.py @@ -371,7 +371,7 @@ def _real_extract(self, url): webpage = self._download_webpage(url, display_id) - dailymotion_urls = DailymotionIE._extract_embed_urls(url, webpage) + dailymotion_urls = tuple(DailymotionIE._extract_embed_urls(url, webpage)) if dailymotion_urls: return self.playlist_result([ self.url_result(dailymotion_url, DailymotionIE.ie_key()) diff --git a/yt_dlp/extractor/heise.py b/yt_dlp/extractor/heise.py index a80eaaf81..4f689c6e4 100644 --- a/yt_dlp/extractor/heise.py +++ b/yt_dlp/extractor/heise.py @@ -121,7 +121,7 @@ def _make_kaltura_result(kaltura_url): if kaltura_id: return _make_kaltura_result('kaltura:2238431:%s' % kaltura_id) - yt_urls = YoutubeIE._extract_embed_urls(url, webpage) + yt_urls = tuple(YoutubeIE._extract_embed_urls(url, webpage)) if yt_urls: return self.playlist_from_matches( yt_urls, video_id, title, ie=YoutubeIE.ie_key()) diff --git a/yt_dlp/extractor/vk.py b/yt_dlp/extractor/vk.py index 95ea63ffa..69f518b69 100644 --- a/yt_dlp/extractor/vk.py +++ b/yt_dlp/extractor/vk.py @@ -447,17 +447,17 @@ def _real_extract(self, url): m_rutube.group(1).replace('\\', '')) return self.url_result(rutube_url) - dailymotion_urls = DailymotionIE._extract_embed_urls(url, info_page) - if dailymotion_urls: - return self.url_result(dailymotion_urls[0], DailymotionIE.ie_key()) + dailymotion_url = next(DailymotionIE._extract_embed_urls(url, info_page), None) + if dailymotion_url: + return self.url_result(dailymotion_url, DailymotionIE.ie_key()) odnoklassniki_url = OdnoklassnikiIE._extract_url(info_page) if odnoklassniki_url: return self.url_result(odnoklassniki_url, OdnoklassnikiIE.ie_key()) - sibnet_urls = self._extract_embed_urls(url, info_page) - if sibnet_urls: - return self.url_result(sibnet_urls[0]) + sibnet_url = next(self._extract_embed_urls(url, info_page), None) + if sibnet_url: + return self.url_result(sibnet_url) m_opts = re.search(r'(?s)var\s+opts\s*=\s*({.+?});', info_page) if m_opts: