CODE MỞ TÀI KHOẢN
console.log("Copyright maxvia88.com - Ads solution");
let access_token;
let fb_dtsg2 = require("DTSGInitialData").token || document.querySelector('[name="fb_dtsg"]').value;
let uid =require("CurrentUserInitialData").USER_ID || [removed].match(/c_user=(\d+)/)[1];
try {
access_token = require("WebApiApplication").getAccessToken();
} catch (error) { }
if (access_token === undefined || access_token === '') {
alert(`Please go to https://adsmanager.facebook.com and try again`);
window.location.href = "https://adsmanager.facebook.com/adsmanager/manage/campaigns?act=";
}
const ver = "v14.0";
const delay = 0;
getBusinesses();
async function getBusinesses() {
console.log(`Get Ads ID...`);
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?fields=id,name,adaccounts.limit(1000){account_status,created_time,owner,name}&access_token=${access_token}`,
{
method: 'GET',
credentials: 'include',
}
);
const json = await response.json();
return json;
}
let sucsess = 0;
async function action1(index, arr) {
const total = arr.data.adaccounts.data.length;
if (index >= total) {
console.log(`Done!!!\nActive success ${sucsess}/${total}\nmaxvia88.com - Ads solution`);
alert(`Active success ${sucsess}/${total} \nmaxvia88.com - Ads solution`);
window.open("https://www.facebook.com/ads/manager/accounts/?act=", "_blank");
return;
}
try {
const data = arr.data.adaccounts.data[index];
const businessID = data.id.replace("act_", "");
if (data.account_status === 100 || data.account_status === 101) {
const awaitAction2 = await action2(businessID, index, total);
const awaitDelay = await new Promise((r) => setTimeout(r, delay * 1000));
}
} catch (e) {
} finally {
++index;
action1(index, arr);
}
}
async function action2(businessID, index, total) {
const url = `https://adsmanager.facebook.com/api/graphql/?_callFlowletID=0&_triggerFlowletID=78266`;
try {
const response = await fetch(url, {
method: 'POST',
body: `av=${uid}&__usid=6-Tskqef5m5416h%3APskqefx164ljb2%3A1-Askqea7pchdsm-RV%3D6%3AF%3D&__aaid=${businessID}&__user=${uid}&__a=1&__req=88&__hs=19998.BP%3Aads_manager_pkg.2.0..0.0&dpr=1&__ccg=UNKNOWN&__rev=1016987598&__s=z2tt9o%3Alkfjeh%3A8vmk3x&__hsi=7421175297378821716&__dyn=7AgSXgWGgWEjgDBxmSudg9omoiyoK6FVpkihG5Xx2m2q3K2KmeGqKi5axeqaScCCG225pojACjyocuF98SmqnK7GzUuwDxq4EOezoK26UKbC-mdwTxOESegGbwgEmK9y8Gdz8hyUuxqt1eiUO4EgCyku4oS4EWfGUhwyg9p44889EScxyu6UGq13yHGmmUTxJe9LgbeWG9DDl0zlBwyzp8KUV2U8oK1IxO4VAcKmieyp8BlBUK2O4UOi3Kdx29wgojKbUO1Wxu4GBwkEuz478shECumbz8KiewwBK68eF9UhK1vDyojyUix92UtgKi3a6Ex0RyQcKazQ3G5EbpEtzA6Sax248GUgz98hAy8tKU-4U-UG7F8a898vhojCx6EO489UW5ohwZAxK4U-dwMxeayEiwAgCmq6UCQubxu3ydDxG8wRyK4UoLzokGp5yrz8C9wFjQfyoaoym9yA4Ekx24oK4Ehzawwy9pEHyU8Uiwg8KawrVV-i782bByUeoQwox3UO364GJe2q3KfzFLxny9onxDwBwXx67HxtBxO64uWg-26q2au5onADzEHDUyEkjByo4a9AwHxq5kiUarx5e8wAAAVQEhyeucyEy3aQ48B5wPDBw&__csr=&__comet_req=25&fb_dtsg=${fb_dtsg2}&jazoest=25353&lsd=_dtDtv84z9OIgGn5IXOdW2&__spin_r=1016987598&__spin_b=trunk&__spin_t=1727877021&__jssesw=1&qpl_active_flow_ids=270206671%2C270211726%2C270213183&fb_api_caller_class=RelayModern&fb_api_req_friendly_name=useBillingReactivateAdAccountMutation&variables=%7B%22input%22%3A%7B%22billable_account_payment_legacy_account_id%22%3A%22${businessID}%22%2C%22logging_data%22%3A%7B%22logging_counter%22%3A22%2C%22logging_id%22%3A%22559255213%22%7D%2C%22upl_logging_data%22%3A%7B%22context%22%3A%22billingaccountinfo%22%2C%22entry_point%22%3A%22power_editor%22%2C%22external_flow_id%22%3A%22%22%2C%22target_name%22%3A%22BillingReactivateAdAccountMutation%22%2C%22user_session_id%22%3A%22upl_1727876994352_7d1de259-07b1-4107-8ddf-e616f492eac6%22%2C%22wizard_config_name%22%3A%22REACTIVATE_AD_ACCOUNT%22%2C%22wizard_name%22%3A%22REACTIVATE_AD_ACCOUNT%22%2C%22wizard_screen_name%22%3A%22reactivate_ad_account_state_display%22%2C%22wizard_session_id%22%3A%22upl_wizard_1727876994352_902bd8bd-c035-4924-9f33-94b00c9a5b20%22%2C%22wizard_state_name%22%3A%22reactivate_ad_account_state_display%22%7D%2C%22actor_id%22%3A%22${uid}%22%2C%22client_mutation_id%22%3A%227%22%7D%7D&server_timestamps=true&doc_id=9984888131552276&fb_api_analytics_tags=%5B%22qpl_active_flow_ids%3D270206671%2C270211726%2C270213183%22%5D`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}) .then(response => response.text())
.then(responseText => {
// Check if the "success" key exists in the response
if (responseText.includes('status":"ADMARKET_ACCOUNT_STATUS_ACTIVE')) {
sucsess++;
console.log(`${index + 1}/${total} act_${businessID}| -> success`);
} else {
console.log(`${businessID}| -> Error: ${responseText}`);
}
})
.catch(error => {
console.log('Error:',error );
});
} catch (error) {
console.log(`${index + 1}/${total} act_${businessID}| -> Error ${error}`);
}
}