Przeglądaj źródła

Merge remote-tracking branch 'anisse/fix-content-encoding-charset'

Philipp Hagemeister 11 lat temu
rodzic
commit
aafddb2b0a
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      youtube_dl/extractor/common.py

+ 4 - 1
youtube_dl/extractor/common.py

@@ -251,7 +251,10 @@ class InfoExtractor(object):
             with open(filename, 'wb') as outf:
                 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
                 u'Websense' in content[:512]):