Instagram-php-scraper: getMedias not working on prod

Created on 28 Oct 2019  路  12Comments  路  Source: postaddictme/instagram-php-scraper

I'm trying to display a list of the last posts from an instagram account (not private) in my Symfony project :

$instagram = new \InstagramScraper\Instagram();
        try {
            $posts = $instagram->getMedias('nameoftheaccount', 6);
        }
        catch (Exception $e) {
            $posts = [];
        }

Perfecty working on my dev version in localhost, but exception caught on prod.
Any idea ?

wontfix

Most helpful comment

I am experiencing the exact same problem. Locally it works perfectly, but I get the following error message on my live-site: Uncaught InstagramScraper\Exception\InstagramException: Response code is 200.'

What to do?

All 12 comments

Which error are you getting?

Hi, I am getting this same problem. The code is running fine in development but not in production.

The error that I am getting is "Account doesn't exist".

The error is occurring at line no. 353 Instagram.php .

if (!isset($userArray['entry_data']['ProfilePage'][0]['graphql']['user'])) {
throw new InstagramNotFoundException('Account with this username does not exist');
}

Any help is much appreciated.

do you get that error with All accounts or just some? Try using dedicated proxies.

The issue has got auto-resolved. The only thing I did was stop the code in development and was only using in production.

@fsjdg when I was getting the error , I was getting in all accounts.

Have same error on prod when I try to get medias: "Uncaught exception 'InstagramScraper\Exception\InstagramException' with message 'Response code is 200. Body:" . Localy work fine without any errors.

I am experiencing the exact same problem. Locally it works perfectly, but I get the following error message on my live-site: Uncaught InstagramScraper\Exception\InstagramException: Response code is 200.'

What to do?

Got exactly the same problem ? Has anybody solved it ?

Have you guys @bastluc @MadsWL tried using rotating proxies? it should help.

Also, if do several request to Instagram API, make sure you do some random pauses to avoid bot detection.

@fsjdg Just tried to use a proxy, same error... even on localhost

@bastluc Can't be any proxy. Usually, Instagram detects datacenter's proxies. Are you making this request with a logged-in account or without it?

@fsjdg I'm making de request without any account login

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joty0 picture joty0  路  3Comments

Tvvinman picture Tvvinman  路  7Comments

jakerator picture jakerator  路  5Comments

phoenixh picture phoenixh  路  5Comments

alabamaster picture alabamaster  路  6Comments