yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
89.21k stars 6.91k forks source link

[instagram] Error logging in, cannot download Instagram Highlights #5338

Closed AleksFimin closed 1 year ago

AleksFimin commented 2 years ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Region

Uzbekistan

Provide a description that is worded well enough to be understood

I can't get information about instagram highlits. If you specify --cookies-from-browser, everything is fine

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

yt-dlp -j -vU https://www.instagram.com/stories/highlights/17945585140590250/ --username "my gmail" --password "my password"
[debug] Command-line config: ['-j', '-vU', 'https://www.instagram.com/stories/highlights/17921449453583708/', '--username', 'PRIVATE', '--password', 'PRIVATE']
[debug] Encodings: locale cp1251, fs utf-8, pref cp1251, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.10.04 [4e0511f] (win32_exe)
[debug] Python 3.8.10 (CPython 64bit) - Windows-10-10.0.19044-SP0
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg n5.0.1-5-g240d82f26e-20220614 (setts), ffprobe n5.0.1-5-g240d82f26e-20220614
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.09.24, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
[debug] Loaded 1690 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.10.04, Current version: 2022.10.04
yt-dlp is up to date (2022.10.04)
[instagram:story] Downloading login webpage
ERROR: 17921449453583708: An extractor error has occurred. (caused by KeyError('config')); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 670, in extract
  File "yt_dlp\extractor\common.py", line 576, in initialize
  File "yt_dlp\extractor\instagram.py", line 67, in _perform_login
KeyError: 'config'
bashonly commented 2 years ago

Highlights are not accessible when not logged in (via web browser or yt-dlp).

This is an issue with logging in. See also: #5154, although this error is new.

AleksFimin commented 2 years ago

Is it possible to authorize automatically?

bashonly commented 2 years ago

Is it possible to authorize automatically?

since login w/credentials seems to be broken for this extractor currently, the only way is to use --cookies-from-browser or --cookies

AleksFimin commented 2 years ago

And the cookie is temporary, it turns out it will need to update manually the cookie after some time?

bashonly commented 2 years ago

--cookies-from-browser will extract the instagram cookies from your browser's cookie storage each time you run yt-dlp with that option. If you have logged into instagram or browsed instagram while logged in with your browser recently, the cookies should be up-to-date.

I would caution you to use your login cookies only when absolutely necessary / sparingly, since usage of yt-dlp (and other 3rd party tools) can be detected by instagram and it could lead to an account suspension or ban.

AleksFimin commented 2 years ago

Thanks for the advice, but isn't there a way to download a lot of videos automatically without getting blocked?

RealDeviil commented 2 years ago

And the cookie is temporary, it turns out it will need to update manually the cookie after some time?

In my experience, the login cookie generated by your browser will generate a cookie file that contains a "sessionid" cookie. When this cookie and other cookies are still valid and not expired, then you can download just about anything from Insta. However, the sessionid cookie expires after about 4 hours?, while the other cookies last much longer. This means that after ~4 hours, a sizable percentage of videos will stop downloading because the sessionid has expired. But, there are still many videos that can download even with an expired sessionid.

Since Insta login auth logic is broken, the only recourse (currently), IF you want to download as many Insta videos as possible all of the time, is to manually generate a cookie file every ~4 hours. In terms of automation, that is an awful solution. But that is where we're at right now.

bashonly commented 1 year ago

Closing in favor of #5154