-
-
Save dvygolov/e61d28fc283990aa7107f20878da866b to your computer and use it in GitHub Desktop.
let api = 'https://graph.facebook.com/v14.0'; | |
let headers = { | |
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", | |
"accept-language": "en-US,en;q=0.9", | |
"cache-control": "max-age=0", | |
"sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"", | |
"sec-ch-ua-mobile": "?0", | |
"sec-ch-ua-platform": "\"Windows\"", | |
"sec-fetch-dest": "document", | |
"sec-fetch-mode": "navigate", | |
"sec-fetch-site": "none", | |
"sec-fetch-user": "?1", | |
"upgrade-insecure-requests": "1" | |
}; | |
let f = await fetch(`${api}/me/accounts?access_token=${__accessToken}`, { | |
"headers": headers, | |
"referrerPolicy": "strict-origin-when-cross-origin", | |
"body": null, | |
"method": "GET", | |
"mode": "cors", | |
"credentials": "include" | |
}); | |
let js = await f.json(); | |
let data = js['data']; | |
let msg = ''; | |
for (let i = 0; i < data.length; i ++) { | |
msg += `${i+1}. ${data[i]['name']}\n`; | |
} | |
let fpIndex = prompt(`Choose your FanPage (for example, 1):\n${msg}`); | |
let fp = data[fpIndex-1]; | |
let fpId = fp['id']; | |
let usersText=prompt(`${fp['name']} selected!\nEnter user ids to block (divided by Enter):`); | |
let users = usersText.split('\n'); | |
var userIds=[]; | |
let r = /\d+/; | |
for (var i=0;i<users.length;i++){ | |
userIds.push(r.exec(users[i])[0]); | |
} | |
console.log(`Total users found:${users.length}`); | |
let result = await blockUsers(fpId,fp['access_token'],userIds); | |
alert(JSON.stringify(result)); | |
async function blockUsers(fpId,fpToken,users){ | |
let f = await fetch(`${api}/${fpId}/blocked?access_token=${fpToken}&method=post&user=${JSON.stringify(users)}`, { | |
"headers": headers, | |
"referrerPolicy": "strict-origin-when-cross-origin", | |
"body": null, | |
"method": "GET", | |
"mode": "cors", | |
"credentials": "include" | |
}); | |
let js = await f.json(); | |
console.log(js); | |
return js; | |
} |
Wow awesome I tested it it really works! You made my life easier bro
You are welcome, man!
Hello bro I struggled in step when I need to export new blocked users from FP new type. How can I do that?
Hello bro I struggled in step when I need to export new blocked users from FP new type. How can I do that?
Yep, no problem. I made this script to export blocked users: https://gist.github.com/dvygolov/eaf57fd387df03cce9c04544fa28f220
Also I updated the article about these scripts: https://yellowweb.top/zaranee-ubiraem-negativno-nastroennuyu-auditoriyu-s-pomoshhyu-skriptov-importa-eksporta-nadoedlivyh-kommentatorov/
You are welcome.
Hello bro I struggled in step when I need to export new blocked users from FP new type. How can I do that?
Yep, no problem. I made this script to export blocked users: https://gist.github.com/dvygolov/eaf57fd387df03cce9c04544fa28f220 Also I updated the article about these scripts: https://yellowweb.top/zaranee-ubiraem-negativno-nastroennuyu-auditoriyu-s-pomoshhyu-skriptov-importa-eksporta-nadoedlivyh-kommentatorov/
You are welcome.
Awesome! Thank you so much
Sadly an error occured. How can I fix that?
Access to fetch at 'https://graph.facebook.com/v14.0/113326078349815/blocked?access_token=EAABsbCS1iHgBABYpc54FIo5iZAZAnbMRQHLqyHVCUbnVNrRdfQVfq24OBumXliwxm7AM4HvQH1wDPPQezXZBMnihbmGELziCh5dTOjLm8lfgrgi8u0ZBSf6ZAcgwtMjo2HnoneXwWSfnj6qsANZCVIW6aN6F3CyzCVGrFUR80IFT31DZAbk3uzxOSIDsQZDZD&method=post&user=[%22100006392290962%22]' from origin 'https://business.facebook.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
Still don't work. Am I doing right by run it in ads manager?
Wow awesome I tested it it really works! You made my life easier bro