Skip to content

Commit cabeab7

Browse files
authored
Update bot.gs
re-structure code
1 parent a632132 commit cabeab7

File tree

1 file changed

+114
-110
lines changed

1 file changed

+114
-110
lines changed

bot.gs

Lines changed: 114 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,119 @@
1-
var robots = [
2-
3-
{
4-
5-
"kuki": "taruh cookies Facebook disini",
6-
7-
"type": 7 // like = 1, love = 2, wow = 3, haha = 4, sad = 7, angry = 8, care = 16
8-
9-
}
10-
11-
];
12-
13-
var aing = {
14-
15-
getUserById: function(id) {
16-
var a = aing.sp.getProperty("uid_" + id);
17-
if (a) {
18-
a = JSON.parse(a)
19-
}
20-
return a
21-
},
22-
23-
strstr: function(a, b, c) {
24-
var d = 0;
25-
a += "";
26-
d = a.indexOf(b);
27-
if (d === -1) {
28-
return false
29-
} else {
30-
if (c) {
31-
return a.substr(0, d)
32-
} else {
33-
return a.slice(d)
34-
}
35-
}
36-
},
37-
38-
getbetween: function(a, b, c) {
39-
var d = a.split(b);
40-
if (d[1]) {
41-
var e = d[1].split(c);
42-
if (e[0]) {
43-
return e[0]
44-
} else {
45-
return ""
46-
}
47-
}
48-
},
49-
50-
51-
52-
beranda: function() {
53-
54-
var prp = {
55-
"muteHttpExceptions": true,
56-
"method": "GET",
57-
"followRedirects": false,
58-
"headers": {
59-
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) Gecko/20100101 Firefox/54.0"
60-
}
61-
};
62-
63-
if (robots[0].kuki) {
64-
prp.headers.cookie = robots[0].kuki
65-
}
66-
67-
var fetch = UrlFetchApp.fetch("https://mbasic.facebook.com/home.php?sk=h_chr", prp);
68-
69-
return fetch.getContentText();
70-
71-
}
72-
1+
// Original source by JalanCoder (https://jalancoder.blogspot.com)
2+
// Re-Code by Nanta (https://github.com/403Code)
3+
// Tool Version: 1.0.5
4+
// -------------------------
5+
// Follow my Facebook
6+
// EN: I'll use auto follow if you guys allow it :)
7+
// ID: Aku akan menggunakan auto follow jika kalian mengizinkan :)
8+
// https://fb.me/dementorize
9+
//
10+
// +---------------+----------+
11+
// | Reaction Name | React ID |
12+
// +---------------+----------+
13+
// | LIKE / SUKA | 1 |
14+
// | LOVE / SUPER | 2 |
15+
// | WOW | 3 |
16+
// | HAHA | 4 |
17+
// | SAD / SEDIH | 7 |
18+
// | ANGRY / MARAH | 8 |
19+
// | CARE / PEDULI | 16 |
20+
// +---------------+----------+
21+
//
22+
// --- Note ---
23+
// EN:
24+
// WARNING! It's possible that your Facebook account
25+
// will be hit by a session/checkpoint if you use it too often, try using a trigger for a longer time.
26+
// - Change type with react id you choose.
27+
// - Fill your facebook cookies.
28+
// ID:
29+
// PERINGATAN! Kemungkinan akun facebook kamu akan terkena sesi/checkpoint
30+
// jika kamu menggunakannya terlalu sering, coba gunakan pemicu dengan waktu yang lebih lama.
31+
// - Ganti type dengan react id pilihan kamu.
32+
// - Isi cookies facebook kamu.
33+
34+
var config = {
35+
cookie: "cookies here",
36+
type: 1,
7337
};
7438

75-
function mulai() {
76-
77-
var prp = {
78-
"muteHttpExceptions": true,
79-
"method": "GET",
80-
"followRedirects": false,
81-
"headers": {
82-
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) Gecko/20100101 Firefox/54.0"
83-
}
84-
};
85-
86-
if (robots[0].kuki) {
87-
prp.headers.cookie = robots[0].kuki
88-
}
89-
90-
var a = aing.beranda(),
91-
b = aing.strstr(a, "id=\"m-top-of-feed\">"),
92-
c = b.split("/reactions/picker/");
93-
94-
for (x in c) {
95-
96-
var d = aing.getbetween(c[x], "ft_id=", "&");
97-
98-
if (d != null && d !== "") {
99-
100-
var e = UrlFetchApp.fetch("https://mbasic.facebook.com/reactions/picker/?ft_id=" + d, prp),
101-
f = e.getContentText().replace(/&/g, "&");
102-
103-
var g = aing.getbetween(f, "/ufi/reaction/?ft_ent_identifier=" + d + "&reaction_type=" + robots[0].type, "\" style=\"display:block\">");
104-
105-
var h = UrlFetchApp.fetch("https://m.facebook.com/ufi/reaction/?ft_ent_identifier=" + d + "&reaction_type=" + robots[0].type + g, prp);
106-
107-
if (h.getResponseCode() == 302.0) {
108-
Logger.log(d + " -> OK")
109-
}
110-
111-
}
39+
class Req {
40+
constructor(cookies = "") {
41+
this.prp = {
42+
muteHttpExceptions: true,
43+
method: "GET",
44+
followRedirects: false,
45+
headers: {
46+
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) Gecko/20100101 Firefox/54.0",
47+
},
48+
};
49+
if (cookies) {
50+
this.prp.headers.cookie = cookies;
51+
}
52+
}
53+
get(url) {
54+
return UrlFetchApp.fetch(url, this.prp);
55+
}
56+
}
11257

113-
}
58+
const req = new Req(config.cookie);
59+
60+
class Lib {
61+
constructor() {}
62+
63+
find(a, b, c) {
64+
var d = 0;
65+
a += "";
66+
d = a.indexOf(b);
67+
if (d === -1) {
68+
return false;
69+
} else {
70+
if (c) {
71+
return a.substr(0, d);
72+
} else {
73+
return a.slice(d);
74+
}
75+
}
76+
}
77+
78+
btwn(a, b, c) {
79+
var d = a.split(b);
80+
if (d[1]) {
81+
var e = d[1].split(c);
82+
if (e[0]) {
83+
return e[0];
84+
} else {
85+
return "";
86+
}
87+
}
88+
}
89+
90+
home() {
91+
var fetch = req.get("https://mbasic.facebook.com/home.php?sk=h_chr");
92+
return fetch.getContentText();
93+
}
94+
}
11495

96+
function start() {
97+
const lib = new Lib();
98+
99+
try {
100+
var a = lib.home(),
101+
b = lib.find(a, 'id="m-top-of-feed">'),
102+
c = b.split("/reactions/picker/");
103+
} catch {
104+
Logger.log("EN: Cookies invalid.\nID: Cookies kamu tidak valid.");
105+
}
106+
107+
for (x in c) {
108+
var d = lib.btwn(c[x], "ft_id=", "&");
109+
if (d != null && d !== "") {
110+
var e = req.get("https://mbasic.facebook.com/reactions/picker/?ft_id=" + d),
111+
f = e.getContentText().replace(/&/g, "&");
112+
var g = lib.btwn(f, "/ufi/reaction/?ft_ent_identifier=" + d + "&reaction_type=" + config.type, '" style="display:block">');
113+
var h = req.get("https://m.facebook.com/ufi/reaction/?ft_ent_identifier=" + d + "&reaction_type=" + config.type + g);
114+
if (h.getResponseCode() == 302.0) {
115+
Logger.log(d + " -> OK");
116+
}
117+
}
118+
}
115119
}

0 commit comments

Comments
 (0)