]>
jfr.im git - yt-dlp.git/blob - youtube_dlc/extractor/arkena.py
854f5876757885c9966fe11ddc56b8553e54c561
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urlparse
19 class ArkenaIE(InfoExtractor
):
23 video\.arkena\.com/play2/embed/player\?|
24 play\.arkena\.com/(?:config|embed)/avp/v\d/player/media/(?P<id>[^/]+)/[^/]+/(?P<account_id>\d+)
28 'url': 'https://play.arkena.com/embed/avp/v2/player/media/b41dda37-d8e7-4d3f-b1b5-9a9db578bdfe/1/129411',
29 'md5': 'b96f2f71b359a8ecd05ce4e1daa72365',
31 'id': 'b41dda37-d8e7-4d3f-b1b5-9a9db578bdfe',
33 'title': 'Big Buck Bunny',
34 'description': 'Royalty free test video',
35 'timestamp': 1432816365,
36 'upload_date': '20150528',
40 'url': 'https://play.arkena.com/config/avp/v2/player/media/b41dda37-d8e7-4d3f-b1b5-9a9db578bdfe/1/129411/?callbackMethod=jQuery1111023664739129262213_1469227693893',
41 'only_matching': True,
43 'url': 'http://play.arkena.com/config/avp/v1/player/media/327336/darkmatter/131064/?callbackMethod=jQuery1111002221189684892677_1469227595972',
44 'only_matching': True,
46 'url': 'http://play.arkena.com/embed/avp/v1/player/media/327336/darkmatter/131064/',
47 'only_matching': True,
49 'url': 'http://video.arkena.com/play2/embed/player?accountId=472718&mediaId=35763b3b-00090078-bf604299&pageStyling=styled',
50 'only_matching': True,
54 def _extract_url(webpage
):
55 # See https://support.arkena.com/display/PLAY/Ways+to+embed+your+video
57 r
'<iframe[^>]+src=(["\'])(?P
<url
>(?
:https?
:)?
//play\
.arkena\
.com
/embed
/avp
/.+?
)\
1',
60 return mobj.group('url
')
62 def _real_extract(self, url):
63 mobj = re.match(self._VALID_URL, url)
64 video_id = mobj.group('id')
65 account_id = mobj.group('account_id
')
67 # Handle http://video.arkena.com/play2/embed/player URL
69 qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
70 video_id = qs.get('mediaId
', [None])[0]
71 account_id = qs.get('accountId
', [None])[0]
72 if not video_id or not account_id:
73 raise ExtractorError('Invalid URL
', expected=True)
75 playlist = self._download_json(
76 'https
://play
.arkena
.com
/config
/avp
/v2
/player
/media
/%s/0/%s/?callbackMethod
=_
'
77 % (video_id, account_id),
78 video_id, transform_source=strip_jsonp)['Playlist
'][0]
80 media_info = playlist['MediaInfo
']
81 title = media_info['Title
']
82 media_files = playlist['MediaFiles
']
86 for kind_case, kind_formats in media_files.items():
87 kind = kind_case.lower()
88 for f in kind_formats:
92 is_live = f.get('Live
') == 'true
'
93 exts = (mimetype2ext(f.get('Type
')), determine_ext(f_url, None))
94 if kind == 'm3u8
' or 'm3u8
' in exts:
95 formats.extend(self._extract_m3u8_formats(
96 f_url, video_id, 'mp4
', 'm3u8_native
',
97 m3u8_id=kind, fatal=False, live=is_live))
98 elif kind == 'flash
' or 'f4m
' in exts:
99 formats.extend(self._extract_f4m_formats(
100 f_url, video_id, f4m_id=kind, fatal=False))
101 elif kind == 'dash
' or 'mpd
' in exts:
102 formats.extend(self._extract_mpd_formats(
103 f_url, video_id, mpd_id=kind, fatal=False))
104 elif kind == 'silverlight
':
105 # TODO: process when ism is supported (see
106 # https://github.com/ytdl-org/youtube-dl/issues/8118)
109 tbr = float_or_none(f.get('Bitrate
'), 1000)
112 'format_id
': '%s-%d' % (kind, tbr) if tbr else kind,
115 self._sort_formats(formats)
117 description = media_info.get('Description
')
118 video_id = media_info.get('VideoId
') or video_id
119 timestamp = parse_iso8601(media_info.get('PublishDate
'))
121 'url
': thumbnail['Url
'],
122 'width
': int_or_none(thumbnail.get('Size
')),
123 } for thumbnail in (media_info.get('Poster
') or []) if thumbnail.get('Url
')]
128 'description
': description,
129 'timestamp
': timestamp,
131 'thumbnails
': thumbnails,