7
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-30 08:36:22 +00:00

[youtube] Fix extraction (closes , closes , closes , closes , closes , closes , closes , closes , closes , closes , closes )

This commit is contained in:
Sergey M․ 2019-04-24 09:58:00 +07:00
parent 50d660479d
commit 56667d622c
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -1652,7 +1652,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
view_count = extract_view_count(get_video_info) view_count = extract_view_count(get_video_info)
if not video_info: if not video_info:
video_info = get_video_info video_info = get_video_info
if 'token' in get_video_info: get_token = get_video_info.get('token') or get_video_info.get('account_playback_token')
if get_token:
# Different get_video_info requests may report different results, e.g. # Different get_video_info requests may report different results, e.g.
# some may report video unavailability, but some may serve it without # some may report video unavailability, but some may serve it without
# any complaint (see https://github.com/ytdl-org/youtube-dl/issues/7362, # any complaint (see https://github.com/ytdl-org/youtube-dl/issues/7362,
@ -1662,7 +1663,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
# due to YouTube measures against IP ranges of hosting providers. # due to YouTube measures against IP ranges of hosting providers.
# Working around by preferring the first succeeded video_info containing # Working around by preferring the first succeeded video_info containing
# the token if no such video_info yet was found. # the token if no such video_info yet was found.
if 'token' not in video_info: token = video_info.get('token') or video_info.get('account_playback_token')
if not token:
video_info = get_video_info video_info = get_video_info
break break
@ -1678,7 +1680,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
raise ExtractorError( raise ExtractorError(
'YouTube said: %s' % unavailable_message, expected=True, video_id=video_id) 'YouTube said: %s' % unavailable_message, expected=True, video_id=video_id)
if 'token' not in video_info: token = video_info.get('token') or video_info.get('account_playback_token')
if not token:
if 'reason' in video_info: if 'reason' in video_info:
if 'The uploader has not made this video available in your country.' in video_info['reason']: if 'The uploader has not made this video available in your country.' in video_info['reason']:
regions_allowed = self._html_search_meta( regions_allowed = self._html_search_meta(