]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/syfy.py
[extractor/youtube] Fix `uploader_id` extraction
[yt-dlp.git] / yt_dlp / extractor / syfy.py
1 from .adobepass import AdobePassIE
2 from ..utils import (
3 update_url_query,
4 smuggle_url,
5 )
6
7
8 class SyfyIE(AdobePassIE):
9 _VALID_URL = r'https?://(?:www\.)?syfy\.com/(?:[^/]+/)?videos/(?P<id>[^/?#]+)'
10 _TESTS = [{
11 'url': 'http://www.syfy.com/theinternetruinedmylife/videos/the-internet-ruined-my-life-season-1-trailer',
12 'info_dict': {
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,
20 },
21 'params': {
22 # m3u8 download
23 'skip_download': True,
24 },
25 'add_ie': ['ThePlatform'],
26 }]
27
28 def _real_extract(self, url):
29 display_id = self._match_id(url)
30 webpage = self._download_webpage(url, display_id)
31 syfy_mpx = list(self._parse_json(self._search_regex(
32 r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);', webpage, 'drupal settings'),
33 display_id)['syfy']['syfy_mpx'].values())[0]
34 video_id = syfy_mpx['mpxGUID']
35 title = syfy_mpx['episodeTitle']
36 query = {
37 'mbr': 'true',
38 'manifest': 'm3u',
39 }
40 if syfy_mpx.get('entitlement') == 'auth':
41 resource = self._get_mvpd_resource(
42 'syfy', title, video_id,
43 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 }