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.34k stars 10.03k forks source link

Instagram not working (macos) #28753

Closed ceo0x closed 3 years ago

ceo0x commented 3 years ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://www.instagram.com/p/CNnsINknHtb/']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.04.07
[debug] Git HEAD: 586d25a52
[debug] Python version 3.9.4 (CPython) - macOS-11.2.3-arm64-arm-64bit
[debug] exe versions: none
[debug] Proxy map: {}
[Instagram] CNnsINknHtb: 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; see  https://yt-dl.org/update
on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 806, in wrapper
    return func(self, *args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 827, in __extract_info
    ie_result = ie.extract(url)
  File "/opt/homebrew/lib/python3.9/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/opt/homebrew/lib/python3.9/site-packages/youtube_dl/extractor/instagram.py", line 240, in _real_extract
    video_url = self._og_search_video_url(webpage, secure=False)
  File "/opt/homebrew/lib/python3.9/site-packages/youtube_dl/extractor/common.py", line 1130, in _og_search_video_url
    return self._html_search_regex(regexes, html, name, **kargs)
  File "/opt/homebrew/lib/python3.9/site-packages/youtube_dl/extractor/common.py", line 1021, in _html_search_regex
    res = self._search_regex(pattern, string, name, default, fatal, flags, group)
  File "/opt/homebrew/lib/python3.9/site-packages/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; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Description

Instagram not working for me, youtube for example works

someziggyman commented 3 years ago

@dstftw @remitamine If this helps for testing: Noticed that for some countries like Sweden, UK,Netherlands, Japan, Russia (tested via a VPN) all instagram links are redirected to main log in page or even throws "allow cookies" popup over the login page in addition. However, under German VPN - all links are shown as regular instagram pages with playable videos and ytdl works flawlessly.. If more testing is needed I'm glad to help. Used ClearVPN for it (not sure if this matters)

Lesmiscore commented 3 years ago

@dstftw @remitamine If this helps for testing: Noticed that for some countries like Sweden, UK,Netherlands, Japan, Russia (tested via a VPN) all instagram links are redirected to main log in page or even throws "allow cookies" popup over the login page in addition. However, under German VPN - all links are shown as regular instagram pages with playable videos and ytdl works flawlessly.. If more testing is needed I'm glad to help. Used ClearVPN for it (not sure if this matters)

No, using VPNs get you redirect to login.

someziggyman commented 3 years ago

@dstftw @remitamine If this helps for testing: Noticed that for some countries like Sweden, UK,Netherlands, Japan, Russia (tested via a VPN) all instagram links are redirected to main log in page or even throws "allow cookies" popup over the login page in addition. However, under German VPN - all links are shown as regular instagram pages with playable videos and ytdl works flawlessly.. If more testing is needed I'm glad to help. Used ClearVPN for it (not sure if this matters)

No, using VPNs get you redirect to login.

Thanks for clarification. Did not know this was the case for instagram. Thought it'd be better to report things like that, rather than keeping silent about it. Cheers

RingoTheDog commented 3 years ago

I had this issue on one machine yet it downloaded correctly on a different machine (same network same ig creds etc...)

Hope this helps someone.... On the machine that was NOT working I tried: youtube-dl.py --dump-pages https://www.instagram.com/p/CNnsINknHtb/ and discovered that youtube-dl was being sent to: https://www.instagram.com/accounts/login/

On that machine I had logged into IG and save pw etc (with both chrome and IE) but youtube-dl was still being directed to login.

From chrome I exported my Instagram Cookies with the "Get cookies.txt" chrome plugin and then forced Youtube-dl to use that cookie text file: youtube-dl.py --cookies instagram.com_cookies.txt https://www.instagram.com/p/CNnsINknHtb/

so now I am able to download the video with --cookies file...but I am still NOT able to download without the cookies file, it is still being forwarded to the IG login page.

Somehow Youtube-dl is reading site cookies on one machine and not the other?...or the cookies are corrupt somehow?

Here are the back to back attempts on the same PC:

C:\Temp>youtube-dl.py -v --cookies instagram.com_cookies.txt https://www.instagram.com/p/CNnsINknHtb/ [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: ['-v', '--cookies', 'instagram.com_cookies.txt', 'https://www.instagram.com/p/CNnsINknHtb/'] [debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252 [debug] youtube-dl version 2021.04.07 [debug] Python version 3.6.6 (CPython) - Windows-10-10.0.14393-SP0 [debug] exe versions: ffmpeg 4.3.2-2021-02-02-full_build-www.gyan.dev, ffprobe 4.3.2-2021-02-02-full_build-www.gyan.dev, rtmpdump 2.4 [debug] Proxy map: {} [Instagram] CNnsINknHtb: Downloading webpage [debug] Default format spec: bestvideo+bestaudio/best [debug] Invoking downloader on 'https://instagram.fybz2-1.fna.fbcdn.net/v/t50.2886-16/10000000_454373325624009_1815201162850549139_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLjcyMC5pZ3R2LmRlZmF1bHQiLCJxZV9ncm91cHMiOiJbXCJpZ193ZWJfZGVsaXZlcnlfdnRzX290ZlwiXSJ9&_nc_ht=instagram.fybz2-1.fna.fbcdn.net&_nc_cat=109&_nc_ohc=qUaLpM5of1UAX9f7Mq3&edm=AABBvjUAAAAA&vs=17873921561294650_2741068888&_nc_vs=HBksFQAYJEdJQ1dtQURKVXFzSVFKMEJBSk05bFJ2WDR6QVpicUNCQUFBRhUAAsgBABUAGCRHSUNXbUFEMUI2VkNxUFVBQUtfYV8wbnhmT05OYnFDQkFBQUYVAgLIAQAoABgAGwGIB3VzZV9vaWwBMRUAACb0kerllI%2FAPxUCKAJDMywXQKOmBaHKwIMYEmRhc2hfYmFzZWxpbmVfMV92MREAdewHAA%3D%3D&_nc_rid=f59babb279&ccb=7-4&oe=607AB3FB&oh=322e893b99d6a96241e5e956c7904107&_nc_sid=83d603' [download] Destination: @silviacongost Dependencia emocional.-CNnsINknHtb.mp4 [download] 100% of 402.37MiB in 00:05

C:\Temp>youtube-dl.py -v https://www.instagram.com/p/CNnsINknHtb/ [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: ['-v', 'https://www.instagram.com/p/CNnsINknHtb/'] [debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252 [debug] youtube-dl version 2021.04.07 [debug] Python version 3.6.6 (CPython) - Windows-10-10.0.14393-SP0 [debug] exe versions: ffmpeg 4.3.2-2021-02-02-full_build-www.gyan.dev, ffprobe 4.3.2-2021-02-02-full_build-www.gyan.dev, rtmpdump 2.4 [debug] Proxy map: {} [Instagram] CNnsINknHtb: 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 "C:\TRANSMOGRIFIER\youtube-dl.py\youtube_dl\YoutubeDL.py", line 806, in wrapper return func(self, *args, kwargs) File "C:\TRANSMOGRIFIER\youtube-dl.py\youtube_dl\YoutubeDL.py", line 827, in __extract_info ie_result = ie.extract(url) File "C:\TRANSMOGRIFIER\youtube-dl.py\youtube_dl\extractor\common.py", line 534, in extract ie_result = self._real_extract(url) File "C:\TRANSMOGRIFIER\youtube-dl.py\youtube_dl\extractor\instagram.py", line 240, in _real_extract video_url = self._og_search_video_url(webpage, secure=False) File "C:\TRANSMOGRIFIER\youtube-dl.py\youtube_dl\extractor\common.py", line 1130, in _og_search_video_url return self._html_search_regex(regexes, html, name, kargs) File "C:\TRANSMOGRIFIER\youtube-dl.py\youtube_dl\extractor\common.py", line 1021, in _html_search_regex res = self._search_regex(pattern, string, name, default, fatal, flags, group) File "C:\TRANSMOGRIFIER\youtube-dl.py\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.

Lesmiscore commented 3 years ago

@RingoTheDog Are these on the same network? Anything browser can't do also applies to youtube-dl.

I tested accessing to IG without cookies and proxies in FF (Private Window mode), but I was also redirected to login page.