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