]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/uplynk.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class UplynkIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://.*?\.uplynk\.com/(?P<path>ext/[0-9a-f]{32}/(?P<external_id>[^/?&]+)|(?P<id>[0-9a-f]{32}))\.(?:m3u8|json)(?:.*?\bpbs=(?P<session_id>[^&]+))?'
17 'url': 'http://content.uplynk.com/e89eaf2ce9054aa89d92ddb2d817a52e.m3u8',
19 'id': 'e89eaf2ce9054aa89d92ddb2d817a52e',
21 'title': '030816-kgo-530pm-solar-eclipse-vid_web.mp4',
22 'uploader_id': '4413701bf5a1488db55b767f8ae9d4fa',
26 'skip_download': True,
30 def _extract_uplynk_info(self
, uplynk_content_url
):
31 path
, external_id
, video_id
, session_id
= re
.match(UplynkIE
._VALID
_URL
, uplynk_content_url
).groups()
32 display_id
= video_id
or external_id
33 formats
= self
._extract
_m
3u8_formats
(
34 'http://content.uplynk.com/%s.m3u8' % path
,
35 display_id
, 'mp4', 'm3u8_native')
38 f
['extra_param_to_segment_url'] = 'pbs=' + session_id
39 self
._sort
_formats
(formats
)
40 asset
= self
._download
_json
('http://content.uplynk.com/player/assetinfo/%s.json' % path
, display_id
)
41 if asset
.get('error') == 1:
42 raise ExtractorError('% said: %s' % (self
.IE_NAME
, asset
['msg']), expected
=True)
46 'title': asset
['desc'],
47 'thumbnail': asset
.get('default_poster_url'),
48 'duration': float_or_none(asset
.get('duration')),
49 'uploader_id': asset
.get('owner'),
53 def _real_extract(self
, url
):
54 return self
._extract
_uplynk
_info
(url
)
57 class UplynkPreplayIE(UplynkIE
):
58 IE_NAME
= 'uplynk:preplay'
59 _VALID_URL
= r
'https?://.*?\.uplynk\.com/preplay2?/(?P<path>ext/[0-9a-f]{32}/(?P<external_id>[^/?&]+)|(?P<id>[0-9a-f]{32}))\.json'
62 def _real_extract(self
, url
):
63 path
, external_id
, video_id
= re
.match(self
._VALID
_URL
, url
).groups()
64 display_id
= video_id
or external_id
65 preplay
= self
._download
_json
(url
, display_id
)
66 content_url
= 'http://content.uplynk.com/%s.m3u8' % path
67 session_id
= preplay
.get('sid')
69 content_url
+= '?pbs=' + session_id
70 return self
._extract
_uplynk
_info
(content_url
)