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",
"sec-ch-prefers-color-scheme": "light",
"sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"Google Chrome\";v=\"128\"",
"sec-ch-ua-full-version-list": "\"Chromium\";v=\"128.0.6613.115\", \"Not;A=Brand\";v=\"24.0.0.0\", \"Google Chrome\";v=\"128.0.6613.115\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-model": "\"\"",
"sec-ch-ua-platform": "\"Windows\"",
"sec-ch-ua-platform-version": "\"10.0.0\"",
"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%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": "CHECKPOINT_EPSILON_SELFIE",
"country": null,
"location": "CHECKPOINT_FRAMEWORK",
"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": "3e0f3214-2aeb-4d0e-bcb0-294169da4420"
},
"scale": 1
}),
"server_timestamps": "true",
"doc_id": "8517192768300807"
}),
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_' + 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");