Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private account exception on public Profile #706

Closed
kvrushifa opened this issue Jun 29, 2020 · 4 comments
Closed

Private account exception on public Profile #706

kvrushifa opened this issue Jun 29, 2020 · 4 comments

Comments

@kvrushifa
Copy link

Everything works fine, except the getFollowers method on public profiles.

In this case, i tried to get the followers of this insta account: https://www.instagram.com/desk2work/

Warning: count(): Parameter must be an array or an object that implements Countable in /Users/nicom/Desktop/InstaPHPTest/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 1282

Fatal error: Uncaught InstagramScraper\Exception\InstagramException: Failed to get followers of account id desk2work. The account is private. in /Users/nicom/Desktop/InstaPHPTest/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php:1283
Stack trace:
#0 /Users/nicom/Desktop/InstaPHPTest/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php(1235): InstagramScraper\Instagram->getPaginateFollowers('desk2work', 20, 20, true, '')
#1 /Users/nicom/Desktop/InstaPHPTest/app.php(7): InstagramScraper\Instagram->getFollowers('desk2work')
#2 {main}
thrown in /Users/nicom/Desktop/InstaPHPTest/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 1283

@kvrushifa kvrushifa changed the title Private account Exception on public Profile Private account exception on public Profile Jun 29, 2020
@crpmax
Copy link

crpmax commented Jun 30, 2020

Hello,
you are supposed to pass an user ID to the getFollowers method, not the username.

You can get the account like this:
$account = $instagram->getAccount("username");
and then get the ID:
$followers = $instagram->getFollowers($account->getId());

@kvrushifa
Copy link
Author

Hi @CreeperMaxCZ ,

i tried to get the followers by account id, but i still get the same result

`<?php

require_once('./vendor/autoload.php');

$instagram = new \InstagramScraper\Instagram();

$profile = $instagram->getAccount('desk2work');
$nonPrivateAccountMedias = $instagram->getFollowers($profile->getId());

print_r($nonPrivateAccountMedias);`

Fatal error: Uncaught InstagramScraper\Exception\InstagramException: Failed to get followers of account id 29641904088. The account is private. in /Users/nicom/Desktop/InstaPHPTest/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php:1283
Stack trace:
#0 /Users/nicom/Desktop/InstaPHPTest/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php(1235): InstagramScraper\Instagram->getPaginateFollowers(29641904088, 20, 20, true, '')
#1 /Users/nicom/Desktop/InstaPHPTest/app.php(8): InstagramScraper\Instagram->getFollowers(29641904088)
#2 {main}
thrown in /Users/nicom/Desktop/InstaPHPTest/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 1283

@lukaspicha
Copy link

I have a same problem, I think that IG block this function.

@kvrushifa
Copy link
Author

I solved this by passing the account id instead of the account name to the "getAccount" method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants