]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/fusion.py
1 from .common
import InfoExtractor
10 class FusionIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?fusion\.(?:net|tv)/(?:video/|show/.+?\bvideo=)(?P<id>\d+)'
13 'url': 'http://fusion.tv/video/201781/u-s-and-panamanian-forces-work-together-to-stop-a-vessel-smuggling-drugs/',
17 'title': 'U.S. and Panamanian forces work together to stop a vessel smuggling drugs',
18 'description': 'md5:0cc84a9943c064c0f46b128b41b1b0d7',
20 'timestamp': 1442589635,
21 'uploader': 'UNIVISON',
22 'upload_date': '20150918',
25 'skip_download': True,
29 'url': 'http://fusion.tv/video/201781',
30 'only_matching': True,
32 'url': 'https://fusion.tv/show/food-exposed-with-nelufar-hedayat/?ancla=full-episodes&video=588644',
33 'only_matching': True,
36 def _real_extract(self
, url
):
37 video_id
= self
._match
_id
(url
)
38 video
= self
._download
_json
(
39 'https://platform.fusion.net/wp-json/fusiondotnet/v1/video/' + video_id
, video_id
)
43 'title': video
['title'],
44 'description': video
.get('excerpt'),
45 'timestamp': parse_iso8601(video
.get('published')),
46 'series': video
.get('show'),
50 src
= video
.get('src') or {}
51 for f_id
, f
in src
.items():
52 for q_id
, q
in f
.items():
56 ext
= determine_ext(q_url
, mimetype2ext(q
.get('type')))
58 formats
.extend(self
._extract
_smil
_formats
(q_url
, video_id
, fatal
=False))
59 elif f_id
== 'm3u8-variant' or (ext
== 'm3u8' and q_id
== 'Variant'):
60 formats
.extend(self
._extract
_m
3u8_formats
(
61 q_url
, video_id
, 'mp4', 'm3u8_native', m3u8_id
='hls', fatal
=False))
64 'format_id': '-'.join([f_id
, q_id
]),
66 'width': int_or_none(q
.get('width')),
67 'height': int_or_none(q
.get('height')),
68 'tbr': int_or_none(self
._search
_regex
(r
'_(\d+)\.m(?:p4|3u8)', q_url
, 'bitrate')),
69 'ext': 'mp4' if ext
== 'm3u8' else ext
,
70 'protocol': 'm3u8_native' if ext
== 'm3u8' else 'https',
73 self
._sort
_formats
(formats
)
74 info
['formats'] = formats
78 'url': 'anvato:uni:' + video
['video_ids']['anvato'],