[youtube] Use a static algorithm for the age gate videos' signatures (fixes #3270)
This commit is contained in:
parent
ee90ddab94
commit
1b262962c5
@ -865,6 +865,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
def _decrypt_signature(self, s, video_id, player_url, age_gate=False):
|
def _decrypt_signature(self, s, video_id, player_url, age_gate=False):
|
||||||
"""Turn the encrypted s field into a working signature"""
|
"""Turn the encrypted s field into a working signature"""
|
||||||
|
|
||||||
|
if age_gate:
|
||||||
|
return self._static_decrypt_age_gate_signature(s)
|
||||||
|
|
||||||
if player_url is None:
|
if player_url is None:
|
||||||
raise ExtractorError(u'Cannot decrypt signature without player_url')
|
raise ExtractorError(u'Cannot decrypt signature without player_url')
|
||||||
|
|
||||||
@ -886,6 +889,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
u'Automatic signature extraction failed: ' + tb, cause=e)
|
u'Automatic signature extraction failed: ' + tb, cause=e)
|
||||||
|
|
||||||
|
def _static_decrypt_age_gate_signature(self, s):
|
||||||
|
if len(s) == 86:
|
||||||
|
return s[2:63] + s[82] + s[64:82] + s[63]
|
||||||
|
else:
|
||||||
|
raise ExtractorError(u'Unable to decrypt signature, key length %d not supported; retrying might work' % (len(s)))
|
||||||
|
|
||||||
def _get_available_subtitles(self, video_id, webpage):
|
def _get_available_subtitles(self, video_id, webpage):
|
||||||
try:
|
try:
|
||||||
sub_list = self._download_webpage(
|
sub_list = self._download_webpage(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user