]>
Commit | Line | Data |
---|---|---|
a97bcd80 JMF |
1 | from __future__ import unicode_literals |
2 | ||
818ac213 | 3 | from .adobepass import AdobePassIE |
224db034 RA |
4 | from ..utils import ( |
5 | update_url_query, | |
6 | smuggle_url, | |
7 | ) | |
a97bcd80 | 8 | |
a97bcd80 | 9 | |
818ac213 | 10 | class SyfyIE(AdobePassIE): |
92519402 | 11 | _VALID_URL = r'https?://(?:www\.)?syfy\.com/(?:[^/]+/)?videos/(?P<id>[^/?#]+)' |
22d99a80 | 12 | _TESTS = [{ |
224db034 | 13 | 'url': 'http://www.syfy.com/theinternetruinedmylife/videos/the-internet-ruined-my-life-season-1-trailer', |
a97bcd80 | 14 | 'info_dict': { |
224db034 RA |
15 | 'id': '2968097', |
16 | 'ext': 'mp4', | |
17 | 'title': 'The Internet Ruined My Life: Season 1 Trailer', | |
18 | 'description': 'One tweet, one post, one click, can destroy everything.', | |
19 | 'uploader': 'NBCU-MPAT', | |
20 | 'upload_date': '20170113', | |
21 | 'timestamp': 1484345640, | |
a97bcd80 | 22 | }, |
224db034 RA |
23 | 'params': { |
24 | # m3u8 download | |
25 | 'skip_download': True, | |
22d99a80 PH |
26 | }, |
27 | 'add_ie': ['ThePlatform'], | |
22d99a80 | 28 | }] |
a97bcd80 JMF |
29 | |
30 | def _real_extract(self, url): | |
224db034 RA |
31 | display_id = self._match_id(url) |
32 | webpage = self._download_webpage(url, display_id) | |
33 | syfy_mpx = list(self._parse_json(self._search_regex( | |
ccb6570e | 34 | r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);', webpage, 'drupal settings'), |
224db034 RA |
35 | display_id)['syfy']['syfy_mpx'].values())[0] |
36 | video_id = syfy_mpx['mpxGUID'] | |
37 | title = syfy_mpx['episodeTitle'] | |
38 | query = { | |
39 | 'mbr': 'true', | |
40 | 'manifest': 'm3u', | |
41 | } | |
42 | if syfy_mpx.get('entitlement') == 'auth': | |
1fd6e309 RA |
43 | resource = self._get_mvpd_resource( |
44 | 'syfy', title, video_id, | |
45 | syfy_mpx.get('mpxRating', 'TV-14')) | |
224db034 RA |
46 | query['auth'] = self._extract_mvpd_auth( |
47 | url, video_id, 'syfy', resource) | |
48 | ||
49 | return { | |
50 | '_type': 'url_transparent', | |
51 | 'ie_key': 'ThePlatform', | |
52 | 'url': smuggle_url(update_url_query( | |
53 | self._proto_relative_url(syfy_mpx['releaseURL']), query), | |
54 | {'force_smil_url': True}), | |
55 | 'title': title, | |
56 | 'id': video_id, | |
57 | 'display_id': display_id, | |
58 | } |