forked from lovmoon3k/useful-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfb_getTokenMFacebook.js
35 lines (34 loc) · 1.14 KB
/
fb_getTokenMFacebook.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
export default {
icon: `<i class="fa-solid fa-key"></i>`,
name: {
en: "Get fb Token (m.facebook.com)",
vi: "Lấy fb token (m.facebook.com)",
},
description: {
en: "Get facebook access token from m.facebook.com",
vi: "Lấy facebook access token từ trang m.facebook.com",
},
blackList: [],
whiteList: ["*://m.facebook.com"],
func: function () {
console.log("Đang lấy token ...");
fetch("https://m.facebook.com/composer/ocelot/async_loader/?publisher=feed")
.then((response) => response.text())
.then((text) => {
if ("<" == text[0]) {
alert("Chưa đăng nhập. Bạn cần đăng nhập fb thì mới lấy được token.");
} else {
const data = {
token: /(?<=accessToken\\":\\")(.*?)(?=\\")/.exec(text)[0],
fb_dtsg: /(?<=fb_dtsg\\" value=\\")(.*?)(?=\\")/.exec(text)[0],
id: /(?<=USER_ID\\":\\").*?(?=\\",\\")/gm.exec(text)[0],
};
console.log(data);
window.prompt("Access Token của bạn:", data.token);
}
})
.catch((e) => {
alert("ERROR: " + e.message);
});
},
};