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

Get all followers of a channel using followersFeed.items$.subscribe() #1750

Open
3 tasks done
ColorsCrypt opened this issue Jan 14, 2024 · 1 comment
Open
3 tasks done
Labels
question unconfirmed This issue hasn't been read/confirmed/accepted by an admin

Comments

@ColorsCrypt
Copy link

Form

Put an [x] if you meet the condition, else leave [ ].

Question

I want to get all followers of a channel, the code below only works for small channels with up to 500 followers. Can someone help me to make it work for more followers?

Code

async function getFollowers(channel) {
    await ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD);

    const id = await ig.user.getIdByUsername(channel);
    const followersFeed = await ig.feed.accountFollowers(id);
    return new Promise((resolve, reject) => {
        let channels = [];

        followersFeed.items$.subscribe(
            followers => {
                channels = channels.concat(...followers.map(item => item.username));
            },
            error => {
                console.error("Error:", error);
                if (channels.length < 0) {
                    reject(error, channels);
                }
                else {
                    resolve(channels, true);
                }
            },
            () => {
                resolve(channels, false);
            }
        );
    });
};

Error and Output

Error: IgResponseError: GET /api/v1/friendships/47451104466/followers/?max_id=1050%7CQVFCZmtPME0zZW9IY3RyWFdGVVE4VTJQd3VJMm5YcF9UZi0wX0NiZ1FpeWhqSlJJQ1VoaVd4bW5OR1FDWnlkRHk5eHg1ak5EX0dOOE0zMVRjRXJ0WmotZg%3D%3D&order=default&query=&enable_groups=true - 401 Unauthorized; Please wait a few minutes before you try again.
@ColorsCrypt ColorsCrypt added question unconfirmed This issue hasn't been read/confirmed/accepted by an admin labels Jan 14, 2024
@igornazarov1991
Copy link

@ColorsCrypt , I have the same issue. It obviously happens due to rate limits. However, web version of Instagram is capable of loading as many followers as needed. Are you able to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question unconfirmed This issue hasn't been read/confirmed/accepted by an admin
Projects
None yet
Development

No branches or pull requests

2 participants