mirror of
https://github.com/l1ving/youtube-dl
synced 2024-12-31 01:27:53 +08:00
parent
1e179c7528
commit
cf01013161
@ -347,7 +347,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
self.to_screen(u'RTMP download detected')
|
self.to_screen(u'RTMP download detected')
|
||||||
|
|
||||||
def _extract_signature_function(self, video_id, player_url, slen):
|
def _extract_signature_function(self, video_id, player_url, slen):
|
||||||
id_m = re.match(r'.*-(?P<id>[a-zA-Z0-9_-]+)\.(?P<ext>[a-z]+)$',
|
id_m = re.match(
|
||||||
|
r'.*-(?P<id>[a-zA-Z0-9_-]+)(?:/watch_as3)?\.(?P<ext>[a-z]+)$',
|
||||||
player_url)
|
player_url)
|
||||||
player_type = id_m.group('ext')
|
player_type = id_m.group('ext')
|
||||||
player_id = id_m.group('id')
|
player_id = id_m.group('id')
|
||||||
@ -1220,11 +1221,24 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
url += '&signature=' + url_data['sig'][0]
|
url += '&signature=' + url_data['sig'][0]
|
||||||
elif 's' in url_data:
|
elif 's' in url_data:
|
||||||
encrypted_sig = url_data['s'][0]
|
encrypted_sig = url_data['s'][0]
|
||||||
|
|
||||||
|
if not age_gate:
|
||||||
|
jsplayer_url_json = self._search_regex(
|
||||||
|
r'"assets":.+?"js":\s*("[^"]+")',
|
||||||
|
video_webpage, u'JS player URL')
|
||||||
|
player_url = json.loads(jsplayer_url_json)
|
||||||
|
if player_url is None:
|
||||||
|
player_url_json = self._search_regex(
|
||||||
|
r'ytplayer\.config.*?"url"\s*:\s*("[^"]+")',
|
||||||
|
video_webpage, u'age gate player URL')
|
||||||
|
player_url = json.loads(player_url_json)
|
||||||
|
|
||||||
if self._downloader.params.get('verbose'):
|
if self._downloader.params.get('verbose'):
|
||||||
if age_gate:
|
|
||||||
if player_url is None:
|
if player_url is None:
|
||||||
player_version = 'unknown'
|
player_version = 'unknown'
|
||||||
|
player_desc = 'unknown'
|
||||||
else:
|
else:
|
||||||
|
if player_url.endswith('swf'):
|
||||||
player_version = self._search_regex(
|
player_version = self._search_regex(
|
||||||
r'-(.+)\.swf$', player_url,
|
r'-(.+)\.swf$', player_url,
|
||||||
u'flash player', fatal=False)
|
u'flash player', fatal=False)
|
||||||
@ -1239,12 +1253,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
self.to_screen(u'encrypted signature length %d (%s), itag %s, %s' %
|
self.to_screen(u'encrypted signature length %d (%s), itag %s, %s' %
|
||||||
(len(encrypted_sig), parts_sizes, url_data['itag'][0], player_desc))
|
(len(encrypted_sig), parts_sizes, url_data['itag'][0], player_desc))
|
||||||
|
|
||||||
if not age_gate:
|
|
||||||
jsplayer_url_json = self._search_regex(
|
|
||||||
r'"assets":.+?"js":\s*("[^"]+")',
|
|
||||||
video_webpage, u'JS player URL')
|
|
||||||
player_url = json.loads(jsplayer_url_json)
|
|
||||||
|
|
||||||
signature = self._decrypt_signature(
|
signature = self._decrypt_signature(
|
||||||
encrypted_sig, video_id, player_url, age_gate)
|
encrypted_sig, video_id, player_url, age_gate)
|
||||||
url += '&signature=' + signature
|
url += '&signature=' + signature
|
||||||
|
Loading…
Reference in New Issue
Block a user