projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
877bfd6
)
[extractor/common] Limit --write-pages filename to 200 chars
author
Philipp Hagemeister
<phihag@phihag.de>
Fri, 17 Jan 2014 13:47:46 +0000
(14:47 +0100)
committer
Philipp Hagemeister
<phihag@phihag.de>
Fri, 17 Jan 2014 13:47:47 +0000
(14:47 +0100)
This avoids problems with very long URLs.
youtube_dl/extractor/common.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/common.py
b/youtube_dl/extractor/common.py
index ce3d1690304c8a0b488c2f674c48bb4ef34c86b5..692d828da9ef9739e1b05908e6a9f39259b0940b 100644
(file)
--- 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)