-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFetch.ts
36 lines (34 loc) · 1.05 KB
/
Fetch.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import fetch from "node-fetch";
export const accountCreationRequest = async ({
username,
password,
email,
solvedCaptcha,
date
}: {
username: string;
password: string;
email: string;
solvedCaptcha: string;
date: { day: number; month: number; year: number };
}) => {
const body = `userlogin=${username}&userpassword=${password}&useremail=${email}&birth_day=${date.day}&birth_month=${date.month}&birth_year=${
date.year
}&parentemail=noreply%40ankama.com&sAction=submit&g-recaptcha-response=${solvedCaptcha}&_pjax=.ak-registerform-container`;
await fetch("https://www.dofus.com/fr/creer-un-compte", <any>{
credentials: "include",
headers: {
accept: "text/html, */*; q=0.01",
"accept-language": "en-US,en;q=0.9",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"x-pjax": "true",
"x-pjax-container": ".ak-registerform-container",
"x-requested-with": "XMLHttpRequest"
},
referrer: "https://www.dofus.com/fr/creer-un-compte",
referrerPolicy: "no-referrer-when-downgrade",
body,
method: "POST",
mode: "cors"
});
};