From b86ca447ce0dc7b41e5314a7bb566cfa4d5a3660 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Wed, 31 Aug 2022 22:24:31 +0530 Subject: [PATCH] [extractor/mediaset] Fix embed extraction Closes #4804 --- yt_dlp/extractor/mediaset.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/yt_dlp/extractor/mediaset.py b/yt_dlp/extractor/mediaset.py index 0671c29a6..ebe894f74 100644 --- a/yt_dlp/extractor/mediaset.py +++ b/yt_dlp/extractor/mediaset.py @@ -172,31 +172,27 @@ class MediasetIE(ThePlatformBaseIE): }] def _extract_from_webpage(self, url, webpage): - def _qs(url): - return parse_qs(url) - def _program_guid(qs): return qs.get('programGuid', [None])[0] - entries = [] for mobj in re.finditer( r']+\bsrc=(["\'])(?P(?:https?:)?//(?:www\.)?video\.mediaset\.it/player/playerIFrame(?:Twitter)?\.shtml.*?)\1', webpage): embed_url = mobj.group('url') - embed_qs = _qs(embed_url) + embed_qs = parse_qs(embed_url) program_guid = _program_guid(embed_qs) if program_guid: - entries.append(embed_url) + yield self.url_result(embed_url) continue + video_id = embed_qs.get('id', [None])[0] if not video_id: continue urlh = self._request_webpage(embed_url, video_id, note='Following embed URL redirect') embed_url = urlh.geturl() - program_guid = _program_guid(_qs(embed_url)) + program_guid = _program_guid(parse_qs(embed_url)) if program_guid: - entries.append(embed_url) - return entries + yield self.url_result(embed_url) def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_params=None, transform_rtmp_url=None): for video in smil.findall(self._xpath_ns('.//video', namespace)):