]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/megaphone.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import js_to_json
10 class MegaphoneIE(InfoExtractor
):
11 IE_NAME
= 'megaphone.fm'
12 IE_DESC
= 'megaphone.fm embedded players'
13 _VALID_URL
= r
'https://player\.megaphone\.fm/(?P<id>[A-Z0-9]+)'
15 'url': 'https://player.megaphone.fm/GLT9749789991?"',
16 'md5': '4816a0de523eb3e972dc0dda2c191f96',
18 'id': 'GLT9749789991',
20 'title': '#97 What Kind Of Idiot Gets Phished?',
21 'thumbnail': r
're:^https://.*\.png.*$',
22 'duration': 1776.26375,
23 'author': 'Reply All',
27 def _real_extract(self
, url
):
28 video_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, video_id
)
31 title
= self
._og
_search
_property
('audio:title', webpage
)
32 author
= self
._og
_search
_property
('audio:artist', webpage
)
33 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
35 episode_json
= self
._search
_regex
(r
'(?s)var\s+episode\s*=\s*(\{.+?\});', webpage
, 'episode JSON')
36 episode_data
= self
._parse
_json
(episode_json
, video_id
, js_to_json
)
37 video_url
= self
._proto
_relative
_url
(episode_data
['mediaUrl'], 'https:')
45 'thumbnail': thumbnail
,
48 'duration': episode_data
['duration'],
53 def _extract_urls(cls
, webpage
):
54 return [m
[0] for m
in re
.findall(
55 r
'<iframe[^>]*?\ssrc=["\'](%s)' % cls._VALID_URL, webpage)]