goinsta
goinsta copied to clipboard
Failed to automatically process status code 400 'checkpoint_required' with checkpoint
Dear @Davincible,
I tried to run the code
insta, err = goinsta.Import(filePath, true) // OK
insta.SetProxy("some proxy", false, true)
insta.VisitProfile("some-profile")
stdout
Request Status Code 400: fail, checkpoint_required
Failed to automatically process status code 400 'checkpoint_required' with checkpoint url 'https://i.instagram.com/privacy/checks/?cookie_consent=1&next=instagram://checkpoint/dismiss', please report this on github. Error provided: context deadline exceeded
Request Status Code 400: fail, checkpoint_required
panic: Privacy request again, it hus failed, panicing
Content of https://i.instagram.com/privacy/checks/?cookie_consent=1&next=instagram://checkpoint/dismiss

<html>
<!-- headers, etc... -->
<div class="RnEpo Yx5HN _4Yzd2" role="presentation">
<div class="pbNvD FrS-d sjcY5 gD9tr" role="dialog">
<div class="_1XyCr ">
<div class="_74vy-">
<div class=" qF0y9 Igw0E IwRSH eGOV_ _4EzTm XfCBB g6RW6 ">
<div class=" qF0y9 Igw0E IwRSH eGOV_ ybXk5 _4EzTm a39_R DhRcB ">
<div class=" qF0y9 Igw0E IwRSH eGOV_ vwCYk ">
<h2 class="_7UhW9 x-6xq yUEEX KV-D4 uL8Hv l4b0S ">Accept cookies from Instagram on this browser?</h2></div><span class="_3G4x7 tN4Ei"><svg aria-label="Language" class="_8-yf5 " color="#262626" fill="#262626" height="24" role="img" viewBox="0 0 24 24" width="24"><circle cx="12" cy="12" r="1.5"></circle><circle cx="6" cy="12" r="1.5"></circle><circle cx="18" cy="12" r="1.5"></circle></svg><select aria-label="Switch Display Language" class="hztqj"><option value="af">Afrikaans</option><option value="cs">Čeština</option><option value="da">Dansk</option><option value="de">Deutsch</option><option value="el">Ελληνικά</option><option value="en">English</option><option value="en-gb">English (UK)</option><option value="es">Español (España)</option><option value="es-la">Español</option><option value="fi">Suomi</option><option value="fr">Français</option><option value="id">Bahasa Indonesia</option><option value="it">Italiano</option><option value="ja">日本語</option><option value="ko">한국어</option><option value="ms">Bahasa Melayu</option><option value="nb">Norsk</option><option value="nl">Nederlands</option><option value="pl">Polski</option><option value="pt-br">Português (Brasil)</option><option value="pt">Português (Portugal)</option><option value="ru">Русский</option><option value="sv">Svenska</option><option value="th">ภาษาไทย</option><option value="tl">Filipino</option><option value="tr">Türkçe</option><option value="zh-cn">中文(简体)</option><option value="zh-tw">中文(台灣)</option><option value="bn">বাংলা</option><option value="gu">ગુજરાતી</option><option value="hi">हिन्दी</option><option value="hr">Hrvatski</option><option value="hu">Magyar</option><option value="kn">ಕನ್ನಡ</option><option value="ml">മലയാളം</option><option value="mr">मराठी</option><option value="ne">नेपाली</option><option value="pa">ਪੰਜਾਬੀ</option><option value="si">සිංහල</option><option value="sk">Slovenčina</option><option value="ta">தமிழ்</option><option value="te">తెలుగు</option><option value="vi">Tiếng Việt</option><option value="zh-hk">中文(香港)</option><option value="bg">Български</option><option value="fr-ca">Français (Canada)</option><option value="ro">Română</option><option value="sr">Српски</option><option value="uk">Українська</option></select></span></div>
<div class=" AC7dP Igw0E IwRSH eGOV_ _4EzTm ">
<div class="_7UhW9 xLCgt MMzan _0PwGv uL8Hv l4b0S ">We use cookies to help personalize content, serve relevant ads and provide a safer experience. Learn more about cookie uses and controls in our <a href="/legal/cookies/" rel="noopener noreferrer" target="_blank">Cookie Policy</a>. You can review your controls at any time.</div>
</div>
</div>
</div>
<button class="aOOlW bIiDR " tabindex="0">Accept All</button>
<button class="aOOlW HoLwm " tabindex="0">Manage Data Settings</button>
</div>
</div>
</div>
<div id="fb-root" class=" fb_reset">
<div style="position: absolute; top: -10000px; width: 0px; height: 0px;">
<div></div>
</div>
</div>
</body>
</html>
Ah damn. It's the challenge solver isn't working like I hoped it had. I see you are using a proxy. Could you locally edit these lines, to point to a request interceptor proxy (I use Burpsuite), and check the UserAgent used by chrome to make the requests (by running your code again, so that the checkpoint request is made again)? https://github.com/Davincible/goinsta/blob/60a454938098516a3379d5455de091ebc8575d3d/headless.go#L181-L182
The reason it currently does not work is it says "Accept cookies on this browser", indicating Insta thinks the request is coming from a browser instead of a phone. It should only say something like "Accept cookies", without the browser part.
For me it appeared fine after I changed the user agent to the Webkit one, as should the current code do.
I'm also getting a similar issue when I'm trying to like a post and the program encounters a challenge. The program opens a headfull chromium browser to https://i.instagram.com/challenge/
and just sits there showing a blank page.
@maxyoumj0 Is the page completely blank? It should just open up and sit there, as challenges are meant to be resolved manually, however that does require them to show up properly of course :)
@Davincible The page is completely blank so I can't manually solve the challenges.
@maxyoumj0 if you manage to open up the page again, could you open up dev tools and check the user-agent?
Alternatively you could use http-tools to man in the middle proxy the requests with the HTTP_PROXY
env variable
Edit: To enable proxies, see https://github.com/Davincible/goinsta/wiki/10.-Settings-&-Logging#proxies
The user agent is "Mozilla/5.0 (Linux; Android 11; SM-G975F/exynos9820; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/95.0.4638.50 Mobile Safari/537.36 Instagram 195.0.0.31.123 Android (30/11; 560dpi; 1440x2898; samsung; SM-G975F; beyond2; exynos9820; en_US; 302733750)". I'll try the alternative method u suggested.
Hmm that should be the correct user agent. Debugging these kinds of issues is quite hard as I can't get IG to constantly challenges at me to try it out. It worked the few times I encountered challenges.
Next thing to check would be if all appropriate headers are set