diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-01-17 14:47:46 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-01-17 14:47:47 +0100 |
commit | 3ec05685f73187e974c0304936fb4f5e057dc2f9 (patch) | |
tree | 67c828740041fae49263e1673f3e92d0b8b91f90 /youtube_dl/extractor/common.py | |
parent | 877bfd69d13600fe28a75c3842dbdd933e4ecfd4 (diff) |
[extractor/common] Limit --write-pages filename to 200 chars
This avoids problems with very long URLs.
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r-- | youtube_dl/extractor/common.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index ce3d16903..692d828da 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -1,4 +1,5 @@ import base64 +import hashlib import json import os import re @@ -234,6 +235,9 @@ class InfoExtractor(object): url = url_or_request.get_full_url() except AttributeError: url = url_or_request + if len(url) > 200: + h = hashlib.md5(url).hexdigest() + url = url[:200 - len(h)] + h raw_filename = ('%s_%s.dump' % (video_id, url)) filename = sanitize_filename(raw_filename, restricted=True) self.to_screen(u'Saving request to ' + filename) |