]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fox.py
5f98d017b84aae5a88eb07655b68ac52726dd643
2 from __future__
import unicode_literals
4 from .adobepass
import AdobePassIE
5 from .uplynk
import UplynkPreplayIE
6 from ..compat
import compat_str
17 class FOXIE(AdobePassIE
):
18 _VALID_URL
= r
'https?://(?:www\.)?fox\.com/watch/(?P<id>[\da-fA-F]+)'
21 'url': 'https://www.fox.com/watch/4b765a60490325103ea69888fb2bd4e8/',
22 'md5': 'ebd296fcc41dd4b19f8115d8461a3165',
24 'id': '4b765a60490325103ea69888fb2bd4e8',
26 'title': 'Aftermath: Bruce Wayne Develops Into The Dark Knight',
27 'description': 'md5:549cd9c70d413adb32ce2a779b53b486',
29 'timestamp': 1504291893,
30 'upload_date': '20170901',
35 'skip_download': True,
38 # episode, geo-restricted
39 'url': 'https://www.fox.com/watch/087036ca7f33c8eb79b08152b4dd75c1/',
40 'only_matching': True,
42 # episode, geo-restricted, tv provided required
43 'url': 'https://www.fox.com/watch/30056b295fb57f7452aeeb4920bc3024/',
44 'only_matching': True,
47 def _real_extract(self
, url
):
48 video_id
= self
._match
_id
(url
)
50 video
= self
._download
_json
(
51 'https://api.fox.com/fbc-content/v1_4/video/%s' % video_id
,
53 'apikey': 'abdcbed02c124d393b39e818a4312055',
54 'Content-Type': 'application/json',
59 release_url
= video
['videoRelease']['url']
61 description
= video
.get('description')
62 duration
= int_or_none(video
.get('durationInSeconds')) or int_or_none(
63 video
.get('duration')) or parse_duration(video
.get('duration'))
64 timestamp
= unified_timestamp(video
.get('datePublished'))
65 age_limit
= parse_age_limit(video
.get('contentRating'))
68 video
, lambda x
: x
['trackingData']['properties'], dict) or {}
70 creator
= data
.get('brand') or data
.get('network') or video
.get('network')
72 series
= video
.get('seriesName') or data
.get(
73 'seriesName') or data
.get('show')
74 season_number
= int_or_none(video
.get('seasonNumber'))
75 episode
= video
.get('name')
76 episode_number
= int_or_none(video
.get('episodeNumber'))
77 release_year
= int_or_none(video
.get('releaseYear'))
79 if data
.get('authRequired'):
86 'description': description
,
88 'timestamp': timestamp
,
89 'age_limit': age_limit
,
92 'season_number': season_number
,
94 'episode_number': episode_number
,
95 'release_year': release_year
,
98 urlh
= self
._request
_webpage
(HEADRequest(release_url
), video_id
)
99 video_url
= compat_str(urlh
.geturl())
101 if UplynkPreplayIE
.suitable(video_url
):
103 '_type': 'url_transparent',
105 'ie_key': UplynkPreplayIE
.ie_key(),
108 m3u8_url
= self
._download
_json
(release_url
, video_id
)['playURL']
109 formats
= self
._extract
_m
3u8_formats
(
110 m3u8_url
, video_id
, 'mp4',
111 entry_protocol
='m3u8_native', m3u8_id
='hls')
112 self
._sort
_formats
(formats
)
113 info
['formats'] = formats