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
This commit is contained in:
manonthemat 2013-08-02 23:15:38 -07:00
parent a49f013d94
commit cebb2015d9

View File

@ -124,8 +124,19 @@ 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
html = parser.HTMLParser().unescape(html)