]>
Commit | Line | Data |
---|---|---|
a97bcd80 JMF |
1 | from __future__ import unicode_literals |
2 | ||
224db034 RA |
3 | from .theplatform import ThePlatformIE |
4 | from ..utils import ( | |
5 | update_url_query, | |
6 | smuggle_url, | |
7 | ) | |
a97bcd80 | 8 | |
a97bcd80 | 9 | |
224db034 RA |
10 | class SyfyIE(ThePlatformIE): |
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( | |
34 | r'jQuery\.extend\([^,]+,\s*({.+})\);', webpage, 'drupal settings'), | |
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': | |
43 | resource = '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>syfy</title><item><title><![CDATA[%s]]></title><guid>%s</guid><media:rating scheme="urn:v-chip">%s</media:rating></item></channel></rss>' % (title, video_id, syfy_mpx.get('mpxRating', 'TV-14')) | |
44 | query['auth'] = self._extract_mvpd_auth( | |
45 | url, video_id, 'syfy', resource) | |
46 | ||
47 | return { | |
48 | '_type': 'url_transparent', | |
49 | 'ie_key': 'ThePlatform', | |
50 | 'url': smuggle_url(update_url_query( | |
51 | self._proto_relative_url(syfy_mpx['releaseURL']), query), | |
52 | {'force_smil_url': True}), | |
53 | 'title': title, | |
54 | 'id': video_id, | |
55 | 'display_id': display_id, | |
56 | } |