From 944d65c762cc8426bb10093d11dbb94ea5dc21cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Sat, 25 Jan 2014 15:31:58 +0100 Subject: [PATCH] =?UTF-8?q?[extractor/common]=20Encode=20the=20url=20when?= =?UTF-8?q?=20calculating=20the=20md5=20with=20`=E2=80=94write-pages`=20op?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doesn’t cause any problem in python 2.*, but on python 3 the `md5` function only accepts bytes. --- youtube_dl/extractor/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ def _download_webpage_handle(self, url_or_request, video_id, note=None, errnote= 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)