Skip to content

Commit df106cf

Browse files
committed
search group / page
1 parent 66b9b0b commit df106cf

File tree

9 files changed

+868
-163
lines changed

9 files changed

+868
-163
lines changed

popup/tabs.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,27 +93,30 @@ const tabs = [
9393
{
9494
...CATEGORY.facebook,
9595
scripts: [
96+
createTitle("--- Download ---", "--- Tải xuống ---"),
97+
s.fb_downloadWatchingVideo,
98+
s.fb_storySaver,
99+
s.fb_downloadCommentVideo,
100+
s.fb_videoDownloader,
101+
s.fb_getAvatarFromUid,
102+
// s.fb_storyInfo,
103+
createTitle("--- Bulk Download ---", "--- Tải hàng loạt ---"),
104+
s.fb_downloadAlbumMedia,
105+
s.fb_exportSaved,
96106
createTitle("--- Hot ---", "--- Nổi bật ---"),
97107
s.fb_revealDeletedMessages,
98108
s.fb_invisible_message,
99109
s.fb_moreReactionStory,
100110
s.fb_whoIsTyping,
101111
s.fb_removeFbclid,
112+
createTitle("--- Statistic ---", "--- Thống kê ---"),
102113
// s.fb_messengerHistory,
103114
s.fb_messengerCount,
115+
s.fb_searchGroupForOther,
116+
s.fb_searchPageForOther,
104117
createTitle("--- UI ---", "--- Giao diện ---"),
105118
s.fb_toggleLight,
106119
s.fb_toggleNewFeed,
107-
createTitle("--- Download ---", "--- Tải xuống ---"),
108-
s.fb_downloadWatchingVideo,
109-
s.fb_storySaver,
110-
s.fb_downloadCommentVideo,
111-
s.fb_videoDownloader,
112-
s.fb_getAvatarFromUid,
113-
// s.fb_storyInfo,
114-
createTitle("--- Bulk Download ---", "--- Tải hàng loạt ---"),
115-
s.fb_downloadAlbumMedia,
116-
s.fb_exportSaved,
117120
createTitle("--- Access Token ---", "--- Access Token ---"),
118121
s.fb_checkToken,
119122
s.fb_getTokenFfb,

scripts/_test.js

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -12,92 +12,12 @@ export default {
1212
},
1313

1414
onClickExtension: async () => {
15-
async function searchGroupForOther(other_uid, cursor, uid, dtsg) {
16-
let variables = JSON.stringify({
17-
count: 8,
18-
cursor: cursor ?? null,
19-
id: btoa(`app_collection:${other_uid}:2361831622:66`),
20-
});
21-
22-
let f = new URLSearchParams();
23-
f.append("__user", uid);
24-
f.append("__a", 1);
25-
f.append("dpr", 1);
26-
f.append("fb_dtsg", dtsg);
27-
f.append("fb_api_caller_class", "RelayModern");
28-
f.append(
29-
"fb_api_req_friendly_name",
30-
"ProfileCometAppCollectionGridRendererPaginationQuery"
31-
);
32-
f.append("variables", variables);
33-
f.append("doc_id", 5244211935648733);
34-
35-
try {
36-
let res = await fetch("https://www.facebook.com/api/graphql/", {
37-
method: "POST",
38-
body: f,
39-
});
40-
41-
let json = await res.json();
42-
let { pageItems } = json.data.node;
43-
return {
44-
nextCursor: pageItems.page_info.end_cursor,
45-
groups: pageItems.edges.map((e) => ({
46-
id: e.node.node?.id || btoa(e.node.id).split(":").at(-1),
47-
title: e.node.title.text,
48-
subTitle: e.node.subtitle_text.text,
49-
url: e.node.url,
50-
visibility: e.node.node.visibility,
51-
image: e.node.image.uri,
52-
membersCount: Number(
53-
(
54-
e.node.node.forum_member_profiles.formatted_count_text ||
55-
e.node.node.group_member_profiles.formatted_count_text
56-
).match(/\d+/)?.[0] ?? 1
57-
),
58-
cursor: e.cursor,
59-
})),
60-
};
61-
} catch (e) {
62-
console.log("ERROR fetch page", e);
63-
return {
64-
nextCursor: null,
65-
groups: [],
66-
};
67-
}
68-
}
69-
70-
async function searchAllGroupForOther(
71-
other_uid,
72-
uid,
73-
dtsg,
74-
pageFetchedCallback
75-
) {
76-
let cursor = "";
77-
let allGroups = [];
78-
while (true) {
79-
let { nextCursor, groups } = await searchGroupForOther(
80-
other_uid,
81-
cursor,
82-
uid,
83-
dtsg
84-
);
85-
if (!nextCursor) {
86-
break;
87-
}
88-
cursor = nextCursor;
89-
allGroups = allGroups.concat(groups);
90-
await pageFetchedCallback?.(groups, allGroups);
91-
}
92-
return allGroups;
93-
}
94-
9515
let url = prompt("Nhập link facebook bạn bè: ");
9616
if (url == null) return;
9717

9818
let { setLoadingText, closeLoading } = showLoading("Đang chuẩn bị...");
9919
try {
100-
let { getUidFromUrl, getYourUserId, getFbdtsg } =
20+
let { getUidFromUrl, getYourUserId, getFbdtsg, searchAllGroupForOther } =
10121
UsefulScriptGlobalPageContext.Facebook;
10222

10323
setLoadingText("Đang lấy uid, token...");

0 commit comments

Comments
 (0)