youtube-dl: youtube-dl unable to download private vk video do to allegedly invalid credentials
Checklist
- I’m asking a question
- I’ve looked through the README and FAQ for similar questions
- I’ve searched the bugtracker for similar questions including closed ones
Question
WRITE QUESTION HERE I am trying to download a video with my vk login credential but it fails do to invalid credentials. I am able to log in to my account using the same credentials that are returned in the failed youtube-dl pull request
here is the command line
youtube-dl -v -u <email/phone_number> -p <password> -vg "https://vk.com/video-133441491_456261066"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-u', 'PRIVATE', '-p', 'PRIVATE', '-vg', 'https://vk.com/video-133441491_456261066']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.8.10 (CPython) - Linux-5.13.0-1023-aws-x86_64-with-glibc2.29
[debug] exe versions: ffmpeg 4.2.7, ffprobe 4.2.7
[debug] Proxy map: {}
# I edit file /usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/vk.py with:
# def _login(self):
# username, password = self._get_login_info()
# print("-----------------------")
# print(username)
# print(password)
-----------------------
<username> # Used this username (copy/paste) to log in to my account via web UI
<password> # Used this password (copy/paste) to log in to my account via web UI
ERROR: Unable to login, incorrect username and/or password
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/youtube_dl/YoutubeDL.py", line 836, in __extract_info
ie_result = ie.extract(url)
File "/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/common.py", line 533, in extract
self.initialize()
File "/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/common.py", line 437, in initialize
self._real_initialize()
File "/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/vk.py", line 66, in _real_initialize
self._login()
File "/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/vk.py", line 62, in _login
raise ExtractorError(
youtube_dl.utils.ExtractorError: Unable to login, incorrect username and/or password
From what I found is that this should be working, and it is very likely that it is my credentials, but I was able to validate my credentials by login in with it to vk. Maybe my credentials need to wrapped in some chars like ’ or " or some other char?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 35 (11 by maintainers)
There are two issues:
Consequently:
--cookies ...
, but perhaps embedded and private are mutually exclusive.This patch fixes the extractor for public videos and should, I hope, enable private videos with
--cookies ...
as well (it also includes_VALID_URL
improvements from yt-dlp).-g
/--get-url
just prints the download link(s).There will be a PR. If someone manages to fix the login soon, I’ll add that before merging. Then, real soon now, a 2022.0n.mm release.
Please tell us the details how you use cookies for downloading from vk.com? I tried to save cookies by the chrome extension (get cookies.txt), but I got an error:
What am I doing wrong?
Спасибо, а есть какие-то гайды как использовать файлы cookie я не совсем понимаю как их подключить
Back-port of the newly updated yt-dlp extractor handles https://vk.com/video-133441491_456261066.
doesn’t work for me in Europe
yt-dlp -F “https://vk.com/video-133441491_456261066” [vk] -133441491_456261066: Downloading JSON metadata ERROR: This video is only available for registered users. Use --cookies, --username and --password or --netrc to provide account credentials
Нужно узнать, какой у браузера User-Agent, и указать параметр --user-agent такой же. Потом если один раз запустить с параметром --cookie vk.txt, то пока yt-dl потыкается в сайт, он создаст vk.txt с кукисами в правильном формате. Открываем в браузере список куки, в Firefox при открытом залогиненном ВКонтакте Ctrl+Shift+K, вкладка Хранилище, раздел Куки, и по одной чик-чик-чик Ctrl+C, Ctrl+V имя и значение в vk.txt, через табуляцию, как требует формат файла. С таким содержимым vk.txt можно будет качать видео. У меня получилось скачать generic движком из мобильной (m.vk.com) версии сайта, но для этого ещё в эту мобильную версию зайти надо, у мобильной свои куки, и только потом снимать куки в vk.txt
youtube-dl --cookies vk.txt --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0" --force-generic-extractor https://m.vk.com/video-12345_67890
I had success with cookies method, generic extractor and a MOBILE (m.vk.com/video) version. You need to be sure saved cookies match the mobile version, so login to mobile version first in real browser
а что это? надо вставить куда-то?
From https://github.com/ytdl-org/youtube-dl/issues/31041#issue-1277401990:
Please discuss this in the yt-dlp tracker to avoid confusion.
вы можете просто файл загрузить куда-то целиком, а не кусками. может я не туда вставил что-то
я всё сделал по гайду обновил но. пишет опять тоже самое [vk] 77496727_456240355: Downloading JSON metadata ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.