]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/megaphone.py
3 from .common
import InfoExtractor
4 from ..utils
import js_to_json
7 class MegaphoneIE(InfoExtractor
):
8 IE_NAME
= 'megaphone.fm'
9 IE_DESC
= 'megaphone.fm embedded players'
10 _VALID_URL
= r
'https://player\.megaphone\.fm/(?P<id>[A-Z0-9]+)'
12 'url': 'https://player.megaphone.fm/GLT9749789991?"',
13 'md5': '4816a0de523eb3e972dc0dda2c191f96',
15 'id': 'GLT9749789991',
17 'title': '#97 What Kind Of Idiot Gets Phished?',
18 'thumbnail': r
're:^https://.*\.png.*$',
19 'duration': 1776.26375,
20 'author': 'Reply All',
24 def _real_extract(self
, url
):
25 video_id
= self
._match
_id
(url
)
26 webpage
= self
._download
_webpage
(url
, video_id
)
28 title
= self
._og
_search
_property
('audio:title', webpage
)
29 author
= self
._og
_search
_property
('audio:artist', webpage
)
30 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
32 episode_json
= self
._search
_regex
(r
'(?s)var\s+episode\s*=\s*(\{.+?\});', webpage
, 'episode JSON')
33 episode_data
= self
._parse
_json
(episode_json
, video_id
, js_to_json
)
34 video_url
= self
._proto
_relative
_url
(episode_data
['mediaUrl'], 'https:')
42 'thumbnail': thumbnail
,
45 'duration': episode_data
['duration'],
50 def _extract_urls(cls
, webpage
):
51 return [m
[0] for m
in re
.findall(
52 r
'<iframe[^>]*?\ssrc=["\'](%s)' % cls._VALID_URL, webpage)]