]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/megaphone.py
[ie/mlbtv] Fix extraction (#10296)
[yt-dlp.git] / yt_dlp / extractor / megaphone.py
index 0c150ef45c377dab2c68413c6861565649c5bef1..d249a8492d9075ed79a79279b6b435c404bf77fd 100644 (file)
@@ -1,5 +1,3 @@
-import re
-
 from .common import InfoExtractor
 from ..utils import js_to_json
 
@@ -7,17 +5,18 @@
 class MegaphoneIE(InfoExtractor):
     IE_NAME = 'megaphone.fm'
     IE_DESC = 'megaphone.fm embedded players'
-    _VALID_URL = r'https://player\.megaphone\.fm/(?P<id>[A-Z0-9]+)'
+    _VALID_URL = r'https?://player\.megaphone\.fm/(?P<id>[A-Z0-9]+)'
+    _EMBED_REGEX = [rf'<iframe[^>]*?\ssrc=["\'](?P<url>{_VALID_URL})']
     _TEST = {
-        'url': 'https://player.megaphone.fm/GLT9749789991?"',
+        'url': 'https://player.megaphone.fm/GLT9749789991',
         'md5': '4816a0de523eb3e972dc0dda2c191f96',
         'info_dict': {
             'id': 'GLT9749789991',
             'ext': 'mp3',
             'title': '#97 What Kind Of Idiot Gets Phished?',
             'thumbnail': r're:^https://.*\.png.*$',
-            'duration': 1776.26375,
-            'author': 'Reply All',
+            'duration': 1998.36,
+            'creators': ['Reply All'],
         },
     }
 
@@ -41,12 +40,7 @@ def _real_extract(self, url):
             'id': video_id,
             'thumbnail': thumbnail,
             'title': title,
-            'author': author,
+            'creators': [author] if author else None,
             'duration': episode_data['duration'],
             'formats': formats,
         }
-
-    @classmethod
-    def _extract_urls(cls, webpage):
-        return [m[0] for m in re.findall(
-            r'<iframe[^>]*?\ssrc=["\'](%s)' % cls._VALID_URL, webpage)]