postaddictme / instagram-php-scraper

Get account information, photos, videos, stories and comments.
https://packagist.org/packages/raiym/instagram-php-scraper
MIT License
3.09k stars 800 forks source link

Fatal error - TwoStepVerificationInterface #1098

Open remiamos opened 1 year ago

remiamos commented 1 year ago

Hi,

It seems that the scrapper doesn't work anymore. I use several accounts, proxies, etc. I always get:

Fatal error: Uncaught InstagramScraper\Exception\InstagramAuthException: $twoStepVerificator must be an instance of TwoStepVerificationInterface.

I need to enter the account manually and then I have to change may password.

Then this cycle returns when using the scraper...

Does anyone have the same issue?

Thanks!

paha77 commented 1 year ago

If you don't define the verificator explicitly on calling login, it tries to call it if checkpoint is required from Instagram:

https://github.com/postaddictme/instagram-php-scraper/blob/master/src/InstagramScraper/Instagram.php#L2238

if (isset($response->body->message) && $response->body->message == 'checkpoint_required') {
                $response = $this->verifyTwoStep($response, $cookies, $twoStepVerificator);
            }

IMHO this should be checked before calling.