summary refs log tree commit diff
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-01-25 15:31:58 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-01-25 15:32:56 +0100
commit944d65c762cc8426bb10093d11dbb94ea5dc21cb (patch)
tree69cc95df52fd79980fbc194e86c9efc22dec819a
parentf945612bd03642fa01ea7220ebe3e8eae99a9052 (diff)
downloadyoutube-dl-944d65c762cc8426bb10093d11dbb94ea5dc21cb.tar.gz
youtube-dl-944d65c762cc8426bb10093d11dbb94ea5dc21cb.tar.xz
youtube-dl-944d65c762cc8426bb10093d11dbb94ea5dc21cb.zip
[extractor/common] Encode the url when calculating the md5 with `—write-pages` option
This doesn’t cause any problem in python 2.*, but on python 3 the `md5` function only accepts bytes.
-rw-r--r--youtube_dl/extractor/common.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index aa48bd4e6..3cf742a3b 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -240,7 +240,7 @@ class InfoExtractor(object):
             except AttributeError:
                 url = url_or_request
             if len(url) > 200:
-                h = u'___' + hashlib.md5(url).hexdigest()
+                h = u'___' + hashlib.md5(url.encode('utf-8')).hexdigest()
                 url = url[:200 - len(h)] + h
             raw_filename = ('%s_%s.dump' % (video_id, url))
             filename = sanitize_filename(raw_filename, restricted=True)