aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/bravotv.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-10-18 15:24:21 -0500
committerJesús <heckyel@hyperbola.info>2021-10-18 15:24:21 -0500
commit5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e (patch)
tree65209bc739db35e31f1c9b5b868eb5df4fe12ae3 /hypervideo_dl/extractor/bravotv.py
parent27fe903c511691c078942bef5ee9a05a43b15c8f (diff)
downloadhypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.tar.lz
hypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.tar.xz
hypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.zip
update from upstream
Diffstat (limited to 'hypervideo_dl/extractor/bravotv.py')
-rw-r--r--hypervideo_dl/extractor/bravotv.py38
1 files changed, 34 insertions, 4 deletions
diff --git a/hypervideo_dl/extractor/bravotv.py b/hypervideo_dl/extractor/bravotv.py
index bae2aed..139d51c 100644
--- a/hypervideo_dl/extractor/bravotv.py
+++ b/hypervideo_dl/extractor/bravotv.py
@@ -8,6 +8,9 @@ from ..utils import (
smuggle_url,
update_url_query,
int_or_none,
+ float_or_none,
+ try_get,
+ dict_get,
)
@@ -24,6 +27,11 @@ class BravoTVIE(AdobePassIE):
'uploader': 'NBCU-BRAV',
'upload_date': '20190314',
'timestamp': 1552591860,
+ 'season_number': 16,
+ 'episode_number': 15,
+ 'series': 'Top Chef',
+ 'episode': 'The Top Chef Season 16 Winner Is...',
+ 'duration': 190.0,
}
}, {
'url': 'http://www.bravotv.com/below-deck/season-3/ep-14-reunion-part-1',
@@ -34,7 +42,7 @@ class BravoTVIE(AdobePassIE):
}]
def _real_extract(self, url):
- site, display_id = re.match(self._VALID_URL, url).groups()
+ site, display_id = self._match_valid_url(url).groups()
webpage = self._download_webpage(url, display_id)
settings = self._parse_json(self._search_regex(
r'<script[^>]+data-drupal-selector="drupal-settings-json"[^>]*>({.+?})</script>', webpage, 'drupal settings'),
@@ -79,12 +87,34 @@ class BravoTVIE(AdobePassIE):
'episode_number': int_or_none(metadata.get('episode_num')),
})
query['switch'] = 'progressive'
+
+ tp_url = 'http://link.theplatform.com/s/%s/%s' % (account_pid, tp_path)
+
+ tp_metadata = self._download_json(
+ update_url_query(tp_url, {'format': 'preview'}),
+ display_id, fatal=False)
+ if tp_metadata:
+ info.update({
+ 'title': tp_metadata.get('title'),
+ 'description': tp_metadata.get('description'),
+ 'duration': float_or_none(tp_metadata.get('duration'), 1000),
+ 'season_number': int_or_none(
+ dict_get(tp_metadata, ('pl1$seasonNumber', 'nbcu$seasonNumber'))),
+ 'episode_number': int_or_none(
+ dict_get(tp_metadata, ('pl1$episodeNumber', 'nbcu$episodeNumber'))),
+ # For some reason the series is sometimes wrapped into a single element array.
+ 'series': try_get(
+ dict_get(tp_metadata, ('pl1$show', 'nbcu$show')),
+ lambda x: x[0] if isinstance(x, list) else x,
+ expected_type=str),
+ 'episode': dict_get(
+ tp_metadata, ('pl1$episodeName', 'nbcu$episodeName', 'title')),
+ })
+
info.update({
'_type': 'url_transparent',
'id': release_pid,
- 'url': smuggle_url(update_url_query(
- 'http://link.theplatform.com/s/%s/%s' % (account_pid, tp_path),
- query), {'force_smil_url': True}),
+ 'url': smuggle_url(update_url_query(tp_url, query), {'force_smil_url': True}),
'ie_key': 'ThePlatform',
})
return info