ytdl-org/youtube-dl · error · ExtractorError

Token error: %s

Error message

Token error: %s

What it means

Raised by the laola1.tv extractor when the XML stream-access token has status != '0', i.e. the token service refused to authorize the stream. The token's comment attribute is included in the message. It is expected=True; common comments are region/entitlement refusals.

Source

Thrown at youtube_dl/extractor/laola1tv.py:49

        },
    }]

    def _extract_token_url(self, stream_access_url, video_id, data):
        return self._download_json(
            self._proto_relative_url(stream_access_url, 'https:'), video_id,
            headers={
                'Content-Type': 'application/json',
            }, data=json.dumps(data).encode())['data']['stream-access'][0]

    def _extract_formats(self, token_url, video_id):
        token_doc = self._download_xml(
            token_url, video_id, 'Downloading token',
            headers=self.geo_verification_headers())

        token_attrib = xpath_element(token_doc, './/token').attrib

        if token_attrib['status'] != '0':
            raise ExtractorError(
                'Token error: %s' % token_attrib['comment'], expected=True)

        formats = self._extract_akamai_formats(
            '%s?hdnea=%s' % (token_attrib['url'], token_attrib['auth']),
            video_id)
        self._sort_formats(formats)
        return formats

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)
        flash_vars = self._search_regex(
            r'(?s)flashvars\s*=\s*({.+?});', webpage, 'flash vars')

        def get_flashvar(x, *args, **kwargs):
            flash_var = self._search_regex(
                r'%s\s*:\s*"([^"]+)"' % x,
                flash_vars, x, default=None)

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Route through a proxy/VPN in the video's licensed region (geo_verification_headers already advertise your region)
  2. If the content requires a subscription, pass cookies/credentials for an entitled account
  3. Update youtube-dl/yt-dlp in case the token flow changed
  4. If you believe access should be allowed, open the URL in a browser from the same network to confirm whether it plays at all
Defensive patterns

Strategy: retry

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    msg = str(e)
    if 'Token error' in msg:
        if is_region_related(msg):
            retry_with_regional_proxy(url)
        else:
            notify_entitlement_missing(msg)
    else:
        raise

Prevention

When it happens

Trigger: Calling the laola1tv embed or site extractor where _extract_formats downloads token_url and the returned <token status="..."> attribute is non-zero — e.g. the video is geo-blocked for the requester's IP or requires a paid subscription (abo) that the anonymous request lacks.

Common situations: Watching region-locked sports broadcasts (laola1 is heavily geo-segmented) from outside the licensed country; attempting paid/abo content without credentials; CDN token endpoints changing their status codes after site updates; corporate proxy IPs flagged by the geo check.

Related errors


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