youtube-dl icon indicating copy to clipboard operation
youtube-dl copied to clipboard

Instagram videos aren't downloading anymore

Open arunkumaraqm opened this issue 2 years ago • 6 comments

Checklist

  • [x] I'm reporting a broken site support
  • [x] I've verified that I'm running youtube-dl version 2021.12.17
  • [x] I've checked that all provided URLs are alive and playable in a browser
  • [x] I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • [x] I've searched the bugtracker for similar issues including closed ones

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.

arunkumaraqm avatar Jul 20 '22 08:07 arunkumaraqm

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

cunlem avatar Jul 21 '22 01:07 cunlem

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.

dirkf avatar Jul 21 '22 11:07 dirkf

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

LevYas avatar Jul 23 '22 05:07 LevYas

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.

miguelrdev avatar Aug 22 '22 01:08 miguelrdev

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

  • 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.

  • I have tried using the CDN links that @LevYas mentioned and although they do work, they only appear in the network tab after you click play on the video.

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

delta1513 avatar Aug 28 '22 02:08 delta1513

  • 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...

cousteaulecommandant avatar Sep 09 '22 17:09 cousteaulecommandant