]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/bravotv.py
3 from .adobepass
import AdobePassIE
14 class BravoTVIE(AdobePassIE
):
15 _VALID_URL
= r
'https?://(?:www\.)?(?P<req_id>bravotv|oxygen)\.com/(?:[^/]+/)+(?P<id>[^/?#]+)'
17 'url': 'https://www.bravotv.com/top-chef/season-16/episode-15/videos/the-top-chef-season-16-winner-is',
18 'md5': 'e34684cfea2a96cd2ee1ef3a60909de9',
22 'title': 'The Top Chef Season 16 Winner Is...',
23 'description': 'Find out who takes the title of Top Chef!',
24 'uploader': 'NBCU-BRAV',
25 'upload_date': '20190314',
26 'timestamp': 1552591860,
30 'episode': 'The Top Chef Season 16 Winner Is...',
34 'url': 'http://www.bravotv.com/below-deck/season-3/ep-14-reunion-part-1',
35 'only_matching': True,
37 'url': 'https://www.oxygen.com/in-ice-cold-blood/season-2/episode-16/videos/handling-the-horwitz-house-after-the-murder-season-2',
38 'only_matching': True,
41 def _real_extract(self
, url
):
42 site
, display_id
= self
._match
_valid
_url
(url
).groups()
43 webpage
= self
._download
_webpage
(url
, display_id
)
44 settings
= self
._parse
_json
(self
._search
_regex
(
45 r
'<script[^>]+data-drupal-selector="drupal-settings-json"[^>]*>({.+?})</script>', webpage
, 'drupal settings'),
51 account_pid
, release_pid
= [None] * 2
52 tve
= settings
.get('ls_tve')
54 query
['manifest'] = 'm3u'
55 mobj
= re
.search(r
'<[^>]+id="pdk-player"[^>]+data-url=["\']?
(?
:https?
:)?
//player\
.theplatform\
.com
/p
/([^
/]+)/(?
:[^
/]+/)*select
/([^?
#&"\']+)', webpage)
57 account_pid
, tp_path
= mobj
.groups()
58 release_pid
= tp_path
.strip('/').split('/')[-1]
60 account_pid
= 'HNK2IC'
61 tp_path
= release_pid
= tve
['release_pid']
62 if tve
.get('entitlement') == 'auth':
63 adobe_pass
= settings
.get('tve_adobe_auth', {})
66 resource
= self
._get
_mvpd
_resource
(
67 adobe_pass
.get('adobePassResourceId') or site
,
68 tve
['title'], release_pid
, tve
.get('rating'))
69 query
['auth'] = self
._extract
_mvpd
_auth
(
71 adobe_pass
.get('adobePassRequestorId') or site
, resource
)
73 shared_playlist
= settings
['ls_playlist']
74 account_pid
= shared_playlist
['account_pid']
75 metadata
= shared_playlist
['video_metadata'][shared_playlist
['default_clip']]
76 tp_path
= release_pid
= metadata
.get('release_pid')
78 release_pid
= metadata
['guid']
79 tp_path
= 'media/guid/2140479951/' + release_pid
81 'title': metadata
['title'],
82 'description': metadata
.get('description'),
83 'season_number': int_or_none(metadata
.get('season_num')),
84 'episode_number': int_or_none(metadata
.get('episode_num')),
86 query
['switch'] = 'progressive'
88 tp_url
= 'http://link.theplatform.com/s/%s/%s' % (account_pid
, tp_path
)
90 tp_metadata
= self
._download
_json
(
91 update_url_query(tp_url
, {'format': 'preview'}
),
92 display_id
, fatal
=False)
95 'title': tp_metadata
.get('title'),
96 'description': tp_metadata
.get('description'),
97 'duration': float_or_none(tp_metadata
.get('duration'), 1000),
98 'season_number': int_or_none(
99 dict_get(tp_metadata
, ('pl1$seasonNumber', 'nbcu$seasonNumber'))),
100 'episode_number': int_or_none(
101 dict_get(tp_metadata
, ('pl1$episodeNumber', 'nbcu$episodeNumber'))),
102 # For some reason the series is sometimes wrapped into a single element array.
104 dict_get(tp_metadata
, ('pl1$show', 'nbcu$show')),
105 lambda x
: x
[0] if isinstance(x
, list) else x
,
108 tp_metadata
, ('pl1$episodeName', 'nbcu$episodeName', 'title')),
112 '_type': 'url_transparent',
114 'url': smuggle_url(update_url_query(tp_url
, query
), {'force_smil_url': True}
),
115 'ie_key': 'ThePlatform',