Retrieve a paginated list of followers for a social media profile.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');
// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });
async function run() {
// Load the profile
const profile = await sdk.getProfile('social-media/followers@1.2.0');
// Use the profile
const result = await profile
.getUseCase('GetFollowers')
.perform({
profileId: '429238130'
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"profileId": "429238130"
}
{
"followers": [
{
"id": "1466796521412771840",
"username": "superface_test",
"imageUrl": "https://pbs.twimg.com/profile_images/1478302204306067462/5BEbrnPO_normal.jpg",
"followersCount": 42,
"followingCount": 3,
"postsCount": 321
}
],
"nextPage": "QVFIUjc2Y01oQ3F1bHk5WHNzNVVuS2ZAMSEtpdkxmbC1FV09XcGNmTUc4ZAkhrMlBPU19LYkM0dFY4",
"rateLimit": {
"bucket": "get-users-followed-lists",
"totalRequests": 15,
"remainingRequests": 12,
"remainingRequestsPercentage": 80,
"resetTimestamp": 1643713585
}
}