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
873 stars 136 forks source link

Using with Laravel 5.8, Undefined property: stdClass::$authenticated error #121

Closed pwnz22 closed 4 years ago

pwnz22 commented 4 years ago

Version(s) affected: 6.3

Description
Getting error Undefined property: stdClass::$authenticated. Using this package with Laravel 5.8.

$cachePool = new FilesystemAdapter('Instagram', 0, __DIR__ . '/../cache');
$api = new Api($cachePool);
$api->login('pwnzov', '*****'); // mandatory
$profile = $api->getProfile('mosarch.buro');
$medias = $profile->getMedias()

How to reproduce
Here i reproducing it: https://мосарх.рф/instagram

Possible Solution
Optional: only if you have suggestions on a fix/reason for the bug

Additional context

/vendor/pgrimaud/instagram-user-feed/src/Instagram/Auth/Login.php Line 103

 if ($response->authenticated == true) {

https://imgur.com/AmA9too

On the local environment it's working fine.

ben182 commented 4 years ago

I also have this error when pushed to production. Seems like the IP is blocked or something but the login response may be empty.

pgrimaud commented 4 years ago

Hello @pwnz22

Could you dump the value of $response line 101?

pwnz22 commented 4 years ago

Hi @pgrimaud

{#716 ▼
  +"errors": {#718 ▼
    +"error": array:1 [▼
      0 => "Sorry, there was a problem with your request."
    ]
  }
  +"status": "ok"
  +"error_type": "generic_request_error"
}
pgrimaud commented 4 years ago

Unfortunately, you IP is probably ban from Instagram. You're using a shared hosting right?

If you try with a proxy, it should work properly.

(Example of proxy usage here : https://github.com/pgrimaud/instagram-user-feed/blob/master/examples/using-proxies.php#L17)

pwnz22 commented 4 years ago
'https' => '91.209.25.156:8080'

Tell please what's the IP i must put here?!

pgrimaud commented 4 years ago

It was a dummy IP taken from http://free-proxy.cz/en/

⚠️ But take care of using free proxy, network is probably sniffed and people can retrieve your account details and/or cookies associated.

You also can buy one from https://proxy6.net/en, which offers good services.

pwnz22 commented 4 years ago

Even with proxy cant get it work

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"} 

Now getting this error. Also added checkpoint challenge with imap :(

pgrimaud commented 4 years ago

Did you use a free or a private proxy?

Unfortunately, free proxies are always blacklisted from Instagram.

pwnz22 commented 4 years ago

Now i'm using free proxy. Understand problem. Thanks.

smknstd commented 4 years ago

Same here ! I get this error, so IP from my digital ocean VPS is probably banned:

Client error: `POST https://www.instagram.com/accounts/login/ajax/` resulted in a `429 -` response: {\"message\": \"\", \"spam\": true, \"status\": \"fail\"}