diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-04-03 06:07:35 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-04-03 06:09:38 +0200 |
commit | 2410c43d834c4a81c134d2efff269dd7ad66fbd6 (patch) | |
tree | a85639cd621f75231b5ccd3fe8ae2253d4bc7882 | |
parent | aea6e7fc3cc2500d7a2341e57b0983f7731a86cd (diff) |
Detect Websense censorship (Fixes #2670)
-rw-r--r-- | youtube_dl/extractor/common.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 78f238f84..fe09817f9 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -252,6 +252,17 @@ class InfoExtractor(object): outf.write(webpage_bytes) content = webpage_bytes.decode(encoding, '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() + blocked_iframe = self._html_search_regex( + r'<iframe src="([^"]+)"', content, + u'Websense information URL', default=None) + if blocked_iframe: + msg += u' Visit %s for more details' % blocked_iframe + raise ExtractorError(msg, expected=True) + return (content, urlh) def _download_webpage(self, url_or_request, video_id, note=None, errnote=None, fatal=True): |