From cebb2015d989ce74e867477fc455ee7427ae8b74 Mon Sep 17 00:00:00 2001 From: manonthemat Date: Fri, 2 Aug 2013 23:15:38 -0700 Subject: [PATCH] Fixed a bug. Videos with unicode characters in the title can now be downloaded. If the video name consists of only not-convertable unicode characters, the filename will be set to unnamed.ext --- src/you_get/common.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/you_get/common.py b/src/you_get/common.py index 4a17e05c..2aea9535 100644 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -124,7 +124,18 @@ def filenameable(text): ord('['): '(', ord(']'): ')', }) + # check for non-ascii characters in the videoname + text_asciiOnly = '' + for char in text: + if ord(char) < 128: + text_asciiOnly += char + # if the videoname has no ascii characters at all, set to 'unnamed' + if text_asciiOnly == '': + text = 'unnamed' + else: + text = text_asciiOnly return text + def unescape_html(html): from html import parser