Skip to content

Instantly share code, notes, and snippets.

@cursorial
Created April 17, 2021 20:30
Show Gist options
  • Save cursorial/ad0e71ed6523a01dfc2f27a1eb4ee889 to your computer and use it in GitHub Desktop.
Save cursorial/ad0e71ed6523a01dfc2f27a1eb4ee889 to your computer and use it in GitHub Desktop.
Follow user
const requestHeaders = [
{
name: 'accept',
value: '*/*'
},
{
name: 'accept-language',
value: 'en-US;q=0.9,en;q=0.8'
},
{
name: 'content-type',
value: 'application/x-www-form-urlencoded'
},
{
name: 'x-csrftoken',
value: '[omitted]'
},
{
name: 'x-ig-app-id',
value: '[omitted]'
},
{
name: 'x-ig-www-claim',
value: '[omitted]'
},
{
name: 'x-instagram-ajax',
value: '[omitted]'
},
{
name: 'x-requested-with',
value: 'XMLHttpRequest'
}
]
const request = new XMLHttpRequest()
request.open('POST', `https://www.instagram.com/web/friendships/${id}/follow/`)
requestHeaders.forEach((header) => {
request.setRequestHeader(header.name, header.value)
})
request.send()
request.onload = () => {
if(request.status === 200) {
console.log('successful follow')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment