@irfanshadikrishad/anilist 1.3.0-forbidden.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE.md → LICENSE} +115 -124
- package/README.md +79 -53
- package/bin/helpers/auth.d.ts +13 -7
- package/bin/helpers/auth.js +282 -385
- package/bin/helpers/lists.d.ts +5 -1
- package/bin/helpers/lists.js +274 -126
- package/bin/helpers/mutations.d.ts +1 -2
- package/bin/helpers/mutations.js +1 -6
- package/bin/helpers/queries.d.ts +10 -9
- package/bin/helpers/queries.js +27 -30
- package/bin/helpers/types.d.ts +206 -36
- package/bin/helpers/validation.d.ts +29 -0
- package/bin/helpers/validation.js +117 -0
- package/bin/helpers/workers.d.ts +19 -10
- package/bin/helpers/workers.js +92 -28
- package/bin/index.js +30 -6
- package/package.json +20 -16
package/bin/helpers/auth.js
CHANGED
|
@@ -13,13 +13,15 @@ import fetch from "node-fetch";
|
|
|
13
13
|
import open from "open";
|
|
14
14
|
import os from "os";
|
|
15
15
|
import path from "path";
|
|
16
|
+
import Spinner from "tiny-spinner";
|
|
16
17
|
import { fetcher } from "./fetcher.js";
|
|
17
|
-
import { AniList, MyAnimeList } from "./lists.js";
|
|
18
|
-
import { deleteActivityMutation,
|
|
19
|
-
import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation,
|
|
20
|
-
import {
|
|
18
|
+
import { AniDB, AniList, MyAnimeList } from "./lists.js";
|
|
19
|
+
import { deleteActivityMutation, saveTextActivityMutation, } from "./mutations.js";
|
|
20
|
+
import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, toggleFollowMutation, userActivityQuery, userFollowersQuery, userFollowingQuery, } from "./queries.js";
|
|
21
|
+
import { aniListEndpoint, getTitle, redirectUri, timestampToTimeAgo, } from "./workers.js";
|
|
21
22
|
const home_dir = os.homedir();
|
|
22
23
|
const save_path = path.join(home_dir, ".anilist_token");
|
|
24
|
+
const spinner = new Spinner();
|
|
23
25
|
class Auth {
|
|
24
26
|
/**
|
|
25
27
|
* Get access-token from user
|
|
@@ -34,20 +36,29 @@ class Auth {
|
|
|
34
36
|
message: "Please enter your AniList access token:",
|
|
35
37
|
},
|
|
36
38
|
]);
|
|
39
|
+
if (!token) {
|
|
40
|
+
console.warn("\nNo token entered. Please try again.");
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
37
43
|
return token;
|
|
38
44
|
}
|
|
39
45
|
catch (error) {
|
|
40
|
-
console.error(`\
|
|
46
|
+
console.error(`\nAn error occurred while getting the access token: ${error.message}`);
|
|
47
|
+
return null;
|
|
41
48
|
}
|
|
42
49
|
});
|
|
43
50
|
}
|
|
44
51
|
static StoreAccessToken(token) {
|
|
45
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
53
|
try {
|
|
54
|
+
if (!token) {
|
|
55
|
+
console.warn("\nNo token provided. Nothing to store.");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
47
58
|
fs.writeFileSync(save_path, token, { encoding: "utf8" });
|
|
48
59
|
}
|
|
49
60
|
catch (error) {
|
|
50
|
-
console.error(`\nError storing
|
|
61
|
+
console.error(`\nError storing access token: ${error.message}`);
|
|
51
62
|
}
|
|
52
63
|
});
|
|
53
64
|
}
|
|
@@ -63,6 +74,7 @@ class Auth {
|
|
|
63
74
|
}
|
|
64
75
|
catch (error) {
|
|
65
76
|
console.error(`\nError retriving acess-token. ${error.message}`);
|
|
77
|
+
return null;
|
|
66
78
|
}
|
|
67
79
|
});
|
|
68
80
|
}
|
|
@@ -109,7 +121,7 @@ class Auth {
|
|
|
109
121
|
}
|
|
110
122
|
static Myself() {
|
|
111
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
124
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
113
125
|
try {
|
|
114
126
|
if (yield Auth.isLoggedIn()) {
|
|
115
127
|
const headers = {
|
|
@@ -130,30 +142,42 @@ class Auth {
|
|
|
130
142
|
perPage: 10,
|
|
131
143
|
});
|
|
132
144
|
const activities = (_b = (_a = activiResponse === null || activiResponse === void 0 ? void 0 : activiResponse.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.activities;
|
|
145
|
+
// Get follower/following information
|
|
146
|
+
const req_followers = yield fetcher(userFollowersQuery, {
|
|
147
|
+
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
148
|
+
});
|
|
149
|
+
const req_following = yield fetcher(userFollowingQuery, {
|
|
150
|
+
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
151
|
+
});
|
|
152
|
+
const followersCount = ((_e = (_d = (_c = req_followers === null || req_followers === void 0 ? void 0 : req_followers.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.pageInfo) === null || _e === void 0 ? void 0 : _e.total) || 0;
|
|
153
|
+
const followingCount = ((_h = (_g = (_f = req_following === null || req_following === void 0 ? void 0 : req_following.data) === null || _f === void 0 ? void 0 : _f.Page) === null || _g === void 0 ? void 0 : _g.pageInfo) === null || _h === void 0 ? void 0 : _h.total) || 0;
|
|
133
154
|
console.log(`
|
|
134
155
|
ID: ${user === null || user === void 0 ? void 0 : user.id}
|
|
135
156
|
Name: ${user === null || user === void 0 ? void 0 : user.name}
|
|
136
157
|
siteUrl: ${user === null || user === void 0 ? void 0 : user.siteUrl}
|
|
137
|
-
profileColor: ${(
|
|
138
|
-
timeZone: ${(
|
|
139
|
-
activityMergeTime: ${(
|
|
158
|
+
profileColor: ${(_j = user === null || user === void 0 ? void 0 : user.options) === null || _j === void 0 ? void 0 : _j.profileColor}
|
|
159
|
+
timeZone: ${(_k = user === null || user === void 0 ? void 0 : user.options) === null || _k === void 0 ? void 0 : _k.timezone}
|
|
160
|
+
activityMergeTime: ${(_l = user === null || user === void 0 ? void 0 : user.options) === null || _l === void 0 ? void 0 : _l.activityMergeTime}
|
|
140
161
|
donatorTier: ${user === null || user === void 0 ? void 0 : user.donatorTier}
|
|
141
162
|
donatorBadge: ${user === null || user === void 0 ? void 0 : user.donatorBadge}
|
|
142
163
|
unreadNotificationCount:${user === null || user === void 0 ? void 0 : user.unreadNotificationCount}
|
|
143
164
|
Account Created: ${new Date((user === null || user === void 0 ? void 0 : user.createdAt) * 1000).toUTCString()}
|
|
144
165
|
Account Updated: ${new Date((user === null || user === void 0 ? void 0 : user.updatedAt) * 1000).toUTCString()}
|
|
166
|
+
|
|
167
|
+
Followers: ${followersCount}
|
|
168
|
+
Following: ${followingCount}
|
|
145
169
|
|
|
146
170
|
Statistics (Anime):
|
|
147
|
-
Count: ${(
|
|
148
|
-
Mean Score: ${(
|
|
149
|
-
Minutes Watched: ${(
|
|
150
|
-
Episodes Watched: ${(
|
|
171
|
+
Count: ${(_o = (_m = user === null || user === void 0 ? void 0 : user.statistics) === null || _m === void 0 ? void 0 : _m.anime) === null || _o === void 0 ? void 0 : _o.count}
|
|
172
|
+
Mean Score: ${(_q = (_p = user === null || user === void 0 ? void 0 : user.statistics) === null || _p === void 0 ? void 0 : _p.anime) === null || _q === void 0 ? void 0 : _q.meanScore}
|
|
173
|
+
Minutes Watched: ${(_s = (_r = user === null || user === void 0 ? void 0 : user.statistics) === null || _r === void 0 ? void 0 : _r.anime) === null || _s === void 0 ? void 0 : _s.minutesWatched}
|
|
174
|
+
Episodes Watched: ${(_u = (_t = user === null || user === void 0 ? void 0 : user.statistics) === null || _t === void 0 ? void 0 : _t.anime) === null || _u === void 0 ? void 0 : _u.episodesWatched}
|
|
151
175
|
|
|
152
176
|
Statistics (Manga):
|
|
153
|
-
Count: ${(
|
|
154
|
-
Mean Score: ${(
|
|
155
|
-
Chapters Read: ${(
|
|
156
|
-
Volumes Read: ${(
|
|
177
|
+
Count: ${(_w = (_v = user === null || user === void 0 ? void 0 : user.statistics) === null || _v === void 0 ? void 0 : _v.manga) === null || _w === void 0 ? void 0 : _w.count}
|
|
178
|
+
Mean Score: ${(_y = (_x = user === null || user === void 0 ? void 0 : user.statistics) === null || _x === void 0 ? void 0 : _x.manga) === null || _y === void 0 ? void 0 : _y.meanScore}
|
|
179
|
+
Chapters Read: ${(_0 = (_z = user === null || user === void 0 ? void 0 : user.statistics) === null || _z === void 0 ? void 0 : _z.manga) === null || _0 === void 0 ? void 0 : _0.chaptersRead}
|
|
180
|
+
Volumes Read: ${(_2 = (_1 = user === null || user === void 0 ? void 0 : user.statistics) === null || _1 === void 0 ? void 0 : _1.manga) === null || _2 === void 0 ? void 0 : _2.volumesRead}
|
|
157
181
|
`);
|
|
158
182
|
console.log(`\nRecent Activities:`);
|
|
159
183
|
if (activities.length > 0) {
|
|
@@ -181,15 +205,12 @@ Statistics (Manga):
|
|
|
181
205
|
static isLoggedIn() {
|
|
182
206
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
207
|
try {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
208
|
+
const token = yield Auth.RetriveAccessToken();
|
|
209
|
+
return token !== null;
|
|
190
210
|
}
|
|
191
211
|
catch (error) {
|
|
192
|
-
console.error(
|
|
212
|
+
console.error(`Error checking login status: ${error.message}`);
|
|
213
|
+
return false;
|
|
193
214
|
}
|
|
194
215
|
});
|
|
195
216
|
}
|
|
@@ -203,15 +224,15 @@ Statistics (Manga):
|
|
|
203
224
|
console.log(`\nLogout successful. See you soon, ${username}.`);
|
|
204
225
|
}
|
|
205
226
|
catch (error) {
|
|
206
|
-
console.error("\
|
|
227
|
+
console.error("\nFailed to remove the save file during logout:", error.message);
|
|
207
228
|
}
|
|
208
229
|
}
|
|
209
230
|
else {
|
|
210
|
-
console.
|
|
231
|
+
console.warn("\nNo active session found. You may already be logged out.");
|
|
211
232
|
}
|
|
212
233
|
}
|
|
213
234
|
catch (error) {
|
|
214
|
-
console.error(`\
|
|
235
|
+
console.error(`\nAn error occurred during logout: ${error.message}`);
|
|
215
236
|
}
|
|
216
237
|
});
|
|
217
238
|
}
|
|
@@ -222,20 +243,7 @@ Statistics (Manga):
|
|
|
222
243
|
console.warn(`\nUser not logged in.`);
|
|
223
244
|
return null;
|
|
224
245
|
}
|
|
225
|
-
const
|
|
226
|
-
const request = yield fetch(aniListEndpoint, {
|
|
227
|
-
method: "POST",
|
|
228
|
-
headers: {
|
|
229
|
-
"Content-Type": "application/json",
|
|
230
|
-
"Authorization": `Bearer ${token}`,
|
|
231
|
-
},
|
|
232
|
-
body: JSON.stringify({ query: currentUserQuery }),
|
|
233
|
-
});
|
|
234
|
-
if (!(request.status === 200)) {
|
|
235
|
-
console.error(`Failed to fetch user data. Status: ${request.status}`);
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
const { data } = yield request.json();
|
|
246
|
+
const { data } = yield fetcher(currentUserQuery, {});
|
|
239
247
|
return (_b = (_a = data === null || data === void 0 ? void 0 : data.Viewer) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
|
|
240
248
|
});
|
|
241
249
|
}
|
|
@@ -246,20 +254,7 @@ Statistics (Manga):
|
|
|
246
254
|
console.log(`\nUser not logged in.`);
|
|
247
255
|
return null;
|
|
248
256
|
}
|
|
249
|
-
const
|
|
250
|
-
const request = yield fetch(aniListEndpoint, {
|
|
251
|
-
method: "POST",
|
|
252
|
-
headers: {
|
|
253
|
-
"Content-Type": "application/json",
|
|
254
|
-
"Authorization": `Bearer ${token}`,
|
|
255
|
-
},
|
|
256
|
-
body: JSON.stringify({ query: currentUserQuery }),
|
|
257
|
-
});
|
|
258
|
-
if (!request.ok) {
|
|
259
|
-
console.error(`Failed to fetch user data. Status: ${request.status}`);
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
const { data } = yield request.json();
|
|
257
|
+
const { data } = yield fetcher(currentUserQuery, {});
|
|
263
258
|
return (_b = (_a = data === null || data === void 0 ? void 0 : data.Viewer) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : null;
|
|
264
259
|
});
|
|
265
260
|
}
|
|
@@ -267,72 +262,70 @@ Statistics (Manga):
|
|
|
267
262
|
return __awaiter(this, void 0, void 0, function* () {
|
|
268
263
|
var _a, _b, _c, _d, _e, _f;
|
|
269
264
|
try {
|
|
270
|
-
if (yield Auth.isLoggedIn()) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
// Ensure ID is present to avoid unintended errors
|
|
313
|
-
if (act === null || act === void 0 ? void 0 : act.id) {
|
|
314
|
-
const deleteResponse = yield fetcher(deleteActivityMutation, {
|
|
315
|
-
id: act === null || act === void 0 ? void 0 : act.id,
|
|
316
|
-
});
|
|
317
|
-
const isDeleted = (_f = (_e = deleteResponse === null || deleteResponse === void 0 ? void 0 : deleteResponse.data) === null || _e === void 0 ? void 0 : _e.DeleteActivity) === null || _f === void 0 ? void 0 : _f.deleted;
|
|
318
|
-
count++;
|
|
319
|
-
totalCount++;
|
|
320
|
-
console.log(`[${count}/${activities.length}/${totalCount}]\t${act === null || act === void 0 ? void 0 : act.id} ${isDeleted ? "✅" : "❌"}`);
|
|
321
|
-
// Avoiding rate-limit
|
|
322
|
-
yield new Promise((resolve) => setTimeout(resolve, 1100));
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
265
|
+
if (!(yield Auth.isLoggedIn())) {
|
|
266
|
+
console.error(`\nPlease log in to delete your activities.`);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const { activityType } = yield inquirer.prompt([
|
|
270
|
+
{
|
|
271
|
+
type: "list",
|
|
272
|
+
name: "activityType",
|
|
273
|
+
message: "What type of activity you want to delete?",
|
|
274
|
+
choices: [
|
|
275
|
+
{ name: "All Activity", value: 0 },
|
|
276
|
+
{ name: "Text Activity", value: 1 },
|
|
277
|
+
{ name: "Media List Activity", value: 2 },
|
|
278
|
+
{ name: "Anime List Activity", value: 3 },
|
|
279
|
+
{ name: "Manga List Activity", value: 4 },
|
|
280
|
+
{ name: "Message Activity", value: 5 },
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
]);
|
|
284
|
+
const queryMap = {
|
|
285
|
+
0: activityAllQuery,
|
|
286
|
+
1: activityTextQuery,
|
|
287
|
+
2: activityMediaList,
|
|
288
|
+
3: activityAnimeListQuery,
|
|
289
|
+
4: activityMangaListQuery,
|
|
290
|
+
5: activityMessageQuery,
|
|
291
|
+
};
|
|
292
|
+
const query = queryMap[activityType];
|
|
293
|
+
let hasMoreActivities = true;
|
|
294
|
+
let totalCount = 0;
|
|
295
|
+
while (hasMoreActivities) {
|
|
296
|
+
const response = yield fetcher(query, {
|
|
297
|
+
page: 1,
|
|
298
|
+
perPage: 50,
|
|
299
|
+
userId: yield Auth.MyUserId(),
|
|
300
|
+
});
|
|
301
|
+
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.activities) {
|
|
302
|
+
let count = 0;
|
|
303
|
+
const activities = (_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.activities;
|
|
304
|
+
if (!activities || activities.length === 0) {
|
|
305
|
+
console.log(`\nNo more activities available.`);
|
|
306
|
+
hasMoreActivities = false;
|
|
326
307
|
}
|
|
327
308
|
else {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
309
|
+
for (const act of activities) {
|
|
310
|
+
if (act === null || act === void 0 ? void 0 : act.id) {
|
|
311
|
+
const deleteResponse = yield fetcher(deleteActivityMutation, {
|
|
312
|
+
id: act === null || act === void 0 ? void 0 : act.id,
|
|
313
|
+
});
|
|
314
|
+
const isDeleted = (_f = (_e = deleteResponse === null || deleteResponse === void 0 ? void 0 : deleteResponse.data) === null || _e === void 0 ? void 0 : _e.DeleteActivity) === null || _f === void 0 ? void 0 : _f.deleted;
|
|
315
|
+
count++;
|
|
316
|
+
totalCount++;
|
|
317
|
+
console.log(`[${count}/${activities.length}/${totalCount}]\t${act === null || act === void 0 ? void 0 : act.id} ${isDeleted ? "✅" : "❌"}`);
|
|
318
|
+
// Avoiding rate-limit
|
|
319
|
+
yield new Promise((resolve) => setTimeout(resolve, 1100));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
331
322
|
}
|
|
332
323
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
324
|
+
else {
|
|
325
|
+
// In case of an unexpected null response, exit the loop
|
|
326
|
+
console.log(`\nProbably deleted all the activities of this type.`);
|
|
327
|
+
hasMoreActivities = false;
|
|
328
|
+
}
|
|
336
329
|
}
|
|
337
330
|
}
|
|
338
331
|
catch (error) {
|
|
@@ -343,54 +336,51 @@ Statistics (Manga):
|
|
|
343
336
|
static DeleteMyAnimeList() {
|
|
344
337
|
return __awaiter(this, void 0, void 0, function* () {
|
|
345
338
|
var _a, _b, _c, _d;
|
|
346
|
-
if (yield Auth.isLoggedIn()) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
339
|
+
if (!(yield Auth.isLoggedIn())) {
|
|
340
|
+
console.error(`\nPlease log in first to delete your lists.`);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (!(yield Auth.MyUserId())) {
|
|
344
|
+
console.log(`\nFailed getting current user Id.`);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const response = yield fetcher(currentUserAnimeList, { id: yield Auth.MyUserId() });
|
|
348
|
+
if (response !== null) {
|
|
349
|
+
const lists = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.MediaListCollection) === null || _b === void 0 ? void 0 : _b.lists;
|
|
350
|
+
if (lists.length > 0) {
|
|
351
|
+
const { selectedList } = yield inquirer.prompt([
|
|
352
|
+
{
|
|
353
|
+
type: "list",
|
|
354
|
+
name: "selectedList",
|
|
355
|
+
message: "Select an anime list:",
|
|
356
|
+
choices: lists.map((list) => list.name),
|
|
357
|
+
pageSize: 10,
|
|
358
|
+
},
|
|
359
|
+
]);
|
|
360
|
+
const selectedEntries = lists.find((list) => list.name === selectedList);
|
|
361
|
+
if (selectedEntries) {
|
|
362
|
+
console.log(`\nDeleting entries of '${selectedEntries.name}':`);
|
|
363
|
+
for (const [, entry] of selectedEntries.entries.entries()) {
|
|
364
|
+
if (entry === null || entry === void 0 ? void 0 : entry.id) {
|
|
365
|
+
yield Auth.DeleteAnimeById(entry === null || entry === void 0 ? void 0 : entry.id, (_c = entry === null || entry === void 0 ? void 0 : entry.media) === null || _c === void 0 ? void 0 : _c.title);
|
|
366
|
+
yield new Promise((resolve) => setTimeout(resolve, 1100));
|
|
375
367
|
}
|
|
376
368
|
else {
|
|
377
|
-
console.log(
|
|
369
|
+
console.log(`No id in entry.`);
|
|
370
|
+
console.log(entry);
|
|
378
371
|
}
|
|
379
372
|
}
|
|
380
|
-
else {
|
|
381
|
-
console.log(`\nNo anime(s) found in any list.`);
|
|
382
|
-
}
|
|
383
373
|
}
|
|
384
374
|
else {
|
|
385
|
-
console.log(
|
|
375
|
+
console.log("No entries found.");
|
|
386
376
|
}
|
|
387
377
|
}
|
|
388
378
|
else {
|
|
389
|
-
console.log(`\
|
|
379
|
+
console.log(`\nNo anime(s) found in any list.`);
|
|
390
380
|
}
|
|
391
381
|
}
|
|
392
382
|
else {
|
|
393
|
-
console.
|
|
383
|
+
console.log(`\nSomething went wrong. ${(_d = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _d === void 0 ? void 0 : _d.message}`);
|
|
394
384
|
}
|
|
395
385
|
});
|
|
396
386
|
}
|
|
@@ -417,54 +407,50 @@ Statistics (Manga):
|
|
|
417
407
|
return __awaiter(this, void 0, void 0, function* () {
|
|
418
408
|
var _a, _b, _c, _d;
|
|
419
409
|
try {
|
|
420
|
-
if (yield Auth.isLoggedIn()) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
console.error("\nNo entries found.");
|
|
452
|
-
}
|
|
410
|
+
if (!(yield Auth.isLoggedIn())) {
|
|
411
|
+
console.error(`\nPlease log in first to delete your lists.`);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
if (!(yield Auth.MyUserId())) {
|
|
415
|
+
console.error(`\nFailed getting current user Id.`);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const response = yield fetcher(currentUserMangaList, { id: yield Auth.MyUserId() });
|
|
419
|
+
if (!(response === null || response === void 0 ? void 0 : response.data)) {
|
|
420
|
+
console.error(`\nSomething went wrong. ${(_a = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const lists = (_c = (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.MediaListCollection) === null || _c === void 0 ? void 0 : _c.lists;
|
|
424
|
+
if (lists.length > 0) {
|
|
425
|
+
const { selectedList } = yield inquirer.prompt([
|
|
426
|
+
{
|
|
427
|
+
type: "list",
|
|
428
|
+
name: "selectedList",
|
|
429
|
+
message: "Select a manga list:",
|
|
430
|
+
choices: lists.map((list) => list.name),
|
|
431
|
+
pageSize: 10,
|
|
432
|
+
},
|
|
433
|
+
]);
|
|
434
|
+
const selectedEntries = lists.find((list) => list.name === selectedList);
|
|
435
|
+
if (selectedEntries) {
|
|
436
|
+
console.log(`\nDeleting entries of '${selectedEntries.name}':`);
|
|
437
|
+
for (const [, entry] of selectedEntries.entries.entries()) {
|
|
438
|
+
if (entry === null || entry === void 0 ? void 0 : entry.id) {
|
|
439
|
+
yield Auth.DeleteMangaById(entry === null || entry === void 0 ? void 0 : entry.id, (_d = entry === null || entry === void 0 ? void 0 : entry.media) === null || _d === void 0 ? void 0 : _d.title);
|
|
440
|
+
yield new Promise((resolve) => setTimeout(resolve, 1100));
|
|
453
441
|
}
|
|
454
442
|
else {
|
|
455
|
-
console.
|
|
443
|
+
console.log(`No id in entry.`);
|
|
444
|
+
console.log(entry);
|
|
456
445
|
}
|
|
457
446
|
}
|
|
458
|
-
else {
|
|
459
|
-
console.error(`\nSomething went wrong. ${(_d = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _d === void 0 ? void 0 : _d.message}`);
|
|
460
|
-
}
|
|
461
447
|
}
|
|
462
448
|
else {
|
|
463
|
-
console.error(
|
|
449
|
+
console.error("\nNo entries found.");
|
|
464
450
|
}
|
|
465
451
|
}
|
|
466
452
|
else {
|
|
467
|
-
console.error(`\
|
|
453
|
+
console.error(`\nNo manga(s) found in any list.`);
|
|
468
454
|
}
|
|
469
455
|
}
|
|
470
456
|
catch (error) {
|
|
@@ -493,23 +479,20 @@ Statistics (Manga):
|
|
|
493
479
|
}
|
|
494
480
|
static Write(status) {
|
|
495
481
|
return __awaiter(this, void 0, void 0, function* () {
|
|
496
|
-
var _a;
|
|
497
482
|
try {
|
|
498
483
|
if (!(yield Auth.isLoggedIn())) {
|
|
499
484
|
console.error(`\nPlease login to use this feature.`);
|
|
500
485
|
return;
|
|
501
486
|
}
|
|
502
|
-
const data = yield fetcher(saveTextActivityMutation, {
|
|
503
|
-
status: status
|
|
504
|
-
`<br><br><br><br>*Written using [@irfanshadikrishad/anilist](https://www.npmjs.com/package/@irfanshadikrishad/anilist).*`,
|
|
487
|
+
const { data } = yield fetcher(saveTextActivityMutation, {
|
|
488
|
+
status: status,
|
|
505
489
|
});
|
|
506
490
|
if (!data) {
|
|
507
491
|
console.error(`\nSomething went wrong. ${data}.`);
|
|
508
492
|
return;
|
|
509
493
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
console.log(`\n[${savedActivity.id}] status saved successfully!`);
|
|
494
|
+
if (data.SaveTextActivity.id) {
|
|
495
|
+
console.log(`\n[${data.SaveTextActivity.id}] status saved successfully!`);
|
|
513
496
|
}
|
|
514
497
|
}
|
|
515
498
|
catch (error) {
|
|
@@ -528,6 +511,7 @@ Statistics (Manga):
|
|
|
528
511
|
choices: [
|
|
529
512
|
{ name: "Exported JSON file.", value: 1 },
|
|
530
513
|
{ name: "MyAnimeList (XML)", value: 2 },
|
|
514
|
+
{ name: "AniDB (json-large)", value: 3 },
|
|
531
515
|
],
|
|
532
516
|
pageSize: 10,
|
|
533
517
|
},
|
|
@@ -539,6 +523,9 @@ Statistics (Manga):
|
|
|
539
523
|
case 2:
|
|
540
524
|
yield MyAnimeList.importAnime();
|
|
541
525
|
break;
|
|
526
|
+
case 3:
|
|
527
|
+
yield AniDB.importAnime();
|
|
528
|
+
break;
|
|
542
529
|
default:
|
|
543
530
|
console.log(`\nInvalid Choice.`);
|
|
544
531
|
break;
|
|
@@ -581,215 +568,125 @@ Statistics (Manga):
|
|
|
581
568
|
}
|
|
582
569
|
});
|
|
583
570
|
}
|
|
584
|
-
|
|
571
|
+
}
|
|
572
|
+
class Social {
|
|
573
|
+
/**
|
|
574
|
+
* Follow the users that follows you
|
|
575
|
+
*/
|
|
576
|
+
static follow() {
|
|
585
577
|
return __awaiter(this, void 0, void 0, function* () {
|
|
586
|
-
var _a, _b, _c, _d;
|
|
578
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
587
579
|
try {
|
|
588
|
-
let
|
|
589
|
-
let
|
|
590
|
-
let
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
580
|
+
let pager = 1;
|
|
581
|
+
let hasNextPage = true;
|
|
582
|
+
let allFollowerUsers = [];
|
|
583
|
+
let followedBack = 0;
|
|
584
|
+
spinner.start("Fetching all the followers...");
|
|
585
|
+
while (hasNextPage) {
|
|
586
|
+
const followerUsers = yield fetcher(userFollowersQuery, {
|
|
587
|
+
userId: yield Auth.MyUserId(),
|
|
588
|
+
page: pager,
|
|
596
589
|
});
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
for (let activ of activiti) {
|
|
601
|
-
if (!activ.isLiked && activ.id) {
|
|
602
|
-
try {
|
|
603
|
-
const like = yield fetcher(likeActivityMutation, {
|
|
604
|
-
activityId: activ.id,
|
|
605
|
-
});
|
|
606
|
-
console.info(`${activityBy(activ)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
|
|
607
|
-
}
|
|
608
|
-
catch (error) {
|
|
609
|
-
console.error(`Activity possibly deleted. ${error.message}`);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
console.log(`${activityBy(activ)} 🔵`);
|
|
614
|
-
}
|
|
615
|
-
// avoiding rate-limit
|
|
616
|
-
yield new Promise((resolve) => {
|
|
617
|
-
setTimeout(resolve, 2000);
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
page++;
|
|
621
|
-
}
|
|
622
|
-
else {
|
|
623
|
-
if (retryCount < maxRetries) {
|
|
624
|
-
retryCount++;
|
|
625
|
-
console.warn(`Empty activities returned. Retrying... (${retryCount}/${maxRetries})`);
|
|
626
|
-
yield new Promise((resolve) => setTimeout(resolve, 3000));
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
console.log(`\nProbably the end of activities after ${maxRetries} retries.`);
|
|
630
|
-
console.info(activities);
|
|
631
|
-
hasMoreActivities = false;
|
|
632
|
-
}
|
|
590
|
+
spinner.update(`Fetched page ${pager} of ${(_c = (_b = (_a = followerUsers === null || followerUsers === void 0 ? void 0 : followerUsers.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.pageInfo) === null || _c === void 0 ? void 0 : _c.lastPage}...`);
|
|
591
|
+
if (!((_f = (_e = (_d = followerUsers === null || followerUsers === void 0 ? void 0 : followerUsers.data) === null || _d === void 0 ? void 0 : _d.Page) === null || _e === void 0 ? void 0 : _e.pageInfo) === null || _f === void 0 ? void 0 : _f.hasNextPage)) {
|
|
592
|
+
hasNextPage = false;
|
|
633
593
|
}
|
|
594
|
+
allFollowerUsers.push(...(((_h = (_g = followerUsers === null || followerUsers === void 0 ? void 0 : followerUsers.data) === null || _g === void 0 ? void 0 : _g.Page) === null || _h === void 0 ? void 0 : _h.followers) || []));
|
|
595
|
+
pager++;
|
|
634
596
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
if (activities && ((_b = (_a = activities === null || activities === void 0 ? void 0 : activities.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.activities.length) > 0) {
|
|
658
|
-
const activiti = (_d = (_c = activities === null || activities === void 0 ? void 0 : activities.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.activities;
|
|
659
|
-
for (let activ of activiti) {
|
|
660
|
-
if (!activ.isLiked && activ.id) {
|
|
661
|
-
try {
|
|
662
|
-
const like = yield fetcher(likeActivityMutation, {
|
|
663
|
-
activityId: activ.id,
|
|
664
|
-
});
|
|
665
|
-
// const ToggleLike = like?.data?.ToggleLike
|
|
666
|
-
console.info(`${activityBy(activ)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
|
|
667
|
-
}
|
|
668
|
-
catch (error) {
|
|
669
|
-
console.error(`Activity possibly deleted. ${error.message}`);
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
673
|
-
console.log(`${activityBy(activ)} 🔵`);
|
|
674
|
-
}
|
|
675
|
-
// avoiding rate-limit
|
|
676
|
-
yield new Promise((resolve) => {
|
|
677
|
-
setTimeout(resolve, 1500);
|
|
678
|
-
});
|
|
597
|
+
spinner.stop("Fetched all the followers. Starting follow back.");
|
|
598
|
+
// Filter users that do no follow me
|
|
599
|
+
const notFollowing = allFollowerUsers
|
|
600
|
+
.filter(({ isFollowing }) => !isFollowing)
|
|
601
|
+
.map(({ id, name }) => ({ id: id, name: name }));
|
|
602
|
+
console.log(`\nTotal follower ${allFollowerUsers.length}.\nNot followed back ${notFollowing.length}\n`);
|
|
603
|
+
if (notFollowing.length <= 0) {
|
|
604
|
+
console.log(`Probably followed back all the users.`);
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
// Traverse and follow back
|
|
608
|
+
const maxIdLength = Math.max(...notFollowing.map(({ id }) => String(id).length));
|
|
609
|
+
const maxNameLength = Math.max(...notFollowing.map(({ name }) => name.length));
|
|
610
|
+
for (let nf of notFollowing) {
|
|
611
|
+
try {
|
|
612
|
+
const follow = yield fetcher(toggleFollowMutation, { userId: nf.id });
|
|
613
|
+
console.log(`${String(`[${nf.id}]`).padEnd(maxIdLength)}` +
|
|
614
|
+
`\t${String(`[${(_k = (_j = follow === null || follow === void 0 ? void 0 : follow.data) === null || _j === void 0 ? void 0 : _j.ToggleFollow) === null || _k === void 0 ? void 0 : _k.name}]`).padEnd(maxNameLength)}` +
|
|
615
|
+
`\t${((_m = (_l = follow === null || follow === void 0 ? void 0 : follow.data) === null || _l === void 0 ? void 0 : _l.ToggleFollow) === null || _m === void 0 ? void 0 : _m.id) ? "✅" : "🈵"}`);
|
|
616
|
+
// Count the followed back users
|
|
617
|
+
if ((_p = (_o = follow === null || follow === void 0 ? void 0 : follow.data) === null || _o === void 0 ? void 0 : _o.ToggleFollow) === null || _p === void 0 ? void 0 : _p.id) {
|
|
618
|
+
followedBack++;
|
|
679
619
|
}
|
|
680
|
-
page++;
|
|
681
620
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
console.log(`\nProbably the end of activities.`);
|
|
685
|
-
console.info(activities);
|
|
686
|
-
hasMoreActivities = false;
|
|
621
|
+
catch (error) {
|
|
622
|
+
console.log(`automate_follow_toggle_follow: ${error.message}`);
|
|
687
623
|
}
|
|
688
624
|
}
|
|
625
|
+
console.log(`\n✅ Followed back ${followedBack} users.`);
|
|
689
626
|
}
|
|
690
627
|
catch (error) {
|
|
691
|
-
console.
|
|
628
|
+
console.log(`\nautomate_follow ${error.message}`);
|
|
692
629
|
}
|
|
693
630
|
});
|
|
694
631
|
}
|
|
695
|
-
|
|
632
|
+
/**
|
|
633
|
+
* Unfollow the users thats not following you
|
|
634
|
+
*/
|
|
635
|
+
static unfollow() {
|
|
696
636
|
return __awaiter(this, void 0, void 0, function* () {
|
|
697
|
-
var _a, _b, _c, _d;
|
|
637
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
698
638
|
try {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
while (true) {
|
|
713
|
-
const activities = yield fetcher(specificUserActivitiesQuery, {
|
|
714
|
-
page,
|
|
715
|
-
perPage,
|
|
716
|
-
userId,
|
|
717
|
-
});
|
|
718
|
-
const activiti = (_d = (_c = activities === null || activities === void 0 ? void 0 : activities.data) === null || _c === void 0 ? void 0 : _c.Page) === null || _d === void 0 ? void 0 : _d.activities;
|
|
719
|
-
// Break the loop if no more activities are found
|
|
720
|
-
if (!activiti || activiti.length === 0) {
|
|
721
|
-
console.log("No more activities found.");
|
|
722
|
-
break;
|
|
723
|
-
}
|
|
724
|
-
for (let activ of activiti) {
|
|
725
|
-
if (!activ.isLiked && activ.id) {
|
|
726
|
-
try {
|
|
727
|
-
const like = yield fetcher(likeActivityMutation, {
|
|
728
|
-
activityId: activ.id,
|
|
729
|
-
});
|
|
730
|
-
console.info(`${activityBy(activ)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
|
|
731
|
-
}
|
|
732
|
-
catch (error) {
|
|
733
|
-
console.error(`Activity possibly deleted. ${error.message}`);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
else {
|
|
737
|
-
console.log(`${activityBy(activ)} 🔵`);
|
|
738
|
-
}
|
|
739
|
-
// Avoiding rate limit
|
|
740
|
-
yield new Promise((resolve) => {
|
|
741
|
-
setTimeout(resolve, 1500);
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
// Go to the next page
|
|
745
|
-
page += 1;
|
|
746
|
-
}
|
|
639
|
+
let pager = 1;
|
|
640
|
+
let hasNextPage = true;
|
|
641
|
+
let allFollowingUsers = [];
|
|
642
|
+
let unfollowedUsers = 0;
|
|
643
|
+
spinner.start("Fetching all following users...");
|
|
644
|
+
while (hasNextPage) {
|
|
645
|
+
const followingUsers = yield fetcher(userFollowingQuery, {
|
|
646
|
+
userId: yield Auth.MyUserId(),
|
|
647
|
+
page: pager,
|
|
648
|
+
});
|
|
649
|
+
spinner.update(`Fetched page ${pager} of ${(_c = (_b = (_a = followingUsers === null || followingUsers === void 0 ? void 0 : followingUsers.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.pageInfo) === null || _c === void 0 ? void 0 : _c.lastPage}...`);
|
|
650
|
+
if (!((_f = (_e = (_d = followingUsers === null || followingUsers === void 0 ? void 0 : followingUsers.data) === null || _d === void 0 ? void 0 : _d.Page) === null || _e === void 0 ? void 0 : _e.pageInfo) === null || _f === void 0 ? void 0 : _f.hasNextPage)) {
|
|
651
|
+
hasNextPage = false;
|
|
747
652
|
}
|
|
653
|
+
allFollowingUsers.push(...(((_h = (_g = followingUsers === null || followingUsers === void 0 ? void 0 : followingUsers.data) === null || _g === void 0 ? void 0 : _g.Page) === null || _h === void 0 ? void 0 : _h.following) || []));
|
|
654
|
+
pager++;
|
|
748
655
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
757
|
-
try {
|
|
758
|
-
if (!(yield Auth.isLoggedIn())) {
|
|
759
|
-
console.error(`\nPlease login to use this feature.`);
|
|
656
|
+
spinner.update(`Fetching complete. Total got ${allFollowingUsers.length} users.`);
|
|
657
|
+
// Filter users that do no follow me
|
|
658
|
+
const notFollowingMe = allFollowingUsers
|
|
659
|
+
.filter((user) => !user.isFollower)
|
|
660
|
+
.map((u3r) => ({ id: u3r.id, name: u3r.name }));
|
|
661
|
+
if (notFollowingMe.length <= 0) {
|
|
662
|
+
spinner.stop(`No users to unfollow. Exiting operation...`);
|
|
760
663
|
return;
|
|
761
664
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
]
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
yield this.Like(1);
|
|
781
|
-
break;
|
|
782
|
-
case 3:
|
|
783
|
-
yield this.LikeSpecificUser();
|
|
784
|
-
break;
|
|
785
|
-
default:
|
|
786
|
-
console.error(`\nInvalid choice. (${activityType})`);
|
|
665
|
+
spinner.stop(`Unfollow process activated with ${notFollowingMe.length} users.`);
|
|
666
|
+
let nfmCount = 0;
|
|
667
|
+
console.log(`\n`);
|
|
668
|
+
for (let nfm of notFollowingMe) {
|
|
669
|
+
nfmCount++;
|
|
670
|
+
try {
|
|
671
|
+
const unfollow = yield fetcher(toggleFollowMutation, {
|
|
672
|
+
userId: nfm.id,
|
|
673
|
+
});
|
|
674
|
+
console.log(`[${nfm.id}]\t[${(_k = (_j = unfollow === null || unfollow === void 0 ? void 0 : unfollow.data) === null || _j === void 0 ? void 0 : _j.ToggleFollow) === null || _k === void 0 ? void 0 : _k.name}]\t${((_m = (_l = unfollow === null || unfollow === void 0 ? void 0 : unfollow.data) === null || _l === void 0 ? void 0 : _l.ToggleFollow) === null || _m === void 0 ? void 0 : _m.id) ? "✅" : "🈵"}`);
|
|
675
|
+
// Count the unfollowed users
|
|
676
|
+
if ((_p = (_o = unfollow === null || unfollow === void 0 ? void 0 : unfollow.data) === null || _o === void 0 ? void 0 : _o.ToggleFollow) === null || _p === void 0 ? void 0 : _p.id) {
|
|
677
|
+
unfollowedUsers++;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
catch (error) {
|
|
681
|
+
console.log(`unfollow_toggle_follow. ${error.message}`);
|
|
682
|
+
}
|
|
787
683
|
}
|
|
684
|
+
console.log(`\nTotal Unfollowed: ${unfollowedUsers} of ${nfmCount} users.`);
|
|
788
685
|
}
|
|
789
686
|
catch (error) {
|
|
790
|
-
console.error(`\
|
|
687
|
+
console.error(`\nautomate_unfollow: ${error.message}`);
|
|
791
688
|
}
|
|
792
689
|
});
|
|
793
690
|
}
|
|
794
691
|
}
|
|
795
|
-
export { Auth };
|
|
692
|
+
export { Auth, Social };
|