diff --git a/yt_dlp/extractor/foxnews.py b/yt_dlp/extractor/foxnews.py index 2343dd20d2..a0b1166080 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 @@ class FoxNewsArticleIE(InfoExtractor): '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 ba9e691613..56a00a2387 100644 --- a/yt_dlp/extractor/francetv.py +++ b/yt_dlp/extractor/francetv.py @@ -371,7 +371,7 @@ class FranceTVInfoIE(FranceTVBaseInfoExtractor): 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 a80eaaf81d..4f689c6e49 100644 --- a/yt_dlp/extractor/heise.py +++ b/yt_dlp/extractor/heise.py @@ -121,7 +121,7 @@ class HeiseIE(InfoExtractor): 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 95ea63ffa1..69f518b698 100644 --- a/yt_dlp/extractor/vk.py +++ b/yt_dlp/extractor/vk.py @@ -447,17 +447,17 @@ class VKIE(VKBaseIE): 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: