[cnet] Correct JSON capturing
[youtube-dl] / youtube_dl / extractor / common.py
index fe09817f9ea0df22920503a61b9a984a5c94c1be..9653d44eb33db4efb74e97529cdd2aaea0dc1c03 100644 (file)
@@ -251,11 +251,14 @@ 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]):
-            msg = u'Access to URL %s has been blocked by Websense filtering software in your network.' % urlh.geturl()
+            msg = u'Access to this webpage has been blocked by Websense filtering software in your network.'
             blocked_iframe = self._html_search_regex(
                 r'<iframe src="([^"]+)"', content,
                 u'Websense information URL', default=None)