]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fusion.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
12 class FusionIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?fusion\.(?:net|tv)/(?:video/|show/.+?\bvideo=)(?P<id>\d+)'
15 'url': 'http://fusion.tv/video/201781/u-s-and-panamanian-forces-work-together-to-stop-a-vessel-smuggling-drugs/',
19 'title': 'U.S. and Panamanian forces work together to stop a vessel smuggling drugs',
20 'description': 'md5:0cc84a9943c064c0f46b128b41b1b0d7',
22 'timestamp': 1442589635,
23 'uploader': 'UNIVISON',
24 'upload_date': '20150918',
27 'skip_download': True,
31 'url': 'http://fusion.tv/video/201781',
32 'only_matching': True,
34 'url': 'https://fusion.tv/show/food-exposed-with-nelufar-hedayat/?ancla=full-episodes&video=588644',
35 'only_matching': True,
38 def _real_extract(self
, url
):
39 video_id
= self
._match
_id
(url
)
40 video
= self
._download
_json
(
41 'https://platform.fusion.net/wp-json/fusiondotnet/v1/video/' + video_id
, video_id
)
45 'title': video
['title'],
46 'description': video
.get('excerpt'),
47 'timestamp': parse_iso8601(video
.get('published')),
48 'series': video
.get('show'),
52 src
= video
.get('src') or {}
53 for f_id
, f
in src
.items():
54 for q_id
, q
in f
.items():
58 ext
= determine_ext(q_url
, mimetype2ext(q
.get('type')))
60 formats
.extend(self
._extract
_smil
_formats
(q_url
, video_id
, fatal
=False))
61 elif f_id
== 'm3u8-variant' or (ext
== 'm3u8' and q_id
== 'Variant'):
62 formats
.extend(self
._extract
_m
3u8_formats
(
63 q_url
, video_id
, 'mp4', 'm3u8_native', m3u8_id
='hls', fatal
=False))
66 'format_id': '-'.join([f_id
, q_id
]),
68 'width': int_or_none(q
.get('width')),
69 'height': int_or_none(q
.get('height')),
70 'tbr': int_or_none(self
._search
_regex
(r
'_(\d+)\.m(?:p4|3u8)', q_url
, 'bitrate')),
71 'ext': 'mp4' if ext
== 'm3u8' else ext
,
72 'protocol': 'm3u8_native' if ext
== 'm3u8' else 'https',
75 self
._sort
_formats
(formats
)
76 info
['formats'] = formats
80 'url': 'anvato:uni:' + video
['video_ids']['anvato'],