]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/arkena.py
3 from .common
import InfoExtractor
14 class ArkenaIE(InfoExtractor
):
18 video\.(?:arkena|qbrick)\.com/play2/embed/player\?|
19 play\.arkena\.com/(?:config|embed)/avp/v\d/player/media/(?P<id>[^/]+)/[^/]+/(?P<account_id>\d+)
23 'url': 'https://video.qbrick.com/play2/embed/player?accountId=1034090&mediaId=d8ab4607-00090107-aab86310',
24 'md5': '97f117754e5f3c020f5f26da4a44ebaf',
26 'id': 'd8ab4607-00090107-aab86310',
28 'title': 'EM_HT20_117_roslund_v2.mp4',
29 'timestamp': 1608285912,
30 'upload_date': '20201218',
31 'duration': 1429.162667,
37 'url': 'https://play.arkena.com/embed/avp/v2/player/media/b41dda37-d8e7-4d3f-b1b5-9a9db578bdfe/1/129411',
38 'only_matching': True,
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 = self._match_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
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 media = self._download_json(
76 'https
://video
.qbrick
.com
/api
/v1
/public
/accounts
/%s/medias
/%s' % (account_id, video_id),
78 # https://video.qbrick.com/docs/api/examples/library-api.html
79 'fields
': 'asset
/resources
/*/renditions
/*(height
,id,language
,links
/*(href
,mimeType
),type,size
,videos
/*(audios
/*(codec
,sampleRate
),bitrate
,codec
,duration
,height
,width
),width
),created
,metadata
/*(title
,description
),tags
',
81 metadata = media.get('metadata
') or {}
82 title = metadata['title
']
88 for resource in media['asset
']['resources
']:
89 for rendition in (resource.get('renditions
') or []):
90 rendition_type = rendition.get('type')
91 for i, link in enumerate(rendition.get('links
') or []):
92 href = link.get('href
')
95 if rendition_type == 'image
':
97 'filesize
': int_or_none(rendition.get('size
')),
98 'height
': int_or_none(rendition.get('height
')),
99 'id': rendition.get('id'),
101 'width
': int_or_none(rendition.get('width
')),
103 elif rendition_type == 'subtitle
':
104 subtitles.setdefault(rendition.get('language
') or 'en
', []).append({
107 elif rendition_type == 'video
':
109 'filesize
': int_or_none(rendition.get('size
')),
110 'format_id
': rendition.get('id'),
113 video = try_get(rendition, lambda x: x['videos
'][i], dict)
116 duration = float_or_none(video.get('duration
'))
118 'height
': int_or_none(video.get('height
')),
119 'tbr
': int_or_none(video.get('bitrate
'), 1000),
120 'vcodec
': video.get('codec
'),
121 'width
': int_or_none(video.get('width
')),
123 audio = try_get(video, lambda x: x['audios
'][0], dict)
126 'acodec
': audio.get('codec
'),
127 'asr
': int_or_none(audio.get('sampleRate
')),
130 elif rendition_type == 'index
':
131 mime_type = link.get('mimeType
')
132 if mime_type == 'application
/smil
+xml
':
133 formats.extend(self._extract_smil_formats(
134 href, video_id, fatal=False))
135 elif mime_type == 'application
/x
-mpegURL
':
136 formats.extend(self._extract_m3u8_formats(
137 href, video_id, 'mp4
', 'm3u8_native
',
138 m3u8_id='hls
', fatal=False))
139 elif mime_type == 'application
/hds
+xml
':
140 formats.extend(self._extract_f4m_formats(
141 href, video_id, f4m_id='hds
', fatal=False))
142 elif mime_type == 'application
/dash
+xml
':
143 formats.extend(self._extract_f4m_formats(
144 href, video_id, f4m_id='hds
', fatal=False))
145 elif mime_type == 'application
/vnd
.ms
-sstr
+xml
':
146 formats.extend(self._extract_ism_formats(
147 href, video_id, ism_id='mss
', fatal=False))
148 self._sort_formats(formats)
153 'description
': metadata.get('description
'),
154 'timestamp
': parse_iso8601(media.get('created
')),
155 'thumbnails
': thumbnails,
156 'subtitles
': subtitles,
157 'duration
': duration,
158 'tags
': media.get('tags
'),