avatar
CODE KIK AGENCY 2

Guest 171 11th Feb, 2022

                                           
                         console.log("Copyright @mrblack");
const fb_dtsg = require("DTSGInitialData").token;
const uid = require("CurrentUserInitialData").USER_ID;
const access_token = require('WebApiApplication').getAccessToken();
const ver = "v11.0";
const delay = 0;
getBusinesses();
async function getBusinesses() {
console.log(`Get Businesses...`);
const json = await getBusinesses2();
const arr = {};
arr.data = json;
action1(0, arr);
}
async function getBusinesses2() {
const response = await fetch(
https://graph.facebook.com/${ver}/me/business_users?limit=9999&access_token=${access_token}
);
const json = await response.json();
return json;
}
async function action1(index, arr) {
const total = arr.data.data.length;
if (index >= total) {
console.log(`Done`);
return;
}
try {
const data = arr.data.data[index];
const businessID = data.business.id;
console.group(businessID);
console.log(`${index + 1}/${total}. ID: ${businessID} - Delay ${delay}s`);
const awaitDelay = await new Promise((r) => setTimeout(r, delay * 1000));
const awaitAction2 = await action2(businessID);
if (awaitAction2.data.onboard_business_to_marketing_program === null) {
console.log(`${index + 1}/${total}. ID: ${businessID} - Error`);
} else {
console.log(`${index + 1}/${total}. ID: ${businessID} - Success`);
}
} catch (e) {
} finally {
console.groupEnd();
++index;
action1(index, arr);
}
}
async function action2(businessID) {
const response = await fetch(
https://graph.facebook.com/graphql?method=post&access_token=${access_token}&variables={"businessID":"${businessID}","program":"CONVERSION_DATA"}&doc_id=3781416171970251
);
const json = await response.json();
return json;
                      
                                       
Để chia sẻ văn bản này, vui lòng sao chép url và gửi cho bạn bè của bạn.
Dữ liệu văn bản gốc
Các văn bản gần đây