diff options
Diffstat (limited to 'youtube_dl/extractor/common.py')
| -rw-r--r-- | youtube_dl/extractor/common.py | 19 | 
1 files changed, 15 insertions, 4 deletions
| diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 10b0cbe69..11b31db88 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -242,10 +242,11 @@ class InfoExtractor(object):                  url = url_or_request.get_full_url()              except AttributeError:                  url = url_or_request -            if len(url) > 200: -                h = u'___' + hashlib.md5(url.encode('utf-8')).hexdigest() -                url = url[:200 - len(h)] + h -            raw_filename = ('%s_%s.dump' % (video_id, url)) +            basen = video_id + '_' + url +            if len(basen) > 240: +                h = u'___' + hashlib.md5(basen.encode('utf-8')).hexdigest() +                basen = basen[:240 - len(h)] + h +            raw_filename = basen + '.dump'              filename = sanitize_filename(raw_filename, restricted=True)              self.to_screen(u'Saving request to ' + filename)              with open(filename, 'wb') as outf: @@ -555,6 +556,16 @@ class InfoExtractor(object):              if self._downloader.params.get('prefer_insecure', False)              else 'https:') +    def _proto_relative_url(self, url, scheme=None): +        if url is None: +            return url +        if url.startswith('//'): +            if scheme is None: +                scheme = self.http_scheme() +            return scheme + url +        else: +            return url +  class SearchInfoExtractor(InfoExtractor):      """ | 
