{"record":{"id":"56522281c9cd4d6e","repo":"ytdl-org/youtube-dl","slug":"video-s-is-locked","errorCode":null,"errorMessage":"Video %s is locked","messagePattern":"Video (.+?) is locked","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/pornhub.py","lineNumber":396,"sourceCode":"                return\n            for item in q_items:\n                if isinstance(item, dict):\n                    add_video_url(item.get('url'))\n\n        if not video_urls:\n            FORMAT_PREFIXES = ('media', 'quality', 'qualityItems')\n            js_vars = extract_js_vars(\n                webpage, r'(var\\s+(?:%s)_.+)' % '|'.join(FORMAT_PREFIXES),\n                default=None)\n            if js_vars:\n                for key, format_url in js_vars.items():\n                    if key.startswith(FORMAT_PREFIXES[-1]):\n                        parse_quality_items(format_url)\n                    elif any(key.startswith(p) for p in FORMAT_PREFIXES[:2]):\n                        add_video_url(format_url)\n            if not video_urls and re.search(\n                    r'<[^>]+\\bid=[\"\\']lockedPlayer', webpage):\n                raise ExtractorError(\n                    'Video %s is locked' % video_id, expected=True)\n\n        if not video_urls:\n            js_vars = extract_js_vars(\n                dl_webpage('tv'), r'(var.+?mediastring.+?)</script>')\n            add_video_url(js_vars['mediastring'])\n\n        for mobj in re.finditer(\n                r'<a[^>]+\\bclass=[\"\\']downloadBtn\\b[^>]+\\bhref=([\"\\'])(?P<url>(?:(?!\\1).)+)\\1',\n                webpage):\n            video_url = mobj.group('url')\n            if video_url not in video_urls_set:\n                video_urls.append((video_url, None))\n                video_urls_set.add(video_url)\n\n        upload_date = None\n        formats = []\n","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/pornhub.py#L378-L414","documentation":"PornHubIE raises ExtractorError('Video %s is locked' % video_id, expected=True) when, after scanning all flashvar JS variable prefixes ('media', 'quality', 'qualityItems'), no video URLs were collected AND the webpage contains an element with id starting 'lockedPlayer'. This means the video requires a purchase, subscription tier, or is otherwise premium-locked, so PornHub serves a locked player with no media URLs.","triggerScenarios":"Extracting a premium/paid or VIP-locked video while not entitled: extract_js_vars finds no usable media/quality variables, video_urls stays empty, and the regex r'<[^>]+\\bid=[\"\\']lockedPlayer' matches the page. Only raised on the PC webpage path (inside the branch that downloaded webpage with those format prefixes).","commonSituations":"Model-channel or premium videos requiring paid access; logged-out extraction of subscriber-only content; cookies for an account without the needed entitlement.","solutions":["Log in with an account that has purchased/subscribed access (use --cookies from an entitled browser session).","Verify the video's lock status on the site; if it is paywalled, extraction without entitlement is not possible.","If you believe the video is free but still locked, update youtube-dl — flashvar variable naming changes can make free videos look 'locked' to old extractors.","Remove the URL from automated batches to avoid repeat failures."],"exampleFix":"# before\nyoutube_dl 'https://www.pornhub.com/view_video.php?viewkey=PREMIUM_ID'\n\n# after\nyoutube_dl --cookies entitled-cookies.txt 'https://www.pornhub.com/view_video.php?viewkey=PREMIUM_ID'","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    info = ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'is locked' in str(e):\n        retry_with_entitled_cookies(url)","preventionTips":["Use cookies from a subscribed account for premium URLs.","Treat 'is locked' as an entitlement problem, not a bug — no retry without new credentials.","Separate free and premium URL queues so one locked video does not abort a batch."],"tags":["pornhub","premium-content","paywall","expected-error"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}