2 from __future__ import unicode_literals
4 from .adobepass import AdobePassIE
14 class FOXIE(AdobePassIE):
15 _VALID_URL = r'https?://(?:www\.)?fox\.com/watch/(?P<id>[\da-fA-F]+)'
18 'url': 'https://www.fox.com/watch/4b765a60490325103ea69888fb2bd4e8/',
19 'md5': 'ebd296fcc41dd4b19f8115d8461a3165',
21 'id': '4b765a60490325103ea69888fb2bd4e8',
23 'title': 'Aftermath: Bruce Wayne Develops Into The Dark Knight',
24 'description': 'md5:549cd9c70d413adb32ce2a779b53b486',
26 'timestamp': 1504291893,
27 'upload_date': '20170901',
32 'skip_download': True,
35 # episode, geo-restricted
36 'url': 'https://www.fox.com/watch/087036ca7f33c8eb79b08152b4dd75c1/',
37 'only_matching': True,
39 # episode, geo-restricted, tv provided required
40 'url': 'https://www.fox.com/watch/30056b295fb57f7452aeeb4920bc3024/',
41 'only_matching': True,
44 def _real_extract(self, url):
45 video_id = self._match_id(url)
47 video = self._download_json(
48 'https://api.fox.com/fbc-content/v1_4/video/%s' % video_id,
50 'apikey': 'abdcbed02c124d393b39e818a4312055',
51 'Content-Type': 'application/json',
57 m3u8_url = self._download_json(
58 video['videoRelease']['url'], video_id)['playURL']
60 formats = self._extract_m3u8_formats(
61 m3u8_url, video_id, 'mp4',
62 entry_protocol='m3u8_native', m3u8_id='hls')
63 self._sort_formats(formats)
65 description = video.get('description')
66 duration = int_or_none(video.get('durationInSeconds')) or int_or_none(
67 video.get('duration')) or parse_duration(video.get('duration'))
68 timestamp = unified_timestamp(video.get('datePublished'))
69 age_limit = parse_age_limit(video.get('contentRating'))
72 video, lambda x: x['trackingData']['properties'], dict) or {}
74 creator = data.get('brand') or data.get('network') or video.get('network')
76 series = video.get('seriesName') or data.get(
77 'seriesName') or data.get('show')
78 season_number = int_or_none(video.get('seasonNumber'))
79 episode = video.get('name')
80 episode_number = int_or_none(video.get('episodeNumber'))
81 release_year = int_or_none(video.get('releaseYear'))
83 if data.get('authRequired'):
90 'description': description,
92 'timestamp': timestamp,
93 'age_limit': age_limit,
96 'season_number': season_number,
98 'episode_number': episode_number,
99 'release_year': release_year,