postaddictme / instagram-php-scraper

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

Two-Step verification fails #1095

Open BlueCobold opened 2 years ago

BlueCobold commented 2 years ago

I'm trying to use the example with email-verification, because my account is being asked for it. I'm getting the following output:

Fatal error: Uncaught InstagramScraper\Exception\InstagramAuthException: Something went wrong when try two step verification. Please report issue. in .../vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php:2372
Stack trace:
#0 .../vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php(2224): InstagramScraper\Instagram->verifyTwoStep(Object(InstagramScraper\Http\Response), Array, Object(EmailVerification))
#1 .../twoStepAutoVerification/loginWithEmailAutoCponfirm.php(17): InstagramScraper\Instagram->login(false, Object(EmailVerification))
#2 {main}
  thrown in .../vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 2372

Relates to this line:

       if (!preg_match('/"input_name":"security_code"/', $response->raw_body, $matches)) {
            throw new InstagramAuthException('Something went wrong when try two step verification. Please report issue.', $response->code);
        }

I assume the HTML has changed and this input field cannot be found.