Skip to content

Commit 520187c

Browse files
committed
access token iphone
1 parent d467fe2 commit 520187c

File tree

3 files changed

+34
-14
lines changed

3 files changed

+34
-14
lines changed

scripts/content-scripts/scripts/ufs_global_webpage_context.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ const UsefulScriptGlobalWebpageContext = {
7373
},
7474
},
7575
Facebook: {
76+
getUserAvatarFromUid(uid) {
77+
return (
78+
"https://graph.facebook.com/" +
79+
uid +
80+
"/picture?height=500&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662"
81+
);
82+
},
7683
decodeArrId(arrId) {
7784
return arrId[0] * 4294967296 + arrId[1];
7885
},

scripts/fb_getAvatarFromUid.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { downloadData, showLoading } from "./helpers/utils.js";
2+
import { AccessToken } from "./helpers/constants.js";
23

34
export default {
45
icon: '<i class="fa-solid fa-user"></i>',
@@ -12,8 +13,6 @@ export default {
1213
},
1314

1415
onClickExtension: async function () {
15-
let accessToken = prompt("Nhập facebook access token: ");
16-
if (!accessToken) return;
1716
let uids = prompt("Nhập danh sách uid, Mỗi uid 1 dòng:");
1817
if (!uids) return;
1918

@@ -23,25 +22,35 @@ export default {
2322
let urls = [];
2423
for (let uid of uids) {
2524
setLoadingText("Đang lấy avatar của " + uid + "...");
26-
let url = `https://graph.facebook.com/${uid}/picture?type=large&access_token=${accessToken}`;
27-
let data = await fetch(url);
28-
if (data?.url) {
29-
urls.push(data?.url);
25+
let url = await shared.getAvatarFromUid(uid);
26+
if (url) {
27+
urls.push(url);
3028
}
3129
}
30+
31+
if (urls.length === 0) alert("Không tìm được avatar nào!");
32+
else if (urls.length === 1) window.open(urls[0]);
33+
else {
34+
if (
35+
confirm("Tìm được " + urls.length + " avatars.\nBấm Ok để tải xuống.")
36+
)
37+
downloadData(
38+
urls.join("\n"),
39+
`uid-${new Date().toLocaleString()}.txt`
40+
);
41+
}
3242
} catch (e) {
3343
alert("ERROR: " + e);
3444
} finally {
3545
closeLoading();
3646
}
47+
},
48+
};
3749

38-
if (urls.length === 0) alert("Không tìm được avatar nào!");
39-
else if (urls.length === 1) window.open(urls[0]);
40-
else {
41-
if (
42-
confirm("Tìm được " + urls.length + " avatars.\nBấm Ok để tải xuống.")
43-
)
44-
downloadData(urls.join("\n"), `uid-${new Date().toLocaleString()}.txt`);
45-
}
50+
export const shared = {
51+
getAvatarFromUid: async (uid) => {
52+
let url = `https://graph.facebook.com/${uid}/picture?height=500&access_token=${AccessToken.FacebookIphone}`;
53+
let data = await fetch(url);
54+
return data.url;
4655
},
4756
};

scripts/helpers/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ export const EventMap = {
2020
[Events.onDocumentIdle]: "document_idle",
2121
[Events.onDocumentEnd]: "document_end",
2222
};
23+
24+
export const AccessToken = {
25+
FacebookIphone: "6628568379%7Cc1e620fa708a1d5696fb991c1bde5662",
26+
};

0 commit comments

Comments
 (0)