Skip to content

Instantly share code, notes, and snippets.

@Kqpa
Last active March 6, 2022 15:06
Show Gist options
  • Save Kqpa/05ff818ca9ee2835c13bdc7eb86b4bf1 to your computer and use it in GitHub Desktop.
Save Kqpa/05ff818ca9ee2835c13bdc7eb86b4bf1 to your computer and use it in GitHub Desktop.
Auto-friender for Polytoria
/*
How to use:
1: Get your CSRF token from `polytoria.com/my/settings`. You can find it by inspecting the page and searching for `CSRF`. After you find it, replace it with `token`.
2: Paste it into the console and wait for a while. You can adjust how many people you want to friend by changing the number at the 42nd line. Default is 200.
Warning: Your browser might crash. You can perform this on a server-sided virtual machine like Watson. (gitlab.com/Kqpa/watson)
*/
async function friend(id) {
const csrf = "token";
await fetch("https://polytoria.com/api/users/addfriend", {
credentials: "include",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0",
Accept: "*/*",
"Accept-Language": "en-US,en;q=0.5",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With": "XMLHttpRequest",
"Alt-Used": "polytoria.com",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
},
referrer: "https://polytoria.com/user/17978",
body: `csrf=${csrf}&id=${id}`,
method: "POST",
mode: "cors",
});
}
for (let i = 0; i < 200; i++) {
friend(i).then((finished) => console.log("Friended %d", i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment