|
2 | 2 | // https://gist.github.com/J2TEAM/7cc8554b74ff8af3af522b42b95e73d8?fbclid=IwAR1zfXWCWjgffNNp21IA5NaPmc3mzVJDFnPhN4QPgupRk1cT566kYxPTMCg |
3 | 3 |
|
4 | 4 | /* Developed by Juno_okyo */ |
5 | | -(function (e) { |
6 | | - function f() { |
7 | | - var a = c.shift(); |
8 | | - g(a).then(function () { |
9 | | - 0 < c.length ? setTimeout(f, 100) : console.info("Done!"); |
| 5 | +(function (groupId) { |
| 6 | + function remove_unavailable_members() { |
| 7 | + var a = allMembers.shift(); |
| 8 | + console.log("Removing " + a); |
| 9 | + remove_member(a).then(function () { |
| 10 | + 0 < allMembers.length |
| 11 | + ? setTimeout(remove_unavailable_members, 100) |
| 12 | + : console.info("Done!"); |
10 | 13 | }); |
11 | 14 | } |
12 | | - function g(a) { |
| 15 | + function remove_member(mem_uid) { |
13 | 16 | var b = new FormData(); |
14 | | - b.append("fb_dtsg", h); |
15 | | - b.append("__user", k); |
| 17 | + b.append("fb_dtsg", getFbDtsg); |
| 18 | + b.append("__user", getUid); |
16 | 19 | b.append("confirmed", !0); |
17 | 20 | b.append("__a", 1); |
18 | 21 | return fetch( |
19 | 22 | "https://www.facebook.com/ajax/groups/remove_member/?group_id=" + |
20 | | - e + |
| 23 | + groupId + |
21 | 24 | "&member_id=" + |
22 | | - a + |
| 25 | + mem_uid + |
23 | 26 | "&is_undo=0&source=profile_browser&dpr=1", |
24 | 27 | { credentials: "include", body: b, method: "POST" } |
25 | 28 | ); |
26 | 29 | } |
27 | | - var c = [], |
28 | | - h = (function () { |
| 30 | + var allMembers = [], |
| 31 | + getFbDtsg = (function () { |
29 | 32 | try { |
30 | 33 | return require("DTSGInitialData").token; |
31 | 34 | } catch (b) { |
32 | 35 | var a = document.querySelector('[name="fb_dtsg"]'); |
33 | 36 | return null !== a ? a.value : null; |
34 | 37 | } |
35 | 38 | })(), |
36 | | - k = (function () { |
| 39 | + getUid = (function () { |
37 | 40 | if ("function" !== typeof require) return null; |
38 | 41 | try { |
39 | 42 | return ( |
|
44 | 47 | return null; |
45 | 48 | } |
46 | 49 | })(); |
| 50 | + |
47 | 51 | fetch( |
48 | 52 | "https://www.facebook.com/ajax/browser/list/group_confirmed_members/?gid=" + |
49 | | - encodeURIComponent(e) + |
| 53 | + encodeURIComponent(groupId) + |
50 | 54 | "&order=default&filter=unavailable_accounts&view=list&limit=500§iontype=unavailable&start=0&__a=1&fb_dtsg_ag=" + |
51 | 55 | encodeURIComponent(require("DTSGInitData").async_get_token), |
52 | 56 | { credentials: "include" } |
|
56 | 60 | }) |
57 | 61 | .then(function (a) { |
58 | 62 | for (var b = /id=\\"unavailable_([0-9]+)\\"/g, d = b.exec(a); null != d; ) |
59 | | - c.push(d[1]), (d = b.exec(a)); |
60 | | - f(); |
| 63 | + allMembers.push(d[1]), (d = b.exec(a)); |
| 64 | + |
| 65 | + console.log(allMembers); |
| 66 | + remove_unavailable_members(); |
61 | 67 | }); |
62 | | -})(YOUR_GROUP_ID); |
| 68 | +})(1154059318582088); |
0 commit comments