Merge remote-tracking branch 'upstream/master' into myversion
This commit is contained in:
commit
0954eec9c8
@ -9,6 +9,7 @@ from .adobepass import AdobePassIE
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
|
try_get,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
@ -78,10 +79,14 @@ class NBCIE(AdobePassIE):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
permalink, video_id = re.match(self._VALID_URL, url).groups()
|
permalink, video_id = re.match(self._VALID_URL, url).groups()
|
||||||
permalink = 'http' + permalink
|
permalink = 'http' + permalink
|
||||||
video_data = self._download_json(
|
response = self._download_json(
|
||||||
'https://api.nbc.com/v3/videos', video_id, query={
|
'https://api.nbc.com/v3/videos', video_id, query={
|
||||||
'filter[permalink]': permalink,
|
'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 = {
|
query = {
|
||||||
'mbr': 'true',
|
'mbr': 'true',
|
||||||
'manifest': 'm3u',
|
'manifest': 'm3u',
|
||||||
@ -103,10 +108,11 @@ class NBCIE(AdobePassIE):
|
|||||||
'title': title,
|
'title': title,
|
||||||
'url': theplatform_url,
|
'url': theplatform_url,
|
||||||
'description': video_data.get('description'),
|
'description': video_data.get('description'),
|
||||||
'keywords': video_data.get('keywords'),
|
'tags': video_data.get('keywords'),
|
||||||
'season_number': int_or_none(video_data.get('seasonNumber')),
|
'season_number': int_or_none(video_data.get('seasonNumber')),
|
||||||
'episode_number': int_or_none(video_data.get('episodeNumber')),
|
'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',
|
'ie_key': 'ThePlatform',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1537,7 +1537,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
ytplayer_config = self._get_ytplayer_config(video_id, video_webpage)
|
ytplayer_config = self._get_ytplayer_config(video_id, video_webpage)
|
||||||
if ytplayer_config:
|
if ytplayer_config:
|
||||||
args = ytplayer_config['args']
|
args = ytplayer_config['args']
|
||||||
if args.get('url_encoded_fmt_stream_map'):
|
if args.get('url_encoded_fmt_stream_map') or args.get('hlsvp'):
|
||||||
# Convert to the same format returned by compat_parse_qs
|
# Convert to the same format returned by compat_parse_qs
|
||||||
video_info = dict((k, [v]) for k, v in args.items())
|
video_info = dict((k, [v]) for k, v in args.items())
|
||||||
add_dash_mpd(video_info)
|
add_dash_mpd(video_info)
|
||||||
@ -1697,9 +1697,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
self.report_information_extraction(video_id)
|
self.report_information_extraction(video_id)
|
||||||
|
|
||||||
# uploader
|
# uploader
|
||||||
if 'author' not in video_info:
|
video_uploader = try_get(video_info, lambda x: x['author'][0], compat_str)
|
||||||
raise ExtractorError('Unable to extract uploader name')
|
if video_uploader:
|
||||||
video_uploader = compat_urllib_parse_unquote_plus(video_info['author'][0])
|
video_uploader = compat_urllib_parse_unquote_plus(video_uploader)
|
||||||
|
else:
|
||||||
|
self._downloader.report_warning('unable to extract uploader name')
|
||||||
|
|
||||||
# uploader_id
|
# uploader_id
|
||||||
video_uploader_id = None
|
video_uploader_id = None
|
||||||
@ -1813,6 +1815,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
|
|
||||||
chapters = self._extract_chapters(description_original, video_duration)
|
chapters = self._extract_chapters(description_original, video_duration)
|
||||||
|
|
||||||
|
def _extract_filesize(media_url):
|
||||||
|
return int_or_none(self._search_regex(
|
||||||
|
r'\bclen[=/](\d+)', media_url, 'filesize', default=None))
|
||||||
|
|
||||||
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
|
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
|
||||||
self.report_rtmp_download()
|
self.report_rtmp_download()
|
||||||
formats = [{
|
formats = [{
|
||||||
@ -1917,8 +1923,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
mobj = re.search(r'^(?P<width>\d+)[xX](?P<height>\d+)$', url_data.get('size', [''])[0])
|
mobj = re.search(r'^(?P<width>\d+)[xX](?P<height>\d+)$', url_data.get('size', [''])[0])
|
||||||
width, height = (int(mobj.group('width')), int(mobj.group('height'))) if mobj else (None, None)
|
width, height = (int(mobj.group('width')), int(mobj.group('height'))) if mobj else (None, None)
|
||||||
|
|
||||||
|
filesize = int_or_none(url_data.get(
|
||||||
|
'clen', [None])[0]) or _extract_filesize(url)
|
||||||
|
|
||||||
more_fields = {
|
more_fields = {
|
||||||
'filesize': int_or_none(url_data.get('clen', [None])[0]),
|
'filesize': filesize,
|
||||||
'tbr': float_or_none(url_data.get('bitrate', [None])[0], 1000),
|
'tbr': float_or_none(url_data.get('bitrate', [None])[0], 1000),
|
||||||
'width': width,
|
'width': width,
|
||||||
'height': height,
|
'height': height,
|
||||||
@ -1969,9 +1978,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = 'True'
|
a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = 'True'
|
||||||
formats.append(a_format)
|
formats.append(a_format)
|
||||||
else:
|
else:
|
||||||
unavailable_message = extract_unavailable_message()
|
error_message = clean_html(video_info.get('reason', [None])[0])
|
||||||
if unavailable_message:
|
if not error_message:
|
||||||
raise ExtractorError(unavailable_message, expected=True)
|
error_message = extract_unavailable_message()
|
||||||
|
if error_message:
|
||||||
|
raise ExtractorError(error_message, expected=True)
|
||||||
raise ExtractorError('no conn, hlsvp or url_encoded_fmt_stream_map information found in video info')
|
raise ExtractorError('no conn, hlsvp or url_encoded_fmt_stream_map information found in video info')
|
||||||
|
|
||||||
# Look for the DASH manifest
|
# Look for the DASH manifest
|
||||||
@ -1990,6 +2001,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
for df in self._extract_mpd_formats(
|
for df in self._extract_mpd_formats(
|
||||||
mpd_url, video_id, fatal=dash_mpd_fatal,
|
mpd_url, video_id, fatal=dash_mpd_fatal,
|
||||||
formats_dict=self._formats):
|
formats_dict=self._formats):
|
||||||
|
if not df.get('filesize'):
|
||||||
|
df['filesize'] = _extract_filesize(df['url'])
|
||||||
# Do not overwrite DASH format found in some previous DASH manifest
|
# Do not overwrite DASH format found in some previous DASH manifest
|
||||||
if df['format_id'] not in dash_formats:
|
if df['format_id'] not in dash_formats:
|
||||||
dash_formats[df['format_id']] = df
|
dash_formats[df['format_id']] = df
|
||||||
|
@ -232,7 +232,7 @@ def parseOpts(overrideArguments=None):
|
|||||||
'--geo-verification-proxy',
|
'--geo-verification-proxy',
|
||||||
dest='geo_verification_proxy', default=None, metavar='URL',
|
dest='geo_verification_proxy', default=None, metavar='URL',
|
||||||
help='Use this proxy to verify the IP address for some geo-restricted sites. '
|
help='Use this proxy to verify the IP address for some geo-restricted sites. '
|
||||||
'The default proxy specified by --proxy (or none, if the options is not present) is used for the actual downloading.')
|
'The default proxy specified by --proxy (or none, if the option is not present) is used for the actual downloading.')
|
||||||
geo.add_option(
|
geo.add_option(
|
||||||
'--cn-verification-proxy',
|
'--cn-verification-proxy',
|
||||||
dest='cn_verification_proxy', default=None, metavar='URL',
|
dest='cn_verification_proxy', default=None, metavar='URL',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user