Created
April 17, 2021 20:30
-
-
Save cursorial/ad0e71ed6523a01dfc2f27a1eb4ee889 to your computer and use it in GitHub Desktop.
Follow user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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