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

Code Up Giayto

The document is a JavaScript asynchronous function that prompts the user for a number of links to fetch from a Facebook API. It constructs requests with specific headers and parameters, retrieves serialized state data, and generates downloadable links. If valid links are obtained, it creates a text file for download; otherwise, it notifies the user of invalid links.

Uploaded by

elonoreblush
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)
163 views2 pages

Code Up Giayto

The document is a JavaScript asynchronous function that prompts the user for a number of links to fetch from a Facebook API. It constructs requests with specific headers and parameters, retrieves serialized state data, and generates downloadable links. If valid links are obtained, it creates a text file for download; otherwise, it notifies the user of invalid links.

Uploaded by

elonoreblush
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: "), 10);

if (isNaN(nums) || nums <= 0) {


console.log("Số lượng link không hợp lệ.");
return;
}

let requests = Array.from({ length: nums }, async () => {


try {
let response = 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",
"sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\",
\"Google Chrome\";v=\"128\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-asbd-id": "129477",
"x-fb-friendly-name":
"CometIXTFacebookAuthenticityWizardTriggerRootQuery",
"x-fb-lsd": "OrwB6dDflbN5HVhfuhfISH"
},
referrer: "https://www.facebook.com/checkpoint/828281030927956/?
next=https%3A%2F%2Fsiteproxy.ruqli.workers.dev%3A443%2Fhttps%2Fwww.facebook.com%2F",
referrerPolicy: "strict-origin-when-cross-origin",
body: new URLSearchParams({
"__a": "1",
"fb_dtsg": require("DTSGInitialData").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"
});

let json = await response.json();


let serializedState =
json?.data?.ixt_authenticity_wizard_trigger?.screen?.view_model?.serialized_state;

if (serializedState) {
let link = `https://m.facebook.com/ixt/renderscreen/msite/?
serialized_state=${serializedState}`;
console.log(link);
return link;
}
} catch (error) {
console.error("Lỗi lấy link:", error);
}
return null;
});

linksArray = (await Promise.all(requests)).filter(Boolean); // Lọc bỏ null

if (linksArray.length > 0) {
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 - Phi");


} else {
console.log("Không có link hợp lệ để lưu.");
}
})();

You might also like