-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathfb_getTokenBussinessLocation.js
61 lines (57 loc) · 2.12 KB
/
fb_getTokenBussinessLocation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
export default {
icon: `<i class="fa-solid fa-key fa-lg"></i>`,
name: {
en: "Get fb token EAAG (business_locations)",
vi: "Lấy fb token EAAG (business_locations)",
},
description: {
en: "Get facebook token EAAG from business.facebook.com",
vi: "Lấy facebook token EAAG từ business.facebook.com",
},
popupScript: {
onClick: async function () {
const { showLoading } = await import("./helpers/utils.js");
// Get token using cookies https://github.com/dz-id/fb_get_token_from_cookie/blob/main/main.py
const { closeLoading } = showLoading("Đang lấy access token...");
fetch("https://business.facebook.com/business_locations")
.then((res) => res.text())
.then((htmlText) => {
let regex = htmlText.match(/(EAAG\w+)/);
if (null !== regex) {
let accesstoken = regex[1];
prompt("Access Token: ", accesstoken);
} else {
prompt(
"Không thấy token. Hãy chắc rằng bạn đã đăng nhập vào",
"https://business.facebook.com/business_locations"
);
}
})
.catch((e) => alert("Error: " + e))
.finally(closeLoading);
},
},
};
// {
// method: "GET",
// credentials: "include",
// headers: {
// "user-agent":
// "Mozilla/5.0 (Linux; Android 8.1.0; MI 8 Build/OPM1.171019.011) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.86 Mobile Safari/537.36", // don't change this user agent.
// referer: "https://www.facebook.com/",
// host: "business.facebook.com",
// origin: "https://business.facebook.com",
// "upgrade-insecure-requests": "1",
// "accept-language": "id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7",
// "cache-control": "max-age=0",
// accept:
// "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
// "content-type": "text/html; charset=utf-8",
// },
// }
// if (-1 == htmlText.search("EAA")) {
// alert("Token not found");
// return;
// }
// var o = htmlText.match(/EAAGNO.*?\"/);
// prompt("Token", o[0] ? o[0].replace(/\W/g, "") : "");