0% found this document useful (0 votes)
371 views2 pages

Tut 956 v3

The document contains a JavaScript asynchronous function that prompts the user for a number of links to fetch from Facebook's GraphQL API. It constructs a request with specific headers and parameters, retrieves the response, and generates download links based on the response data. Finally, it creates and downloads a text file containing the generated links with a user-specified filename.

Uploaded by

nghuyphuong98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
371 views2 pages

Tut 956 v3

The document contains a JavaScript asynchronous function that prompts the user for a number of links to fetch from Facebook's GraphQL API. It constructs a request with specific headers and parameters, retrieves the response, and generates download links based on the response data. Finally, it creates and downloads a text file containing the generated links with a user-specified filename.

Uploaded by

nghuyphuong98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

(async () => {

let linksArray = [];


let nums = parseInt(prompt("Nhập số link muốn lấy: "));
for (let i = 0; i < nums; i++) {
let response = await (await fetch("https://www.facebook.com/api/graphql/",
{
headers: {
"accept": "*/*",
"accept-language": "en-US,en;q=0.9",
"content-type": "application/x-www-form-urlencoded",
"priority": "u=1, i",
"x-fb-friendly-name":
"CometIXTFacebookAuthenticityWizardTriggerRootQuery",
"x-fb-lsd": "OrwB6dDflbN5HVhfuhfISH"
},
referrer: "https://www.facebook.com/checkpoint/828281030927956/?
next=https%3A%2F%2Ffanyv88.com%3A443%2Fhttps%2Fwww.facebook.com%2F",
referrerPolicy: "strict-origin-when-cross-origin",
body: new URLSearchParams({
"__a": "1",
"fb_dtsg": require("DTSGInitialData").token, // Cần thay thế bằng
phương pháp khác để lấy fb_dtsg token
"variables": JSON.stringify({
"input": {
"authenticity_product": "HIGH_PROFILE_IMPERSONATION",
"location": "UFAC_ID_VERIFICATION",
"logger_session_id": null,
"msite_handoff_id": null,
"next_uri": null,
"security_token": null,
"trigger_event_type": "AUTHENTICITY_WIZARD_TRIGGER",
"nt_context": null,
"trigger_session_id": "825370a8-83f8-455d-bc92-
670c285247b8"
},
"scale": 1
}),
"server_timestamps": "true",
"doc_id": "27744300361882324"
}),
method: "POST",
mode: "cors",
credentials: "include"
})).json();
let link = "https://m.facebook.com/ixt/renderscreen/msite/?
serialized_state=" +
response.data.ixt_authenticity_wizard_trigger.screen.view_model.serialized_state;
console.log(link);
linksArray.push(link);
}
let blob = new Blob([linksArray.join('\n')], { type: 'text/plain' });
let linkElement = document.createElement('a');
linkElement.href = URL.createObjectURL(blob);
let fileName = prompt("Nhập tên file để lưu: ");
let timeNow = Date.now();
linkElement.download = '956_ID' + fileName + '_' + timeNow + '.txt';
document.body.appendChild(linkElement);
linkElement.click();
document.body.removeChild(linkElement);
console.log("File đã được tạo và tải xuống - 956");
})();

You might also like