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