{"record":{"id":"3bb057d9bda7c2f0","repo":"yt-dlp/yt-dlp","slug":"could-not-extract-video-id-from-recording","errorCode":null,"errorMessage":"Could not extract video id from recording","messagePattern":"Could not extract video id from recording","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"yt_dlp/extractor/zattoo.py","lineNumber":70,"sourceCode":"        self._request_webpage(\n            f'{self._host_url()}/zapi/v3/session/hello', None,\n            'Opening session', data=urlencode_postdata({\n                'uuid': str(uuid.uuid4()),\n                'lang': 'en',\n                'app_version': '1.8.2',\n                'format': 'json',\n                'client_app_token': session_token,\n            }))\n\n    def _extract_video_id_from_recording(self, recid):\n        playlist = self._download_json(\n            f'{self._host_url()}/zapi/v2/playlist', recid, 'Downloading playlist')\n        try:\n            return next(\n                str(item['program_id']) for item in playlist['recordings']\n                if item.get('program_id') and str(item.get('id')) == recid)\n        except (StopIteration, KeyError):\n            raise ExtractorError('Could not extract video id from recording')\n\n    def _extract_cid(self, video_id, channel_name):\n        channel_groups = self._download_json(\n            f'{self._host_url()}/zapi/v2/cached/channels/{self._power_guide_hash}',\n            video_id, 'Downloading channel list',\n            query={'details': False})['channel_groups']\n        channel_list = []\n        for chgrp in channel_groups:\n            channel_list.extend(chgrp['channels'])\n        try:\n            return next(\n                chan['cid'] for chan in channel_list\n                if chan.get('cid') and (\n                    chan.get('display_alias') == channel_name\n                    or chan.get('cid') == channel_name))\n        except StopIteration:\n            raise ExtractorError('Could not extract channel id')\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/yt-dlp/yt-dlp/blob/81ecd58b1394793e6da9998cc19fdb45657f1685/yt_dlp/extractor/zattoo.py#L52-L88","documentation":"Zattoo recordings are resolved to an internal program_id by scanning /zapi/v2/playlist for an entry whose id equals the recording id in the URL. This error means the playlist contained no such recording (StopIteration) or entries lacked usable program_id/recordings keys (KeyError). It is raised without expected=True, so unexpected playlist shapes surface as extraction failures.","triggerScenarios":"A recording URL whose recid is not present in the account playlist (deleted recording, typo in id, or a playlist that requires authentication to include private recordings); upstream API change dropping/renaming the 'recordings' or 'program_id' fields.","commonSituations":"Recording was deleted on the account between listing and download attempt; extracting without being logged in so the personal playlist is empty; very old links with re-encoded ids; Zattoo API changes.","solutions":["Log in with the owning account (--username/--password or --cookies-from-browser) so the playlist actually lists your recordings","Verify the recording still exists by opening it in the Zattoo web app with the same account","Copy the recording URL fresh from the web app to rule out truncated/mutated ids","Update yt-dlp in case the playlist API shape changed and was patched"],"exampleFix":"# before (anonymous request -> empty personal playlist)\nyt-dlp \"https://zattoo.com/recording/123456\"\n\n# after (authenticated playlist lookup)\nyt-dlp --cookies-from-browser chrome \"https://zattoo.com/recording/123456\"","handlingStrategy":"validation","validationCode":"# Confirm the recording id looks like a Zattoo recording id before extracting\nimport re\nm = re.search(r'/recording/(?P<id>\\d+)', url)\nassert m, 'URL does not contain a numeric recording id'\nassert has_zattoo_session_cookies(), 'recording lookup needs an authenticated session'","typeGuard":null,"tryCatchPattern":"from yt_dlp.utils import ExtractorError\ntry:\n    ydl.download([url])\nexcept ExtractorError as e:\n    if 'Could not extract video id from recording' in str(e):\n        # recording missing from the account playlist: verify in the web app, then drop\n        mark_unavailable(url)\n    else:\n        raise","preventionTips":["Always pass cookies for the account that owns the recording","Copy recording URLs fresh from the Zattoo web app","Check recordings still exist before scheduling repeat downloads"],"tags":["zattoo","recording","id-resolution","playlist"],"backgroundTag":"id-not-found","analyzedSha":"81ecd58b1394793e6da9998cc19fdb45657f1685","analyzedAt":"2026-08-22T12:21:25.439Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}