Open GuilhermeCunha opened 3 years ago
const followersResponse = ig.feed.accountFollowers('128129999060');
// @ts-ignore followersResponse.nextMaxId = 'QVFBU1V3UlJuMUFIczVnVElZWDRnZ=='; // you can always save the latest "nextMaxId" hash and when you get 429, use the saved hash next time as checkpoint.
const followersResponse = ig.feed.accountFollowers('128129999060');
// @ts-ignore followersResponse.nextMaxId = 'QVFBU1V3UlJuMUFIczVnVElZWDRnZ=='; // you can always save the latest "nextMaxId" hash and when you get 429, use the saved hash next time as checkpoint.
Can you write an example about it? I don't get it.
Using an observable and subscribing to it do you have the same problem?
ig.feed.user(pageId).items$.subscribe(
async (medias) => {
console.log(`[ waiting ] - Inserindo ${medias.length}`);
await Promise.all(
medias.map(factoryCompetitorsMedia).map((media) => repository.save(media).catch(console.error))
);
},
(error) => console.log(chalk.red(`[❌] - ${error}`)),
() => console.log(chalk.green(`[✅] - Rotina finalizada`))
);
Form
Put an
[x]
if you meet the condition, else leave[ ]
.
- [x] I've searched the Issues
- [x] I've read the basic concepts
- [x] I'm using the latest version
Question
I would like to get all the followers of a user, but as there are many, I think the only alternative would be to split requests between multiple accounts.
For example, one account would have followers from 0 to 10,000, while another would have followers between 10,000 and 20,000. But I couldn't find any way to do this in the documentation, is it possible?
Code
async function getFollowers( username: string, ig: IgApiClient, { delay, limit, savePath }: GetFollowersOptions ): Promise<AccountFollowersFeedResponseUsersItem[]> { const id = await ig.user.getIdByUsername(username); const followersFeed = await ig.feed.accountFollowers(id); let followers: AccountFollowersFeedResponseUsersItem[] = []; let reqId = 0; do { reqId += 1; const items = await followersFeed.items(); followers = [...followers, ...items]; if (limit && limit !== -1) { if (followers.length >= limit) { break; } } await waitInSeconds(delay); } while (followersFeed.isMoreAvailable()); return followers }
Hi , Can you please me Guide me if you were able to achieve this , because I'm also trying to Scrape followers data
const id = await ig.user.getIdByUsername(username);
const followersFeed = await ig.feed.accountFollowers(id);
const followers = [];
const e = async () => {
let items = await followersFeed.items();
// Save to database or append in json file
followers.push(items);
const isMore = await followersFeed.isMoreAvailable();
if (isMore) {
await delay(20 * 1000) // delay 20 sec anti ban mode
e();
} else {
console.log("=====> All Followers Extracted");
}
};
await e()
};
Duplicate #988
Form
Put an
[x]
if you meet the condition, else leave[ ]
.Question
I would like to get all the followers of a user, but as there are many, I think the only alternative would be to split requests between multiple accounts.
For example, one account would have followers from 0 to 10,000, while another would have followers between 10,000 and 20,000. But I couldn't find any way to do this in the documentation, is it possible?
Code