1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-24 09:52:58 +08:00

improve generic and encrypted signature error messages

This commit is contained in:
Filippo Valsorda 2013-06-25 16:43:29 +02:00
parent f7ab6cbe16
commit 98bcd2834a
3 changed files with 6 additions and 5 deletions

View File

@ -211,7 +211,7 @@ class InfoExtractor(object):
raise ExtractorError(u'Unable to extract %s' % _name) raise ExtractorError(u'Unable to extract %s' % _name)
else: else:
self._downloader.report_warning(u'unable to extract %s; ' self._downloader.report_warning(u'unable to extract %s; '
u'please report this issue on GitHub.' % _name) u'please report this issue on http://yt-dl.org/bug' % _name)
return None return None
def _html_search_regex(self, pattern, string, name, default=None, fatal=True, flags=0): def _html_search_regex(self, pattern, string, name, default=None, fatal=True, flags=0):

View File

@ -129,12 +129,13 @@ class YoutubeIE(InfoExtractor):
"""Indicate the download will use the RTMP protocol.""" """Indicate the download will use the RTMP protocol."""
self.to_screen(u'RTMP download detected') self.to_screen(u'RTMP download detected')
@staticmethod def _decrypt_signature(self, s):
def _decrypt_signature(s):
"""Decrypt the key the two subkeys must have a length of 43""" """Decrypt the key the two subkeys must have a length of 43"""
(a,b) = s.split('.') (a,b) = s.split('.')
if len(a) != 43 or len(b) != 43: if len(a) != 43 or len(b) != 43:
raise ExtractorError(u'Unable to decrypt signature, subkeys lengths not valid') raise ExtractorError(u'Unable to decrypt signature, subkeys lengths %d.%d not supported; retrying might work' % (len(a), len(b)))
if self._downloader.params.get('verbose'):
self.to_screen('encrypted signature length %d.%d' % (len(a), len(b)))
b = ''.join([b[:8],a[0],b[9:18],b[-4],b[19:39], b[18]])[0:40] b = ''.join([b[:8],a[0],b[9:18],b[-4],b[19:39], b[18]])[0:40]
a = a[-40:] a = a[-40:]
s_dec = '.'.join((a,b))[::-1] s_dec = '.'.join((a,b))[::-1]

View File

@ -474,7 +474,7 @@ class ExtractorError(Exception):
""" tb, if given, is the original traceback (so that it can be printed out). """ """ tb, if given, is the original traceback (so that it can be printed out). """
if not sys.exc_info()[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError): if not sys.exc_info()[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError):
msg = msg + u'; please report this issue on GitHub.' msg = msg + u'; please report this issue on http://yt-dl.org/bug'
super(ExtractorError, self).__init__(msg) super(ExtractorError, self).__init__(msg)
self.traceback = tb self.traceback = tb