1 from __future__ import unicode_literals
3 from .theplatform import ThePlatformIE
10 class SyfyIE(ThePlatformIE):
11 _VALID_URL = r'https?://www\.syfy\.com/(?:[^/]+/)?videos/(?P<id>[^/?#]+)'
13 'url': 'http://www.syfy.com/theinternetruinedmylife/videos/the-internet-ruined-my-life-season-1-trailer',
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,
25 'skip_download': True,
27 'add_ie': ['ThePlatform'],
30 def _real_extract(self, url):
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']
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)
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}),
55 'display_id': display_id,