ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.3k stars 10.03k forks source link

Instagram videos aren't downloading anymore #31098

Open arunkumaraqm opened 2 years ago

arunkumaraqm commented 2 years ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--no-mtime', '-v', 'https://www.instagram.com/tv/CgOcAGzOxxU/?utm_source=ig_web_copy_link']
[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.5 (CPython) - Linux-5.13.0-40-generic-x86_64-with-glibc2.10
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4
[debug] Proxy map: {}
[Instagram] CgOcAGzOxxU: Downloading webpage
ERROR: Unable to extract video url; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/instagram.py", line 240, in _real_extract
    video_url = self._og_search_video_url(webpage, secure=False)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 1130, in _og_search_video_url
    return self._html_search_regex(regexes, html, name, **kargs)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 1021, in _html_search_regex
    res = self._search_regex(pattern, string, name, default, fatal, flags, group)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 1012, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract video url; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Description

Since one or two weeks, youtube-dl is not working for Instagram videos. Perhaps, this is due to some change in Instagram's source code. However, online websites like igram.io are still working.

cunlem commented 2 years ago

The direct link to post doesn't work in browser too (without login). Likely needs a Referer set

dirkf commented 2 years ago

The hydration JSON that the extractor parses has changed, and the video URL isn't obviously in the page fetched by yt-dl. Same issue for yt-dlp.

LevYas commented 2 years ago

Adding cookies or ?utm_source=ig_embed did not work for me. The only way to download video was to open the post in browser, opening dev console -> network -> "media" tab. There was a link like https://scontent-ams2-1.cdninstagram.com/v/t50..._n.mp4?... that worked for youtube-dl

miguelrdev commented 2 years ago

Adding cookies or ?utm_source=ig_embed did not work for me. The only way to download video was to open the post in browser, opening dev console -> network -> "media" tab. There was a link like https://scontent-ams2-1.cdninstagram.com/v/t50..._n.mp4?... that worked for youtube-dl

What worked for me is copy the curl request and add the output to file flag in a terminal.

delta1513 commented 2 years ago

Been working with instagram recently and I've discovered the following after also reading through #26377

If I find anything else that might be useful I'll post it here

cousteaulecommandant commented 2 years ago
  • Clicking the link in my browser normally shows the video and all perfectly fine without redirect. But as soon as I opened it in selenium, it worked once and then from then-on, my device could not load the page without being redirected to the login page no matter what URL arguments I put in, no matter which browser, both with and without selenium.

Don't quote me on this but I think that Instagram limits the number of daily visits users can make without logging in (probably based on IP), which may be interfering with your experiments. (This might also explain the disagreement on whether links work or not.)

Hopefully this won't make debugging this issue too complicated...