From 2410c43d834c4a81c134d2efff269dd7ad66fbd6 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Thu, 3 Apr 2014 06:07:35 +0200 Subject: [PATCH] Detect Websense censorship (Fixes #2670) --- youtube_dl/extractor/common.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 @@ def _download_webpage_handle(self, url_or_request, video_id, note=None, errnote= outf.write(webpage_bytes) content = webpage_bytes.decode(encoding, 'replace') + + if (u'Access to this site is blocked' 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'