aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2018-05-13 11:30:21 +0100
committerRemita Amine <remitamine@gmail.com>2018-05-13 11:31:41 +0100
commit90b633f86b000f8b6a58ce99d9bbbe0fff6d4f62 (patch)
treeef864cb75ab65ded8e8843451583d06fc167a8c6
parent07acdc5afcff3b47b26b26355a75704e3cda670f (diff)
[nbc] improve info extraction(fixes #16440)
-rw-r--r--youtube_dl/extractor/nbc.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/youtube_dl/extractor/nbc.py b/youtube_dl/extractor/nbc.py
index 9dc8f9ebc..1b1722cfa 100644
--- a/youtube_dl/extractor/nbc.py
+++ b/youtube_dl/extractor/nbc.py
@@ -9,6 +9,7 @@ from .adobepass import AdobePassIE
from ..utils import (
find_xpath_attr,
smuggle_url,
+ try_get,
unescapeHTML,
update_url_query,
int_or_none,
@@ -78,10 +79,14 @@ class NBCIE(AdobePassIE):
def _real_extract(self, url):
permalink, video_id = re.match(self._VALID_URL, url).groups()
permalink = 'http' + permalink
- video_data = self._download_json(
+ response = self._download_json(
'https://api.nbc.com/v3/videos', video_id, query={
'filter[permalink]': permalink,
- })['data'][0]['attributes']
+ 'fields[videos]': 'description,entitlement,episodeNumber,guid,keywords,seasonNumber,title,vChipRating',
+ 'fields[shows]': 'shortTitle',
+ 'include': 'show.shortTitle',
+ })
+ video_data = response['data'][0]['attributes']
query = {
'mbr': 'true',
'manifest': 'm3u',
@@ -103,10 +108,11 @@ class NBCIE(AdobePassIE):
'title': title,
'url': theplatform_url,
'description': video_data.get('description'),
- 'keywords': video_data.get('keywords'),
+ 'tags': video_data.get('keywords'),
'season_number': int_or_none(video_data.get('seasonNumber')),
'episode_number': int_or_none(video_data.get('episodeNumber')),
- 'series': video_data.get('showName'),
+ 'episode': title,
+ 'series': try_get(response, lambda x: x['included'][0]['attributes']['shortTitle']),
'ie_key': 'ThePlatform',
}