Browse Source

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

fixes #2721
totalwebcasting
Anisse Astier 11 years ago
parent
commit
ec0fafbb19
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      youtube_dl/extractor/common.py

+ 4
- 1
youtube_dl/extractor/common.py 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)
content = webpage_bytes.decode(encoding, 'replace')
try:
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]):


Loading…
Cancel
Save