mirror of
https://github.com/soimort/you-get.git
synced 2025-03-13 03:17:44 +03:00
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:
parent
a49f013d94
commit
cebb2015d9
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user