]>
Commit | Line | Data |
---|---|---|
9787c5f4 | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
e33a7253 | 4 | from .adobepass import AdobePassIE |
e37b54b1 RA |
5 | from ..utils import ( |
6 | smuggle_url, | |
7 | update_url_query, | |
8 | ) | |
9787c5f4 | 9 | |
10 | ||
e33a7253 | 11 | class FOXIE(AdobePassIE): |
9787c5f4 | 12 | _VALID_URL = r'https?://(?:www\.)?fox\.com/watch/(?P<id>[0-9]+)' |
13 | _TEST = { | |
14 | 'url': 'http://www.fox.com/watch/255180355939/7684182528', | |
5e3a6fec | 15 | 'md5': 'ebd296fcc41dd4b19f8115d8461a3165', |
9787c5f4 | 16 | 'info_dict': { |
17 | 'id': '255180355939', | |
18 | 'ext': 'mp4', | |
19 | 'title': 'Official Trailer: Gotham', | |
20 | 'description': 'Tracing the rise of the great DC Comics Super-Villains and vigilantes, Gotham reveals an entirely new chapter that has never been told.', | |
21 | 'duration': 129, | |
79ba9140 | 22 | 'timestamp': 1400020798, |
23 | 'upload_date': '20140513', | |
24 | 'uploader': 'NEWA-FNG-FOXCOM', | |
9787c5f4 | 25 | }, |
26 | 'add_ie': ['ThePlatform'], | |
9787c5f4 | 27 | } |
28 | ||
29 | def _real_extract(self, url): | |
30 | video_id = self._match_id(url) | |
31 | webpage = self._download_webpage(url, video_id) | |
32 | ||
e33a7253 RA |
33 | settings = self._parse_json(self._search_regex( |
34 | r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);', | |
35 | webpage, 'drupal settings'), video_id) | |
36 | fox_pdk_player = settings['fox_pdk_player'] | |
37 | release_url = fox_pdk_player['release_url'] | |
38 | query = { | |
39 | 'mbr': 'true', | |
40 | 'switch': 'http' | |
41 | } | |
42 | if fox_pdk_player.get('access') == 'locked': | |
43 | ap_p = settings['foxAdobePassProvider'] | |
44 | rating = ap_p.get('videoRating') | |
45 | if rating == 'n/a': | |
46 | rating = None | |
47 | resource = self._get_mvpd_resource('fbc-fox', None, ap_p['videoGUID'], rating) | |
48 | query['auth'] = self._extract_mvpd_auth(url, video_id, 'fbc-fox', resource) | |
9787c5f4 | 49 | |
7aa0ee32 | 50 | info = self._search_json_ld(webpage, video_id, fatal=False) |
51 | info.update({ | |
9787c5f4 | 52 | '_type': 'url_transparent', |
53 | 'ie_key': 'ThePlatform', | |
e33a7253 | 54 | 'url': smuggle_url(update_url_query(release_url, query), {'force_smil_url': True}), |
9787c5f4 | 55 | 'id': video_id, |
7aa0ee32 | 56 | }) |
57 | ||
58 | return info |