ytdl-org/youtube-dl · error · ExtractorError

Access to this webpage has been blocked by Websense filterin

Error message

Access to this webpage has been blocked by Websense filtering software in your network. Visit %s for more details

What it means

Raised by the internal __check_blocked heuristic that runs on every downloaded webpage: if the first 512 bytes contain the '<title>Access to this site is blocked</title>' marker together with 'Websense', the response came from Websense corporate filtering, not the target site. youtube-dl surfaces this as an expected error, appending the vendor's information iframe URL when present.

Source

Thrown at youtube_dl/extractor/common.py:749

                encoding = m.group(1).decode('ascii')
            elif webpage_bytes.startswith(b'\xff\xfe'):
                encoding = 'utf-16'
            else:
                encoding = 'utf-8'

        return encoding

    def __check_blocked(self, content):
        first_block = content[:512]
        if ('<title>Access to this site is blocked</title>' in content
                and 'Websense' in first_block):
            msg = 'Access to this webpage has been blocked by Websense filtering software in your network.'
            blocked_iframe = self._html_search_regex(
                r'<iframe src="([^"]+)"', content,
                'Websense information URL', default=None)
            if blocked_iframe:
                msg += ' Visit %s for more details' % blocked_iframe
            raise ExtractorError(msg, expected=True)
        if '<title>The URL you requested has been blocked</title>' in first_block:
            msg = (
                'Access to this webpage has been blocked by Indian censorship. '
                'Use a VPN or proxy server (with --proxy) to route around it.')
            block_msg = self._html_search_regex(
                r'</h1><p>(.*?)</p>',
                content, 'block message', default=None)
            if block_msg:
                msg += ' (Message: "%s")' % block_msg.replace('\n', ' ')
            raise ExtractorError(msg, expected=True)
        if ('<title>TTK :: Доступ к ресурсу ограничен</title>' in content
                and 'blocklist.rkn.gov.ru' in content):
            raise ExtractorError(
                'Access to this webpage has been blocked by decision of the Russian government. '
                'Visit http://blocklist.rkn.gov.ru/ for a block reason.',
                expected=True)

    def _webpage_read_content(self, urlh, url_or_request, video_id, note=None, errnote=None, fatal=True, prefix=None, encoding=None):

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Use a different network (mobile hotspot, home connection) or a VPN outside the filtered network.
  2. Ask the network administrator to allow the target domain.
  3. Visit the URL printed in the error to see the filter's explanation/category.
  4. Prefer HTTPS URLs where possible — many filters only inject block pages into plain HTTP.

Example fix

# before
ydl.extract('http://example.com/video')  # behind Websense corporate proxy

# after: force https / bypass filter
ydl.extract('https://example.com/video')
Defensive patterns

Strategy: validation

Validate before calling

def looks_like_websense_block(html):
    head = html[:512]
    return '<title>Access to this site is blocked</title>' in html and 'Websense' in head

Try / catch

from youtube_dl.utils import ExtractorError
try:
    ydl.extract_info(url)
except ExtractorError as e:
    if 'Websense' in str(e):
        reroute_via_unfiltered_network(url)  # hotspot/VPN; retrying here is useless
    else:
        raise

Prevention

When it happens

Trigger: Running youtube-dl behind a corporate/school network whose Websense appliance intercepts HTTP and returns its block page. The '%s' in the message is the iframe URL from the block page with details of the filtering policy.

Common situations: Office, school, or public networks with forcepoint/trend-micro-class web filtering; HTTP (not HTTPS) requests being intercepted and rewritten to the block page.

Related errors


AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14). Data as JSON: /api/errors/c172ec7b700424d8. Report an issue: GitHub.