1
0
Fork 0
mirror of https://codeberg.org/polarisfm/youtube-dl.git synced 2024-12-27 01:56:52 +00:00

[extractor/common] fallback on utf-8 when charset is not found

fixes #2721
This commit is contained in:
Anisse Astier 2014-04-07 23:09:53 +02:00
parent a5863bdf33
commit ec0fafbb19

View file

@ -251,7 +251,10 @@ class InfoExtractor(object):
with open(filename, 'wb') as outf: with open(filename, 'wb') as outf:
outf.write(webpage_bytes) outf.write(webpage_bytes)
try:
content = webpage_bytes.decode(encoding, 'replace') content = webpage_bytes.decode(encoding, 'replace')
except LookupError:
content = webpage_bytes.decode('utf-8', 'replace')
if (u'<title>Access to this site is blocked</title>' in content and if (u'<title>Access to this site is blocked</title>' in content and
u'Websense' in content[:512]): u'Websense' in content[:512]):