2 years ago
#70219
RSA
Why Instagram followers retriever seldom works, most of times Invalid username?
When this code is running on chrome console with fresh Instagram login: Code seldom works Most of the time an Invalid username?
It seems most often after console.log(url)
code breaks.
let username = 'miyakoho'
let followers = []
try {
let res = await fetch('https://www.instagram.com/' + username + '/?__a=1')
res = await res.json()
let userId = res.graphql.user.id
let after = null
let has_next = true
after = null
while (has_next) {
let url='https://www.instagram.com/graphql/query/?query_hash=c76146de99bb02f6415203be841dd25a&variables=' + encodeURIComponent(JSON.stringify({
id: userId,
include_reel: true,
fetch_mutual: true,
first: 50,
after: after
}))
console.log(url)
await fetch(url).then(res => res.json()).then(res => {
has_next = res.data.user.edge_followed_by.page_info.has_next_page
after = res.data.user.edge_followed_by.page_info.end_cursor
followers = followers.concat(res.data.user.edge_followed_by.edges.map(({node}) => {
return {
username: node.username,
full_name: node.full_name
}
}))
})
}
console.log('Followings', followings)
} catch (err) {
console.log('Invalid username')
}
javascript
node.js
typescript
instagram-graph-api
0 Answers
Your Answer