@irfanshadikrishad/anilist 3.0.1-forbidden.0 → 3.1.0-forbidden.0
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/README.md +20 -12
- package/bin/helpers/auth.d.ts +1 -1
- package/bin/helpers/auth.js +50 -30
- package/bin/helpers/lib/colorize.d.ts +1 -0
- package/bin/helpers/lib/colorize.js +3 -0
- package/bin/helpers/workers.js +4 -3
- package/bin/index.js +4 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#### @irfanshadikrishad/anilist
|
|
2
2
|
|
|
3
|
-
Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts.
|
|
3
|
+
Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts. With features like sync or shift lists from other tracking platforms like MyAnimeList/AniDB, Unfollow users who doesn't follow you back, etc.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|

|
|
@@ -20,7 +20,7 @@ If you see the version then its installed. Otherwise install nodejs and npm shou
|
|
|
20
20
|
Then install the package by running
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npm install -g @irfanshadikrishad/anilist
|
|
23
|
+
npm install -g @irfanshadikrishad/anilist
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
This will install the package globally. And you have to use commands like
|
|
@@ -64,6 +64,7 @@ anilist login -i <client-id> -s <client-secret>
|
|
|
64
64
|
| `export` <br> _(alias: `exp`)_ | `-a, --anime` <br> `-m, --manga` | Export anime or manga list in JSON, CSV or XML (MyAnimeList/AniDB) |
|
|
65
65
|
| `import` <br> _(alias: `imp`)_ | `-a, --anime` <br> `-m, --manga` | Import anime or manga list from exported JSON, MyAnimeList (XML) or AniDB (json-large) |
|
|
66
66
|
| `social` <br> _(alias: `sol`)_ | `-f, --follow` <br> `-u, --unfollow` <br> `-i, --inactive <months>` | Follow users who follows you, unfollow who doesn't follow you back, or unfollow stale/inactive accounts |
|
|
67
|
+
| `autolike` <br> _(alias: `al`)_ | _None_ | Auto-Like features |
|
|
67
68
|
|
|
68
69
|
#### Command Breakdown:
|
|
69
70
|
|
|
@@ -260,21 +261,28 @@ anilist sol -i 6
|
|
|
260
261
|
- `-i, --inactive <months>`: To unfollow users you follow who haven't posted any activity in the given number of months, to help clear out stale/inactive accounts.
|
|
261
262
|
- Description: It follows users who follows you, unfollows users who doesn't follow you back, or unfollows stale accounts with no recent activity, all at ease.
|
|
262
263
|
|
|
264
|
+
#### `autolike` _(alias: `al`)_:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
anilist al
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
anilist al -o 1 -c 15
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
- Options:
|
|
275
|
+
- Selectable options (Following • v1 | Following • v2 | Global | Specific User), or
|
|
276
|
+
- `-c, --count <number>`: How many likes to give
|
|
277
|
+
- `-o, --option <number>`: Option as number (asc)
|
|
278
|
+
- Description: Gives likes automatically based on mode.
|
|
279
|
+
|
|
263
280
|
#### Security
|
|
264
281
|
|
|
265
|
-
Since you are creating your own API client for login no
|
|
282
|
+
Since you are creating your own API client for login no one else can get your credentials and the generated access token will be stored in your own system. So, As long as you don't share your device (in case you do, just logout) you are safe.
|
|
266
283
|
|
|
267
284
|
#### Contribution
|
|
268
285
|
|
|
269
286
|
Want to contribute to the project? Check out complete guideline [here](CONTRIBUTING.md).
|
|
270
287
|
|
|
271
|
-
#### Publish
|
|
272
|
-
|
|
273
|
-
• Bump the version (since you have real changes since 2.0.0-forbidden was published, you can't republish that exact version):
|
|
274
|
-
`npm version prerelease --preid=forbidden --no-git-tag-version`
|
|
275
|
-
This takes 2.0.0-forbidden → 2.0.0-forbidden.0, matching the pattern of past releases (1.1.0-forbidden.0, .7, etc.).
|
|
276
|
-
• Build: `npm run build`
|
|
277
|
-
• Publish under the forbidden tag, not latest:
|
|
278
|
-
`npm publish --tag forbidden`
|
|
279
|
-
|
|
280
288
|
#### _Thanks for visiting 💙_
|
package/bin/helpers/auth.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare class Auth {
|
|
|
31
31
|
private static LikeGlobal;
|
|
32
32
|
private static LikeSpecificUser;
|
|
33
33
|
static LikeFollowingActivityV2(perPage: number): Promise<void>;
|
|
34
|
-
static AutoLike(): Promise<void>;
|
|
34
|
+
static AutoLike(option: number, passed_count: number): Promise<void>;
|
|
35
35
|
}
|
|
36
36
|
declare class Social {
|
|
37
37
|
/**
|
package/bin/helpers/auth.js
CHANGED
|
@@ -547,15 +547,19 @@ class Auth {
|
|
|
547
547
|
}
|
|
548
548
|
});
|
|
549
549
|
}
|
|
550
|
-
static LikeGlobal() {
|
|
550
|
+
static LikeGlobal(count) {
|
|
551
551
|
return __awaiter(this, void 0, void 0, function* () {
|
|
552
552
|
var _a, _b, _c, _d, _e, _f;
|
|
553
|
+
const MAX_GLOBAL_LIKES = 999;
|
|
554
|
+
const normalized = Number.isFinite(count) ? Math.floor(count) : 0;
|
|
555
|
+
const limit = normalized > 0 ? normalized : MAX_GLOBAL_LIKES;
|
|
553
556
|
try {
|
|
554
557
|
let page = 1;
|
|
555
558
|
let hasMoreActivities = true;
|
|
556
559
|
let likedCount = 0;
|
|
560
|
+
let successCount = 0;
|
|
557
561
|
spinner.start(`Getting global activities...`);
|
|
558
|
-
while (hasMoreActivities) {
|
|
562
|
+
while (hasMoreActivities && successCount < limit) {
|
|
559
563
|
const activities = yield fetcher(globalActivitiesQuery, {
|
|
560
564
|
page,
|
|
561
565
|
perPage: 50,
|
|
@@ -564,25 +568,33 @@ class Auth {
|
|
|
564
568
|
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;
|
|
565
569
|
spinner.success(`Got ${activiti.length} activities...`);
|
|
566
570
|
for (let activ of activiti) {
|
|
571
|
+
// Stop as soon as the limit is reached
|
|
572
|
+
if (successCount >= limit)
|
|
573
|
+
break;
|
|
567
574
|
const result = yield Auth.attemptLikeActivity(activ);
|
|
568
575
|
if (result === 'liked' || result === 'failed') {
|
|
569
576
|
likedCount++;
|
|
577
|
+
if (result === 'liked')
|
|
578
|
+
successCount++;
|
|
570
579
|
responsiveOutput(`${result === 'liked' ? symbol_done : symbol_fail} ${activityBy(activ, likedCount)}`);
|
|
571
580
|
}
|
|
572
581
|
else if (result === 'skipped') {
|
|
573
582
|
responsiveOutput(`${symbol_neutral} ${activityBy(activ, likedCount)}`);
|
|
574
583
|
}
|
|
575
|
-
|
|
584
|
+
if (successCount >= limit)
|
|
585
|
+
break;
|
|
576
586
|
yield sleep(rate_limit_time_ms);
|
|
577
587
|
}
|
|
578
588
|
page++;
|
|
579
589
|
}
|
|
580
590
|
else {
|
|
581
|
-
// No more activities to like
|
|
582
591
|
spinner.error(`Probably the end of activities. ${(_f = (_e = activities === null || activities === void 0 ? void 0 : activities.data) === null || _e === void 0 ? void 0 : _e.Page) === null || _f === void 0 ? void 0 : _f.activities}`);
|
|
583
592
|
hasMoreActivities = false;
|
|
584
593
|
}
|
|
585
594
|
}
|
|
595
|
+
if (successCount >= limit) {
|
|
596
|
+
spinner.success(`Reached the limit of ${limit} likes.`);
|
|
597
|
+
}
|
|
586
598
|
}
|
|
587
599
|
catch (error) {
|
|
588
600
|
console.error(`\nError from likeFollowing. ${error.message}`);
|
|
@@ -746,50 +758,58 @@ class Auth {
|
|
|
746
758
|
}
|
|
747
759
|
});
|
|
748
760
|
}
|
|
749
|
-
static AutoLike() {
|
|
761
|
+
static AutoLike(option, passed_count) {
|
|
750
762
|
return __awaiter(this, void 0, void 0, function* () {
|
|
751
763
|
try {
|
|
752
764
|
if (!(yield Auth.isLoggedIn())) {
|
|
753
765
|
console.error(`\nPlease login to use this feature.`);
|
|
754
766
|
return;
|
|
755
767
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
768
|
+
let final_option = option;
|
|
769
|
+
if (!(final_option > 0 && final_option <= 4)) {
|
|
770
|
+
const { activityType } = yield inquirer.prompt([
|
|
771
|
+
{
|
|
772
|
+
type: 'list',
|
|
773
|
+
name: 'activityType',
|
|
774
|
+
message: 'Select activity type:',
|
|
775
|
+
choices: [
|
|
776
|
+
{ name: 'Following • v1', value: 1 },
|
|
777
|
+
{ name: 'Following • v2', value: 2 },
|
|
778
|
+
{ name: 'Global', value: 3 },
|
|
779
|
+
{ name: 'Specific User', value: 4 },
|
|
780
|
+
],
|
|
781
|
+
pageSize: 10,
|
|
782
|
+
},
|
|
783
|
+
]);
|
|
784
|
+
final_option = activityType;
|
|
785
|
+
}
|
|
786
|
+
switch (final_option) {
|
|
771
787
|
case 1:
|
|
772
788
|
yield this.LikeFollowing();
|
|
773
789
|
break;
|
|
774
790
|
case 2: {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
791
|
+
let final_count = passed_count;
|
|
792
|
+
if (final_count === 0) {
|
|
793
|
+
const { count } = yield inquirer.prompt([
|
|
794
|
+
{
|
|
795
|
+
type: 'number',
|
|
796
|
+
name: 'count',
|
|
797
|
+
message: 'Likes to give:',
|
|
798
|
+
},
|
|
799
|
+
]);
|
|
800
|
+
final_count = count;
|
|
801
|
+
}
|
|
802
|
+
yield this.LikeFollowingActivityV2(final_count);
|
|
783
803
|
break;
|
|
784
804
|
}
|
|
785
805
|
case 3:
|
|
786
|
-
yield this.LikeGlobal();
|
|
806
|
+
yield this.LikeGlobal(passed_count);
|
|
787
807
|
break;
|
|
788
808
|
case 4:
|
|
789
809
|
yield this.LikeSpecificUser();
|
|
790
810
|
break;
|
|
791
811
|
default:
|
|
792
|
-
console.error(`\nInvalid choice. (${
|
|
812
|
+
console.error(`\nInvalid choice. (${final_option})`);
|
|
793
813
|
}
|
|
794
814
|
}
|
|
795
815
|
catch (error) {
|
package/bin/helpers/workers.js
CHANGED
|
@@ -30,6 +30,7 @@ import process from 'process';
|
|
|
30
30
|
import Spinner from 'tiny-spinner';
|
|
31
31
|
import { Auth } from './auth.js';
|
|
32
32
|
import { fetcher } from './fetcher.js';
|
|
33
|
+
import { colorize } from './lib/colorize.js';
|
|
33
34
|
import { rate_limit_time_ms, symbol_done, symbol_fail, } from './lib/constants.js';
|
|
34
35
|
import { deleteActivityMutation, saveAnimeWithProgressMutation, } from './mutations.js';
|
|
35
36
|
import { animeSearchQuery } from './queries.js';
|
|
@@ -389,14 +390,14 @@ function activityBy(activity, count) {
|
|
|
389
390
|
var _a, _b, _c, _d;
|
|
390
391
|
const countStr = `[${count ? count : '?'}]`.padEnd(6);
|
|
391
392
|
if ((_a = activity === null || activity === void 0 ? void 0 : activity.messenger) === null || _a === void 0 ? void 0 : _a.name) {
|
|
392
|
-
return `${countStr}${activity.messenger.name} >> messaged ${activity.recipient.name}`;
|
|
393
|
+
return `${countStr}${activity.messenger.name} ${colorize.Metal('>>')} messaged ${activity.recipient.name}`;
|
|
393
394
|
}
|
|
394
395
|
else if ((_c = (_b = activity === null || activity === void 0 ? void 0 : activity.media) === null || _b === void 0 ? void 0 : _b.title) === null || _c === void 0 ? void 0 : _c.userPreferred) {
|
|
395
396
|
if (activity.progress) {
|
|
396
|
-
return `${countStr}${activity.user.name} >> ${activity.status} ${activity.progress} of ${activity.media.title.userPreferred}`;
|
|
397
|
+
return `${countStr}${activity.user.name} ${colorize.Metal('>>')} ${activity.status} ${activity.progress} of ${activity.media.title.userPreferred}`;
|
|
397
398
|
}
|
|
398
399
|
else {
|
|
399
|
-
return `${countStr}${activity.user.name} >> ${activity.status} ${activity.media.title.userPreferred}`;
|
|
400
|
+
return `${countStr}${activity.user.name} ${colorize.Metal('>>')} ${activity.status} ${activity.media.title.userPreferred}`;
|
|
400
401
|
}
|
|
401
402
|
}
|
|
402
403
|
else if ((_d = activity === null || activity === void 0 ? void 0 : activity.user) === null || _d === void 0 ? void 0 : _d.name) {
|
package/bin/index.js
CHANGED
|
@@ -188,8 +188,10 @@ cli
|
|
|
188
188
|
.command('autolike')
|
|
189
189
|
.alias('al')
|
|
190
190
|
.description('Autolike following or global activities.')
|
|
191
|
-
.
|
|
192
|
-
|
|
191
|
+
.option('-o, --option <number>', 'Option number in asc order', '0')
|
|
192
|
+
.option('-c, --count <number>', 'How many likes to give', '0')
|
|
193
|
+
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ option, count }) {
|
|
194
|
+
yield Auth.AutoLike(Number(option), Number(count));
|
|
193
195
|
}));
|
|
194
196
|
cli
|
|
195
197
|
.command('social')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@irfanshadikrishad/anilist",
|
|
3
3
|
"description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.1.0-forbidden.0",
|
|
5
5
|
"author": "Irfan Shadik Rishad",
|
|
6
6
|
"license": "MPL-2.0",
|
|
7
7
|
"scripts": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"prettier": "@irfanshadikrishad/prettier",
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@irfanshadikrishad/cipher": "^1.7.2",
|
|
65
|
-
"@irfanshadikrishad/logger": "^0.
|
|
65
|
+
"@irfanshadikrishad/logger": "^1.0.0",
|
|
66
66
|
"chalk": "^6.0.1",
|
|
67
67
|
"cli-table3": "^0.6.5",
|
|
68
68
|
"cli-truncate": "^6.2.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"xml2js": "^0.6.2"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@babel/preset-env": "^7.29.
|
|
80
|
+
"@babel/preset-env": "^7.29.17",
|
|
81
81
|
"@eslint/js": "^9.39.5",
|
|
82
82
|
"@irfanshadikrishad/prettier": "^1.3.9",
|
|
83
83
|
"@types/jest": "^30.0.0",
|
|
@@ -86,11 +86,11 @@
|
|
|
86
86
|
"@types/xml2js": "^0.4.14",
|
|
87
87
|
"@typescript-eslint/eslint-plugin": "^8.74.0",
|
|
88
88
|
"eslint": "^9.39.5",
|
|
89
|
-
"globals": "^17.
|
|
89
|
+
"globals": "^17.15.0",
|
|
90
90
|
"husky": "^9.1.7",
|
|
91
91
|
"jest": "^30.5.2",
|
|
92
92
|
"lint-staged": "^17.6.3",
|
|
93
|
-
"prettier": "^3.10.
|
|
93
|
+
"prettier": "^3.10.2",
|
|
94
94
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
95
95
|
"ts-jest": "^29.4.15",
|
|
96
96
|
"ts-node": "^10.9.2",
|