From 1b262962c596fcf83644b9308d1c36bec833a207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Wed, 16 Jul 2014 12:37:41 +0200 Subject: [PATCH] [youtube] Use a static algorithm for the age gate videos' signatures (fixes #3270) --- youtube_dl/extractor/youtube.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 6123e1256..e45652a9b 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -865,6 +865,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor): def _decrypt_signature(self, s, video_id, player_url, age_gate=False): """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: raise ExtractorError(u'Cannot decrypt signature without player_url') @@ -886,6 +889,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor): raise ExtractorError( 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): try: sub_list = self._download_webpage(