[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / syfy.py
bloba32b50080f9bdb298b1259acb6be6d4205cc766a
1 from .adobepass import AdobePassIE
2 from ..utils import (
3 smuggle_url,
4 update_url_query,
8 class SyfyIE(AdobePassIE):
9 _WORKING = False
10 _VALID_URL = r'https?://(?:www\.)?syfy\.com/(?:[^/]+/)?videos/(?P<id>[^/?#]+)'
11 _TESTS = [{
12 'url': 'http://www.syfy.com/theinternetruinedmylife/videos/the-internet-ruined-my-life-season-1-trailer',
13 'info_dict': {
14 'id': '2968097',
15 'ext': 'mp4',
16 'title': 'The Internet Ruined My Life: Season 1 Trailer',
17 'description': 'One tweet, one post, one click, can destroy everything.',
18 'uploader': 'NBCU-MPAT',
19 'upload_date': '20170113',
20 'timestamp': 1484345640,
22 'params': {
23 # m3u8 download
24 'skip_download': True,
26 'add_ie': ['ThePlatform'],
27 'skip': 'Redirects to main page',
30 def _real_extract(self, url):
31 display_id = self._match_id(url)
32 webpage = self._download_webpage(url, display_id)
33 syfy_mpx = next(iter(self._parse_json(self._search_regex(
34 r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);', webpage, 'drupal settings'),
35 display_id)['syfy']['syfy_mpx'].values()))
36 video_id = syfy_mpx['mpxGUID']
37 title = syfy_mpx['episodeTitle']
38 query = {
39 'mbr': 'true',
40 'manifest': 'm3u',
42 if syfy_mpx.get('entitlement') == 'auth':
43 resource = self._get_mvpd_resource(
44 'syfy', title, video_id,
45 syfy_mpx.get('mpxRating', 'TV-14'))
46 query['auth'] = self._extract_mvpd_auth(
47 url, video_id, 'syfy', resource)
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,