mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-14 17:26:24 +00:00
[extractor/common] Limit --write-pages filename to 200 chars
This avoids problems with very long URLs.
This commit is contained in:
parent
877bfd69d1
commit
3ec05685f7
@ -1,4 +1,5 @@
|
|||||||
import base64
|
import base64
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -234,6 +235,9 @@ class InfoExtractor(object):
|
|||||||
url = url_or_request.get_full_url()
|
url = url_or_request.get_full_url()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
url = url_or_request
|
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))
|
raw_filename = ('%s_%s.dump' % (video_id, url))
|
||||||
filename = sanitize_filename(raw_filename, restricted=True)
|
filename = sanitize_filename(raw_filename, restricted=True)
|
||||||
self.to_screen(u'Saving request to ' + filename)
|
self.to_screen(u'Saving request to ' + filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user