pgrimaud / instagram-user-feed

This is a scrapper to easily fetch any feed and interact with Instagram (like, follow, etc.) without OAuth for PHP.
MIT License
881 stars 137 forks source link

Unknown error, please report it with a GitHub issue. Client error: `POST https://www.instagram.com/accounts/login/ajax/ #159

Closed camohub closed 3 years ago

camohub commented 4 years ago

Version(s) affected: 6

Description
development.ERROR: Unknown error, please report it with a GitHub issue. Client error: POST https://www.instagram.com/accounts/login/ajax/ resulted in a 429 - response: {"message": "", "spam": true, "status": "fail"} {"exception":"[object] (Instagram\Exception\InstagramAuthException(code: 0): Unknown error, please report it with a GitHub issue. Client error: POST https://www.instagram.com/accounts/login/ajax/ resulted in a 429 - response: {\"message\": \"\", \"spam\": true, \"status\": \"fail\"} at /data/d/2/d256db6b-f1df-4272-beb5-c33bfe9038b4/amando.sk/sub/new/vendor/pgrimaud/instagram-user-feed/src/Instagram/Auth/Login.php:97) [stacktrace]

0 /data/d/2/d256db6b-f1df-4272-beb5-c33bfe9038b4/amando.sk/sub/new/vendor/pgrimaud/instagram-user-feed/src/Instagram/Api.php(97): Instagram\Auth\Login->process()

1 /data/d/2/d256db6b-f1df-4272-beb5-c33bfe9038b4/amando.sk/sub/new/app/Models/Services/InstagramService.php(71): Instagram\Api->login('info@kaufmann.s...', 'xxxxxxxxx')

2 /data/d/2/d256db6b-f1df-4272-beb5-c33bfe9038b4/amando.sk/sub/new/app/Models/Services/InstagramService.php(40): App\Models\Services\InstagramService->getApi()

How to reproduce

$cachePool = new FilesystemAdapter('Instagram', 0, __DIR__ . '/../../../sotrage/framework/cache');

$api = new Api($cachePool);
$api->login(self::IG_LOGIN, self::IG_PASSWORD);  // This log an error
return $api;

Weird is I am able to log in from localhost but not from the production server. I seems it could be related to rate limi. I made it make request every 0.1 second.

    while ( count($result) < 100 && $profile->hasMoreMedias() )
    {
        $profile = $api->getMoreMedias($profile);
        $medias = $profile->getMedias();
        $nextResult = $this->filterImages($medias);

        $result = array_merge($result, $nextResult);
        // avoid 429 Rate limit from Instagram
        usleep(100000);  // 0.1sec
    }

But I am not sure. Is it possible to get more than 12 medias at once?

xbfast commented 4 years ago

The same thing is happening to me:

$cachePool = new  FilesystemAdapter ( 'Instagram' , 0 , __DIR__. '/../caché' );
        $api = new  Api ( $cachePool );
        $api -> login ( 'user' , 'pass' ); // obligatorio 
        $perfil = $api -> getProfile ( 'user' );

        $perfil -> getUserName ();

        dd($perfil);

Unknown error, please report it with a GitHub issue. Client error:POST https://www.instagram.com/accounts/login/ajax/resulted in a403 Forbiddenresponse: {"message": "Please wait a few minutes before you try again.", "status": "fail"}

PrasadBroo commented 4 years ago

@xbfast i also had similar problem this happens when you exceed login limit just try after some time it will work.

xbfast commented 4 years ago

Hello, I tried again today and the same thing keeps happening to me @PrasadBroo

PrasadBroo commented 4 years ago

make new account and try with it

pgrimaud commented 4 years ago

Hello there

camohub commented 4 years ago

Localy it works perfectly well. But on production server it throws an error.

amro80 commented 4 years ago

the same issue for me, first I got Unknown error, please report it with a GitHub issue. Client error: POST https://www.instagram.com/accounts/login/ajax/resulted in a 403 Forbidden response: {"message": "Please wait a few minutes before you try again.", "status": "fail"}

then after clearing cache I got Unknown error, please report it with a GitHub issue. Client error: POST https://www.instagram.com/accounts/login/ajax/ resulted in a 429 - response: {"message": "", "spam": true, "status": "fail"}

amro80 commented 4 years ago

before the email challenge page there is a "Your Account Has Been Temporarily Locked" message page, with Continue button HTML of page

<!DOCTYPE html>

Instagram

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Below is the request that send to pass this page, I copied it from my browser.

{challengeType: "AcknowledgeForm", errors: [], experiments: {},…} challengeType: "AcknowledgeForm" challenge_context: "{"step_name": "", "nonce_code": "IY71kqdBo6", "user_id": 44278780500, "is_stateless": false}" errors: [] experiments: {} extraData: {typename: "GraphChallengePage",…} content: [{typename: "GraphChallengePageHeader", description: null,…},…] 0: {typename: "GraphChallengePageHeader", description: null,…} description: null title: "Your Account Has Been Temporarily Locked" typename: "GraphChallengePageHeader" 1: {typename: "GraphChallengePageText", alignment: "center", html: null,…} alignment: "center" html: null text: "We've detected suspicious activity on your Instagram account and have temporarily locked it as a security precaution." typename: "GraphChallengePageText" 2: {typename: "GraphChallengePageText", alignment: "center", html: null,…} alignment: "center" html: null text: "It's likely that your account was compromised as a result of entering your password on a website designed to look like Instagram. This attack is known as phishing." typename: "GraphChallengePageText" 3: {typename: "GraphChallengePageText", alignment: "center", html: null,…} alignment: "center" html: null text: "Over the next few steps we'll ask you to verify your identity to help secure your account, and let you log back in." typename: "GraphChallengePageText" 4: {typename: "GraphChallengePageForm", call_to_action: "Continue", display: "inline", fields: null,…} call_to_action: "Continue" display: "inline" fields: null href: null typename: "GraphChallengePageForm" __typename: "GraphChallengePage" fields: {} navigation: {forward: "/challenge/44278780500/IY71kqdBo6/", replay: "/challenge/replay/44278780500/IY71kqdBo6/",…} dismiss: "https://www.instagram.com/" forward: "/challenge/44278780500/IY71kqdBo6/" replay: "/challenge/replay/44278780500/IY71kqdBo6/" privacyPolicyUrl: "/about/legal/privacy/" status: "ok" type: "CHALLENGE"

camohub commented 4 years ago

What it means?

samuelhgf commented 3 years ago

Any solution for that?

restyler commented 3 years ago

First of all, everyone should understand that logging into your Instagram account is currently not neccessary to parse public account feeds if you use good clean ip, and parsing public accounts is one of the most common tasks of scrapers. Easiest way to test if the Instagram page you need is accessible to anonymous is to use Chrome Incognito and just open the url in browser, e.g.: https://www.instagram.com/affordablewristtime/ is available for anonymous when you open it via your home network.

Then try to open the same page via curl from your server (use "Copy as CURL" functionality in Chrome inspector and make sure user agent is set in headers). Review if the response from instagram differs (e.g. check of the html page) from what you get on your home network.</p> <p>Big chance is that your datacenter ip is banned by Instagram and it will just show your "please log in". Instagram is very strict in terms of ip ranges. They've banned all big datacenter up ranges long time ago, and they ban residential proxy ips every day. </p> <h3>This is how the issue can be fixed:</h3> <p>1) If you have low volume you should just stick to your home residential network and you should NOT log in into your Instagram account to avoid account locking, unless you really need to work with private information which is not available to anonymous users. 2) Another way is to use residential and mobile proxies to access the same public accounts. If you have to log in to your account, be really careful on changing proxies, try to stick to single ip address. Residential proxies will still fail so you need to implement retry logic and validate responses. 3) Another good option, if you need to scrape public accounts, is to use <a href="https://github.com/restyler/instagram-php-scraper">https://github.com/restyler/instagram-php-scraper</a> which handles residential proxies switching and retries for you. </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/camohub"><img src="https://avatars.githubusercontent.com/u/8393426?v=4" />camohub</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>Hmm, it seems also the public accounts are behind the login barier <a href="https://thenextweb.com/socialmedia/2019/10/28/instagram-now-forces-people-to-sign-in-to-view-public-profiles/">https://thenextweb.com/socialmedia/2019/10/28/instagram-now-forces-people-to-sign-in-to-view-public-profiles/</a></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/restyler"><img src="https://avatars.githubusercontent.com/u/775507?v=4" />restyler</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <blockquote> <p>Hmm, it seems also the public accounts are behind the login barier <a href="https://thenextweb.com/socialmedia/2019/10/28/instagram-now-forces-people-to-sign-in-to-view-public-profiles/">https://thenextweb.com/socialmedia/2019/10/28/instagram-now-forces-people-to-sign-in-to-view-public-profiles/</a></p> </blockquote> <p><a href="https://rapidapi.com/restyler/api/instagram40?endpoint=apiendpoint_792b5e11-15ea-4c16-ac77-96c4abca64a3">https://rapidapi.com/restyler/api/instagram40?endpoint=apiendpoint_792b5e11-15ea-4c16-ac77-96c4abca64a3</a> you can test public account access here , enter url of public account to the api param "URL" and click "test" button to get the result.</p> <p><img src="https://user-images.githubusercontent.com/775507/102053740-a8094000-3e01-11eb-98c6-0cc43fb504c6.png" alt="image" /></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/stale[bot]"><img src="https://avatars.githubusercontent.com/in/1724?v=4" />stale[bot]</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>