{"record":{"id":"f48ee7e1ea50d954","repo":"ytdl-org/youtube-dl","slug":"unable-to-login-incorrect-username-and-or-passwor","errorCode":null,"errorMessage":"Unable to login, incorrect username and/or password","messagePattern":"Unable to login, incorrect username and/or password","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/vk.py","lineNumber":59,"sourceCode":"\n        login_form = self._hidden_inputs(login_page)\n\n        login_form.update({\n            'email': username.encode('cp1251'),\n            'pass': password.encode('cp1251'),\n        })\n\n        # vk serves two same remixlhk cookies in Set-Cookie header and expects\n        # first one to be actually set\n        self._apply_first_set_cookie_header(url_handle, 'remixlhk')\n\n        login_page = self._download_webpage(\n            'https://login.vk.com/?act=login', None,\n            note='Logging in',\n            data=urlencode_postdata(login_form))\n\n        if re.search(r'onLoginFailed', login_page):\n            raise ExtractorError(\n                'Unable to login, incorrect username and/or password', expected=True)\n\n    def _real_initialize(self):\n        self._login()\n\n    def _download_payload(self, path, video_id, data, fatal=True):\n        data['al'] = 1\n        code, payload = self._download_json(\n            'https://vk.com/%s.php' % path, video_id,\n            data=urlencode_postdata(data), fatal=fatal,\n            headers={'X-Requested-With': 'XMLHttpRequest'})['payload']\n        if code == '3':\n            self.raise_login_required()\n        elif code == '8':\n            raise ExtractorError(clean_html(payload[0][1:-1]), expected=True)\n        return payload\n\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/vk.py#L41-L77","documentation":"Login-failure error from VKBaseIE._login: after POSTing the login form to login.vk.com/?act=login, the returned page contains the marker 'onLoginFailed'. The extractor interprets that marker as a rejected username/password pair and raises with expected=True.","triggerScenarios":"Invoking any VK extractor with -u/--username and -p/--password credentials that VK rejects, i.e. the login response HTML matches r'onLoginFailed'.","commonSituations":"Wrong password; account with 2FA/SMS confirmation enabled; VK flagging logins from datacenter IPs; stale credentials in a saved .netrc.","solutions":["Verify the VK username/password are correct by logging in at vk.com in a browser","Disable the login (extract without -u/-p) if the video is public","If 2FA or an unusual-location check is triggered, confirm the login on VK's side or log in from a trusted IP first"],"exampleFix":"# before\nyoutube-dl -u user@mail.com -p badpass https://vk.com/video-123_456\n# after (public video, no login needed)\nyoutube-dl https://vk.com/video-123_456","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from youtube_dl.utils import ExtractorError\ntry:\n    ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'Unable to login' in str(e):\n        opts.pop('username', None); opts.pop('password', None)\n        youtube_dl.YoutubeDL(opts).extract_info(url)  # retry anonymous","preventionTips":["Only pass -u/-p when the content actually requires an account","Test credentials with a trivial public request before batch jobs","Expect 2FA/verification failures from datacenter IPs"],"tags":["vk","login","authentication","credentials"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}