@irfanshadikrishad/anilist 1.0.0-forbidden.3 → 1.0.0-forbidden.5

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 CHANGED
@@ -35,12 +35,12 @@ Create an API client from [anilist developer setting](https://anilist.co/setting
35
35
 
36
36
  To login:
37
37
 
38
- ```
38
+ ```bash
39
39
  anilist login -i <client-id> -s <client-secret>
40
40
  ```
41
41
 
42
42
  > [!NOTE]
43
- > here `<client-id>` and `<client-secret>` should be replaced by the ones that you recieved from the developer setting.
43
+ > here `<client-id>` and `<client-secret>` should be replaced by the ones that you recieved from the developer setting. Also don't include `<>`, this only indicates need-to-be-replaced data.
44
44
 
45
45
  #### CLI Commands Overview
46
46
 
@@ -58,6 +58,7 @@ anilist login -i <client-id> -s <client-secret>
58
58
  | `delete` <br> _(alias: `del`)_ | `-a, --anime` <br> `-m, --manga` <br> `-s, --activity` | Delete collections of anime, manga or activities |
59
59
  | `upcoming` <br> _(alias:`up`)_ | `-c (default: 10)` | Fetch upcoming anime (default count is 10) |
60
60
  | `anime` | `<anime-id>` | Get anime details by Anime Id |
61
+ | `manga` | `<manga-id>` | Get manga details by Manga ID |
61
62
  | `search` <br> _(alias:`srch`/`find`)_ | `<query>` <br> `-a, --anime` <br> `-m, --manga` <br> `-c (default: 10)` | Get anime/manga search results |
62
63
  | `status` <br> _(alias: `write`/`post`)_ | `<status>` | Write a status... (text/markdown/html) |
63
64
  | `export` <br> _(alias: `exp`)_ | `-a, --anime` <br> `-m, --manga` | Export anime or manga list in JSON, CSV or XML (MyAnimeList/AniDB) |
@@ -85,10 +86,10 @@ anilist logout
85
86
 
86
87
  - Description: End the current session and log out from your AniList account.
87
88
 
88
- #### `me`:
89
+ #### `whoami`:
89
90
 
90
91
  ```bash
91
- anilist me
92
+ anilist whoami
92
93
  ```
93
94
 
94
95
  - Description: Retrieve and display information about the currently logged-in user, including stats and profile details.
@@ -163,13 +164,13 @@ anilist ls -a
163
164
  #### `delete` _(alias: `del`)_:
164
165
 
165
166
  ```bash
166
- anilist del -ac
167
+ anilist del -s,
167
168
  ```
168
169
 
169
170
  - Options:
170
171
  - `-a, --anime`: Delete your specific anime collection that you want.
171
172
  - `-m, --manga`: Delete your specific manga collection that you want.
172
- - `-ac, --activity`: Delete all or any type of activities you want.
173
+ - `-s,, --activity`: Delete all or any type of activities you want.
173
174
  - Description: Delete the entire anime or manga collection from the logged-in user's profile.
174
175
 
175
176
  #### `anime`
@@ -182,6 +183,16 @@ anilist anime <anime-id>
182
183
  - `<anime-id>` _(eg: 21)_ : Id of the anime you want to get details of.
183
184
  - Description: Get anime details by anime Id.
184
185
 
186
+ #### `manga`
187
+
188
+ ```bash
189
+ anilist manga <manga-id>
190
+ ```
191
+
192
+ - Options
193
+ - `<anime-id>` _(eg: 21)_ : Id of the manga you want to get details of.
194
+ - Description: Get manga details by manga Id.
195
+
185
196
  #### `search` _(alias: `srch`/`find`)_:
186
197
 
187
198
  ```bash
@@ -152,33 +152,33 @@ class Auth {
152
152
  });
153
153
  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;
154
154
  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;
155
- console.log(`
156
- ID: ${user === null || user === void 0 ? void 0 : user.id}
157
- Name: ${user === null || user === void 0 ? void 0 : user.name}
158
- siteUrl: ${user === null || user === void 0 ? void 0 : user.siteUrl}
159
- profileColor: ${(_j = user === null || user === void 0 ? void 0 : user.options) === null || _j === void 0 ? void 0 : _j.profileColor}
160
- timeZone: ${(_k = user === null || user === void 0 ? void 0 : user.options) === null || _k === void 0 ? void 0 : _k.timezone}
161
- activityMergeTime: ${(_l = user === null || user === void 0 ? void 0 : user.options) === null || _l === void 0 ? void 0 : _l.activityMergeTime}
162
- donatorTier: ${user === null || user === void 0 ? void 0 : user.donatorTier}
163
- donatorBadge: ${user === null || user === void 0 ? void 0 : user.donatorBadge}
164
- unreadNotificationCount:${user === null || user === void 0 ? void 0 : user.unreadNotificationCount}
165
- Account Created: ${new Date((user === null || user === void 0 ? void 0 : user.createdAt) * 1000).toUTCString()}
166
- Account Updated: ${new Date((user === null || user === void 0 ? void 0 : user.updatedAt) * 1000).toUTCString()}
167
-
168
- Followers: ${followersCount}
169
- Following: ${followingCount}
170
-
171
- Statistics (Anime):
172
- 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}
173
- 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}
174
- 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}
175
- 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}
176
-
177
- Statistics (Manga):
178
- 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}
179
- 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}
180
- 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}
181
- 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}
155
+ console.log(`
156
+ ID: ${user === null || user === void 0 ? void 0 : user.id}
157
+ Name: ${user === null || user === void 0 ? void 0 : user.name}
158
+ siteUrl: ${user === null || user === void 0 ? void 0 : user.siteUrl}
159
+ profileColor: ${(_j = user === null || user === void 0 ? void 0 : user.options) === null || _j === void 0 ? void 0 : _j.profileColor}
160
+ timeZone: ${(_k = user === null || user === void 0 ? void 0 : user.options) === null || _k === void 0 ? void 0 : _k.timezone}
161
+ activityMergeTime: ${(_l = user === null || user === void 0 ? void 0 : user.options) === null || _l === void 0 ? void 0 : _l.activityMergeTime}
162
+ donatorTier: ${user === null || user === void 0 ? void 0 : user.donatorTier}
163
+ donatorBadge: ${user === null || user === void 0 ? void 0 : user.donatorBadge}
164
+ unreadNotificationCount:${user === null || user === void 0 ? void 0 : user.unreadNotificationCount}
165
+ Account Created: ${new Date((user === null || user === void 0 ? void 0 : user.createdAt) * 1000).toUTCString()}
166
+ Account Updated: ${new Date((user === null || user === void 0 ? void 0 : user.updatedAt) * 1000).toUTCString()}
167
+
168
+ Followers: ${followersCount}
169
+ Following: ${followingCount}
170
+
171
+ Statistics (Anime):
172
+ 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}
173
+ 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}
174
+ 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}
175
+ 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}
176
+
177
+ Statistics (Manga):
178
+ 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}
179
+ 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}
180
+ 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}
181
+ 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}
182
182
  `);
183
183
  console.log(`\nRecent Activities:`);
184
184
  if (activities.length > 0) {
@@ -577,6 +577,7 @@ Statistics (Manga):
577
577
  let hasMoreActivities = true;
578
578
  let retryCount = 0;
579
579
  const maxRetries = 5;
580
+ let likedCount = 0;
580
581
  while (hasMoreActivities) {
581
582
  const activities = yield fetcher(followingActivitiesQuery, {
582
583
  page,
@@ -592,14 +593,17 @@ Statistics (Manga):
592
593
  const like = yield fetcher(likeActivityMutation, {
593
594
  activityId: activ.id,
594
595
  });
595
- console.info(`${activityBy(activ)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
596
+ if (like === null || like === void 0 ? void 0 : like.data) {
597
+ likedCount++;
598
+ }
599
+ console.info(`${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"} ${activityBy(activ, likedCount)}`);
596
600
  }
597
601
  catch (error) {
598
602
  console.error(`Activity possibly deleted. ${error.message}`);
599
603
  }
600
604
  }
601
605
  else {
602
- console.log(`${activityBy(activ)} 🔵`);
606
+ console.log(`🔵 ${activityBy(activ)}`);
603
607
  }
604
608
  // avoiding rate-limit
605
609
  yield new Promise((resolve) => {
@@ -651,14 +655,14 @@ Statistics (Manga):
651
655
  });
652
656
  // const ToggleLike = like?.data?.ToggleLike
653
657
  likedCount++;
654
- console.info(`${activityBy(activ, likedCount)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
658
+ console.info(`${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"} ${activityBy(activ, likedCount)}`);
655
659
  }
656
660
  catch (error) {
657
661
  console.error(`Activity possibly deleted. ${error.message}`);
658
662
  }
659
663
  }
660
664
  else {
661
- console.log(`${activityBy(activ)} 🔵`);
665
+ console.log(`🔵 ${activityBy(activ)}`);
662
666
  }
663
667
  // avoiding rate-limit
664
668
  yield new Promise((resolve) => {
@@ -718,14 +722,14 @@ Statistics (Manga):
718
722
  activityId: activ.id,
719
723
  });
720
724
  likedCount++;
721
- console.info(`${activityBy(activ, likedCount)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
725
+ console.info(`${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"} ${activityBy(activ, likedCount)}`);
722
726
  }
723
727
  catch (error) {
724
728
  console.error(`Activity possibly deleted. ${error.message}`);
725
729
  }
726
730
  }
727
731
  else {
728
- console.log(`${activityBy(activ)} 🔵`);
732
+ console.log(`🔵 ${activityBy(activ)}`);
729
733
  }
730
734
  // Avoiding rate limit
731
735
  yield new Promise((resolve) => {
@@ -804,17 +808,17 @@ Statistics (Manga):
804
808
  const like = yield fetcher(likeActivityMutation, {
805
809
  activityId: activ.id,
806
810
  });
807
- console.info(`[${userNumber}/${i + 1}/${activiti.length}] ${activityBy(activ)} ${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"}`);
811
+ console.info(`${(like === null || like === void 0 ? void 0 : like.data) ? "✅" : "❌"} ${activityBy(activ, i + 1)}`);
808
812
  if (like === null || like === void 0 ? void 0 : like.data) {
809
813
  liked++;
810
814
  }
811
815
  }
812
816
  catch (error) {
813
- console.error(`[${userNumber}/${i + 1}/${activiti.length}] Activity possibly deleted. ${error.message}`);
817
+ console.error(`Activity possibly deleted. ${error.message}`);
814
818
  }
815
819
  }
816
820
  else {
817
- console.log(`[${userNumber}/${i + 1}/${activiti.length}] ${activityBy(activ)} 🔵`);
821
+ console.log(`🔵 ${activityBy(activ, i + 1)}`);
818
822
  }
819
823
  // Avoid rate-limiting
820
824
  yield new Promise((resolve) => setTimeout(resolve, 1200));
@@ -873,11 +877,12 @@ class Social {
873
877
  */
874
878
  static follow() {
875
879
  return __awaiter(this, void 0, void 0, function* () {
876
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
880
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
877
881
  try {
878
882
  let pager = 1;
879
883
  let hasNextPage = true;
880
884
  let allFollowerUsers = [];
885
+ let followedBack = 0;
881
886
  spinner.start("Fetching all the followers...");
882
887
  while (hasNextPage) {
883
888
  const followerUsers = yield fetcher(userFollowersQuery, {
@@ -910,12 +915,16 @@ class Social {
910
915
  console.log(`${String(`[${nf.id}]`).padEnd(maxIdLength)}` +
911
916
  `\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)}` +
912
917
  `\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) ? "✅" : "🈵"}`);
918
+ // Count the followed back users
919
+ 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) {
920
+ followedBack++;
921
+ }
913
922
  }
914
923
  catch (error) {
915
924
  console.log(`automate_follow_toggle_follow: ${error.message}`);
916
925
  }
917
926
  }
918
- console.log(`\n✅ Followed back ${notFollowing.length} users.`);
927
+ console.log(`\n✅ Followed back ${followedBack} users.`);
919
928
  }
920
929
  catch (error) {
921
930
  console.log(`\nautomate_follow ${error.message}`);
@@ -927,18 +936,19 @@ class Social {
927
936
  */
928
937
  static unfollow() {
929
938
  return __awaiter(this, void 0, void 0, function* () {
930
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
939
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
931
940
  try {
932
941
  let pager = 1;
933
942
  let hasNextPage = true;
934
943
  let allFollowingUsers = [];
944
+ let unfollowedUsers = 0;
935
945
  spinner.start("Fetching all following users...");
936
946
  while (hasNextPage) {
937
947
  const followingUsers = yield fetcher(userFollowingQuery, {
938
948
  userId: yield Auth.MyUserId(),
939
949
  page: pager,
940
950
  });
941
- 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} ...`);
951
+ 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}...`);
942
952
  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)) {
943
953
  hasNextPage = false;
944
954
  }
@@ -951,8 +961,7 @@ class Social {
951
961
  .filter((user) => !user.isFollower)
952
962
  .map((u3r) => ({ id: u3r.id, name: u3r.name }));
953
963
  if (notFollowingMe.length <= 0) {
954
- console.warn(`\nNot following list is empty!`);
955
- spinner.stop(`No users to unfollow. Aborting process...`);
964
+ spinner.stop(`No users to unfollow. Exiting operation...`);
956
965
  return;
957
966
  }
958
967
  spinner.stop(`Unfollow process activated with ${notFollowingMe.length} users.`);
@@ -965,12 +974,16 @@ class Social {
965
974
  userId: nfm.id,
966
975
  });
967
976
  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) ? "✅" : "🈵"}`);
977
+ // Count the unfollowed users
978
+ 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) {
979
+ unfollowedUsers++;
980
+ }
968
981
  }
969
982
  catch (error) {
970
983
  console.log(`unfollow_toggle_follow. ${error.message}`);
971
984
  }
972
985
  }
973
- console.log(`\nTotal Unfollowed: ${nfmCount}`);
986
+ console.log(`\nTotal Unfollowed: ${unfollowedUsers} of ${nfmCount} users.`);
974
987
  }
975
988
  catch (error) {
976
989
  console.error(`\nautomate_unfollow: ${error.message}`);
@@ -10,6 +10,7 @@ declare class AniList {
10
10
  static getUpcomingAnime(count: number): Promise<void>;
11
11
  static getUserByUsername(username: string): Promise<void>;
12
12
  static getAnimeDetailsByID(anilistID: number): Promise<void>;
13
+ static getMangaDetailsByID(mangaID: number): Promise<void>;
13
14
  static searchAnime(search: string, count: number): Promise<void>;
14
15
  static searchManga(search: string, count: number): Promise<void>;
15
16
  }
@@ -15,10 +15,10 @@ import { join } from "path";
15
15
  import { Auth } from "./auth.js";
16
16
  import { fetcher } from "./fetcher.js";
17
17
  import { addAnimeToListMutation, addMangaToListMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, } from "./mutations.js";
18
- import { animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, } from "./queries.js";
18
+ import { animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, } from "./queries.js";
19
19
  import { AniListMediaStatus, } from "./types.js";
20
20
  import { Validate } from "./validation.js";
21
- import { anidbToanilistMapper, formatDateObject, getDownloadFolderPath, getNextSeasonAndYear, getTitle, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, selectFile, timestampToTimeAgo, } from "./workers.js";
21
+ import { anidbToanilistMapper, formatDateObject, getDownloadFolderPath, getNextSeasonAndYear, getTitle, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, selectFile, simpleDateFormat, timestampToTimeAgo, } from "./workers.js";
22
22
  class AniList {
23
23
  static importAnime() {
24
24
  return __awaiter(this, void 0, void 0, function* () {
@@ -697,6 +697,33 @@ class AniList {
697
697
  }
698
698
  });
699
699
  }
700
+ static getMangaDetailsByID(mangaID) {
701
+ return __awaiter(this, void 0, void 0, function* () {
702
+ var _a;
703
+ try {
704
+ const response = yield fetcher(mangaDetailsQuery, {
705
+ id: mangaID,
706
+ });
707
+ if (response === null || response === void 0 ? void 0 : response.errors) {
708
+ console.error(`${response.errors[0].message}`);
709
+ return;
710
+ }
711
+ const manga = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.Media;
712
+ if (manga) {
713
+ console.log(`\n[${getTitle(manga.title)}]`);
714
+ console.log(`${manga.description}`);
715
+ console.log(`Chapters: ${manga.chapters}\t Volumes: ${manga.volumes}`);
716
+ console.log(`Status:\t${manga.status}`);
717
+ console.log(`Genres:\t${manga.genres.join(", ")}`);
718
+ console.log(`Start:\t${simpleDateFormat(manga.startDate)}`);
719
+ console.log(`End:\t${simpleDateFormat(manga.endDate)}`);
720
+ }
721
+ }
722
+ catch (error) {
723
+ console.error(`${error.message}`);
724
+ }
725
+ });
726
+ }
700
727
  static searchAnime(search, count) {
701
728
  return __awaiter(this, void 0, void 0, function* () {
702
729
  var _a, _b, _c;
@@ -1,43 +1,43 @@
1
- const addAnimeToListMutation = `
2
- mutation($mediaId: Int, $status: MediaListStatus) {
3
- SaveMediaListEntry(mediaId: $mediaId, status: $status) { id status }
4
- }
1
+ const addAnimeToListMutation = `
2
+ mutation($mediaId: Int, $status: MediaListStatus) {
3
+ SaveMediaListEntry(mediaId: $mediaId, status: $status) { id status }
4
+ }
5
5
  `;
6
- const addMangaToListMutation = `
7
- mutation($mediaId: Int, $status: MediaListStatus) {
8
- SaveMediaListEntry(mediaId: $mediaId, status: $status) {
9
- id
10
- status
11
- media { id title { romaji english } }
12
- }
13
- }
6
+ const addMangaToListMutation = `
7
+ mutation($mediaId: Int, $status: MediaListStatus) {
8
+ SaveMediaListEntry(mediaId: $mediaId, status: $status) {
9
+ id
10
+ status
11
+ media { id title { romaji english } }
12
+ }
13
+ }
14
14
  `;
15
- const deleteActivityMutation = `
16
- mutation($id: Int!) {
17
- DeleteActivity(id: $id) { deleted }
18
- }
15
+ const deleteActivityMutation = `
16
+ mutation($id: Int!) {
17
+ DeleteActivity(id: $id) { deleted }
18
+ }
19
19
  `;
20
- const saveTextActivityMutation = `
21
- mutation SaveTextActivity($status: String!) {
22
- SaveTextActivity(text: $status) { id text userId createdAt }
23
- }
20
+ const saveTextActivityMutation = `
21
+ mutation SaveTextActivity($status: String!) {
22
+ SaveTextActivity(text: $status) { id text userId createdAt }
23
+ }
24
24
  `;
25
- const saveAnimeWithProgressMutation = `
26
- mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {
27
- SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {
28
- id progress hiddenFromStatusLists
29
- }
30
- }
25
+ const saveAnimeWithProgressMutation = `
26
+ mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean) {
27
+ SaveMediaListEntry(mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists) {
28
+ id progress hiddenFromStatusLists
29
+ }
30
+ }
31
31
  `;
32
- const saveMangaWithProgressMutation = `
33
- mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {
34
- SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private
35
- ) { id progress hiddenFromStatusLists private }
36
- }
32
+ const saveMangaWithProgressMutation = `
33
+ mutation ($mediaId: Int, $progress: Int, $status: MediaListStatus, $hiddenFromStatusLists: Boolean, $private: Boolean) {
34
+ SaveMediaListEntry( mediaId: $mediaId, progress: $progress, status: $status, hiddenFromStatusLists: $hiddenFromStatusLists, private: $private
35
+ ) { id progress hiddenFromStatusLists private }
36
+ }
37
37
  `;
38
- const likeActivityMutation = `
39
- mutation($activityId: Int!) {
40
- ToggleLike(id: $activityId, type: ACTIVITY) { id }
41
- }
38
+ const likeActivityMutation = `
39
+ mutation($activityId: Int!) {
40
+ ToggleLike(id: $activityId, type: ACTIVITY) { id }
41
+ }
42
42
  `;
43
43
  export { addAnimeToListMutation, addMangaToListMutation, deleteActivityMutation, likeActivityMutation, saveAnimeWithProgressMutation, saveMangaWithProgressMutation, saveTextActivityMutation, };
@@ -25,4 +25,5 @@ declare const specificUserActivitiesQuery = "\nquery ($page: Int, $perPage: Int,
25
25
  declare const userFollowingQuery = "query ($userId: Int!, $page: Int) {\n Page (page: $page) {\n pageInfo { total perPage currentPage lastPage hasNextPage }\n following(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }\n }\n}\n";
26
26
  declare const userFollowersQuery = "query ($userId: Int!, $page: Int) {\n Page (page: $page) {\n pageInfo { total perPage currentPage lastPage hasNextPage }\n followers(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }\n }\n}\n";
27
27
  declare const toggleFollowMutation = "mutation ($userId: Int!) {\n ToggleFollow(userId: $userId) { id name isFollower isFollowing }\n}\n";
28
- export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
28
+ declare const mangaDetailsQuery = "query ($id: Int) {\n Media(id: $id, type: MANGA) {\n id title { romaji english native userPreferred } coverImage { color medium large extraLarge } \n bannerImage description chapters volumes status genres\n startDate { year month day } endDate { year month day }\n }\n}\n";
29
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
@@ -1,180 +1,188 @@
1
- const currentUserQuery = `{
2
- Viewer {
3
- id name about bans siteUrl options { profileColor timezone activityMergeTime }
4
- donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
5
- moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
6
- statistics { anime { count meanScore minutesWatched episodesWatched } manga { count chaptersRead volumesRead meanScore } }
7
- mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
8
- }
9
- }`;
10
- const trendingQuery = `query ($page: Int, $perPage: Int) {
11
- Page(page: $page, perPage: $perPage) {
12
- media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }
13
- }
14
- }`;
15
- const popularQuery = `query ($page: Int, $perPage: Int) {
16
- Page(page: $page, perPage: $perPage) {
17
- media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }
18
- }
19
- }`;
20
- const userQuery = `query ($username: String) {
21
- User(name: $username) {
22
- id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }
23
- isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }
24
- statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }
25
- }
26
- }`;
27
- const currentUserAnimeList = `query ($id: Int) {
28
- MediaListCollection(userId: $id, type: ANIME) {
29
- lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english } status episodes siteUrl } } }
30
- }
31
- }
1
+ const currentUserQuery = `{
2
+ Viewer {
3
+ id name about bans siteUrl options { profileColor timezone activityMergeTime }
4
+ donatorTier donatorBadge createdAt updatedAt unreadNotificationCount previousNames { name createdAt updatedAt }
5
+ moderatorRoles favourites { anime { nodes { id title { romaji english } } } manga { nodes { id title { romaji english } } } }
6
+ statistics { anime { count meanScore minutesWatched episodesWatched } manga { count chaptersRead volumesRead meanScore } }
7
+ mediaListOptions { scoreFormat rowOrder animeList { sectionOrder } mangaList { sectionOrder } }
8
+ }
9
+ }`;
10
+ const trendingQuery = `query ($page: Int, $perPage: Int) {
11
+ Page(page: $page, perPage: $perPage) {
12
+ media(sort: TRENDING_DESC, type: ANIME) { id title { romaji english } }
13
+ }
14
+ }`;
15
+ const popularQuery = `query ($page: Int, $perPage: Int) {
16
+ Page(page: $page, perPage: $perPage) {
17
+ media(sort: POPULARITY_DESC, type: ANIME) { id title { romaji english } }
18
+ }
19
+ }`;
20
+ const userQuery = `query ($username: String) {
21
+ User(name: $username) {
22
+ id name siteUrl donatorTier donatorBadge createdAt updatedAt previousNames { name createdAt updatedAt }
23
+ isBlocked isFollower isFollowing options { profileColor timezone activityMergeTime }
24
+ statistics { anime { count episodesWatched minutesWatched } manga { count chaptersRead volumesRead } }
25
+ }
26
+ }`;
27
+ const currentUserAnimeList = `query ($id: Int) {
28
+ MediaListCollection(userId: $id, type: ANIME) {
29
+ lists { name entries { id progress hiddenFromStatusLists status media { id idMal title { romaji english } status episodes siteUrl } } }
30
+ }
31
+ }
32
32
  `;
33
- const currentUserMangaList = `query ($id: Int) {
34
- MediaListCollection(userId: $id, type: MANGA) {
35
- lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english } status chapters } } }
36
- }
37
- }
33
+ const currentUserMangaList = `query ($id: Int) {
34
+ MediaListCollection(userId: $id, type: MANGA) {
35
+ lists { name entries { id progress hiddenFromStatusLists private status media { id idMal title { romaji english } status chapters } } }
36
+ }
37
+ }
38
38
  `;
39
- const deleteMediaEntryMutation = `mutation($id: Int!) {
40
- DeleteMediaListEntry(id: $id) { deleted }
41
- }`;
42
- const deleteMangaEntryMutation = `mutation($id: Int) {
43
- DeleteMediaListEntry(id: $id) { deleted }
44
- }`;
45
- const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
46
- Page(perPage: $perPage) {
47
- media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
48
- id title { romaji english native userPreferred } season seasonYear startDate { year month day }
49
- episodes description genres
50
- }
51
- }
52
- }`;
53
- const animeDetailsQuery = `query ($id: Int) {
54
- Media(id: $id) {
55
- id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }
56
- duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl
57
- stats { scoreDistribution { score amount } statusDistribution { status amount } }
58
- }
59
- }`;
60
- const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
61
- Page(page: $page, perPage: $perPage) {
62
- activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {
63
- ... on ListActivity { id status progress createdAt media { id title { romaji english } } }
64
- }
65
- }
66
- }`;
67
- const animeSearchQuery = `query ($search: String, $perPage: Int) {
68
- Page(perPage: $perPage) {
69
- media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }
70
- }
71
- }`;
72
- const mangaSearchQuery = `query ($search: String, $perPage: Int) {
73
- Page(perPage: $perPage) {
74
- media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }
75
- }
76
- }`;
77
- const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
78
- Page(page: $page, perPage: $perPage) {
79
- activities(userId: $userId, type: TEXT, sort: ID_DESC) {
80
- ... on TextActivity { id type text createdAt user { id name } }
81
- }
82
- }
83
- }`;
84
- const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
85
- Page(page: $page, perPage: $perPage) {
86
- activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
87
- ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
88
- }
89
- }
90
- }`;
91
- const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
92
- Page(page: $page, perPage: $perPage) {
93
- activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
94
- ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
95
- }
96
- }
97
- }`;
98
- const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
99
- Page(page: $page, perPage: $perPage) {
100
- activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
101
- ... on MessageActivity { id type message recipient { id name } createdAt }
102
- }
103
- }
104
- }`;
105
- const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
106
- Page(page: $page, perPage: $perPage) {
107
- activities(userId: $userId, sort: ID_DESC) {
108
- ... on TextActivity { id type text createdAt user { id name } }
109
- ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
110
- ... on MessageActivity { id type message recipient { id name } createdAt }
111
- }
112
- }
113
- }`;
114
- const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
115
- Page(page: $page, perPage: $perPage) {
116
- pageInfo { total currentPage lastPage hasNextPage perPage }
117
- activities(userId: $userId, type: $type, sort: ID_DESC) {
118
- ... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
119
- }
120
- }
121
- }`;
122
- const malIdToAnilistAnimeId = `query ($malId: Int) {
123
- Media(idMal: $malId, type: ANIME) { id title { romaji english } } }
39
+ const deleteMediaEntryMutation = `mutation($id: Int!) {
40
+ DeleteMediaListEntry(id: $id) { deleted }
41
+ }`;
42
+ const deleteMangaEntryMutation = `mutation($id: Int) {
43
+ DeleteMediaListEntry(id: $id) { deleted }
44
+ }`;
45
+ const upcomingAnimesQuery = `query GetNextSeasonAnime($nextSeason: MediaSeason, $nextYear: Int, $perPage: Int) {
46
+ Page(perPage: $perPage) {
47
+ media(season: $nextSeason, seasonYear: $nextYear, type: ANIME, sort: POPULARITY_DESC) {
48
+ id title { romaji english native userPreferred } season seasonYear startDate { year month day }
49
+ episodes description genres
50
+ }
51
+ }
52
+ }`;
53
+ const animeDetailsQuery = `query ($id: Int) {
54
+ Media(id: $id) {
55
+ id idMal title { romaji english native userPreferred } episodes nextAiringEpisode { id }
56
+ duration startDate { year month day } endDate { year month day } countryOfOrigin description isAdult status season format genres siteUrl
57
+ stats { scoreDistribution { score amount } statusDistribution { status amount } }
58
+ }
59
+ }`;
60
+ const userActivityQuery = `query ($id: Int, $page: Int, $perPage: Int) {
61
+ Page(page: $page, perPage: $perPage) {
62
+ activities(userId: $id, type_in: [ANIME_LIST, MANGA_LIST], sort: ID_DESC) {
63
+ ... on ListActivity { id status progress createdAt media { id title { romaji english } } }
64
+ }
65
+ }
66
+ }`;
67
+ const animeSearchQuery = `query ($search: String, $perPage: Int) {
68
+ Page(perPage: $perPage) {
69
+ media(search: $search, type: ANIME) { id title { romaji english native userPreferred } startDate { day month year } episodes status description }
70
+ }
71
+ }`;
72
+ const mangaSearchQuery = `query ($search: String, $perPage: Int) {
73
+ Page(perPage: $perPage) {
74
+ media(search: $search, type: MANGA) { id title { romaji english native userPreferred } chapters status description }
75
+ }
76
+ }`;
77
+ const activityTextQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
78
+ Page(page: $page, perPage: $perPage) {
79
+ activities(userId: $userId, type: TEXT, sort: ID_DESC) {
80
+ ... on TextActivity { id type text createdAt user { id name } }
81
+ }
82
+ }
83
+ }`;
84
+ const activityAnimeListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
85
+ Page(page: $page, perPage: $perPage) {
86
+ activities(userId: $userId, type: ANIME_LIST, sort: ID_DESC) {
87
+ ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
88
+ }
89
+ }
90
+ }`;
91
+ const activityMangaListQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
92
+ Page(page: $page, perPage: $perPage) {
93
+ activities(userId: $userId, type: MANGA_LIST, sort: ID_DESC) {
94
+ ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
95
+ }
96
+ }
97
+ }`;
98
+ const activityMessageQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
99
+ Page(page: $page, perPage: $perPage) {
100
+ activities(userId: $userId, type: MESSAGE, sort: ID_DESC) {
101
+ ... on MessageActivity { id type message recipient { id name } createdAt }
102
+ }
103
+ }
104
+ }`;
105
+ const activityAllQuery = `query ($userId: Int, $page: Int, $perPage: Int) {
106
+ Page(page: $page, perPage: $perPage) {
107
+ activities(userId: $userId, sort: ID_DESC) {
108
+ ... on TextActivity { id type text createdAt user { id name } }
109
+ ... on ListActivity { id type status progress createdAt media { id title { romaji english native } } }
110
+ ... on MessageActivity { id type message recipient { id name } createdAt }
111
+ }
112
+ }
113
+ }`;
114
+ const activityMediaList = `query ($userId: Int, $page: Int, $perPage: Int, $type: ActivityType) {
115
+ Page(page: $page, perPage: $perPage) {
116
+ pageInfo { total currentPage lastPage hasNextPage perPage }
117
+ activities(userId: $userId, type: $type, sort: ID_DESC) {
118
+ ... on ListActivity { id type status progress media { id title { romaji english native } format } createdAt }
119
+ }
120
+ }
121
+ }`;
122
+ const malIdToAnilistAnimeId = `query ($malId: Int) {
123
+ Media(idMal: $malId, type: ANIME) { id title { romaji english } } }
124
124
  `;
125
- const malIdToAnilistMangaId = `query ($malId: Int) {
126
- Media(idMal: $malId, type: MANGA) { id title { romaji english } } }
125
+ const malIdToAnilistMangaId = `query ($malId: Int) {
126
+ Media(idMal: $malId, type: MANGA) { id title { romaji english } } }
127
127
  `;
128
- const followingActivitiesQuery = `
129
- query ($page: Int, $perPage: Int) {
130
- Page(page: $page, perPage: $perPage) {
131
- activities(isFollowing: true, sort: ID_DESC) {
132
- ... on TextActivity { id type isLiked createdAt user { id name } }
133
- ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
134
- ... on MessageActivity { id type isLiked message createdAt recipient { id name } }
135
- }
136
- }
137
- }
128
+ const followingActivitiesQuery = `
129
+ query ($page: Int, $perPage: Int) {
130
+ Page(page: $page, perPage: $perPage) {
131
+ activities(isFollowing: true, sort: ID_DESC) {
132
+ ... on TextActivity { id type isLiked createdAt user { id name } }
133
+ ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
134
+ ... on MessageActivity { id type isLiked message createdAt recipient { id name } }
135
+ }
136
+ }
137
+ }
138
138
  `;
139
- const globalActivitiesQuery = `
140
- query ($page: Int, $perPage: Int) {
141
- Page(page: $page, perPage: $perPage) {
142
- activities(sort: ID_DESC) {
143
- ... on TextActivity { id type isLiked createdAt user { id name } }
144
- ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
145
- ... on MessageActivity { id type isLiked message createdAt recipient { id name } }
146
- }
147
- }
148
- }
139
+ const globalActivitiesQuery = `
140
+ query ($page: Int, $perPage: Int) {
141
+ Page(page: $page, perPage: $perPage) {
142
+ activities(sort: ID_DESC) {
143
+ ... on TextActivity { id type isLiked createdAt user { id name } }
144
+ ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
145
+ ... on MessageActivity { id type isLiked message createdAt recipient { id name } }
146
+ }
147
+ }
148
+ }
149
149
  `;
150
- const specificUserActivitiesQuery = `
151
- query ($page: Int, $perPage: Int, $userId: Int) {
152
- Page(page: $page, perPage: $perPage) {
153
- pageInfo { total perPage currentPage lastPage hasNextPage }
154
- activities(userId: $userId, sort: ID_DESC) {
155
- ... on TextActivity { id type isLiked createdAt user { id name } }
156
- ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
157
- ... on MessageActivity { messenger { name } id type isLiked message createdAt recipient { id name } }
158
- }
159
- }
160
- }
150
+ const specificUserActivitiesQuery = `
151
+ query ($page: Int, $perPage: Int, $userId: Int) {
152
+ Page(page: $page, perPage: $perPage) {
153
+ pageInfo { total perPage currentPage lastPage hasNextPage }
154
+ activities(userId: $userId, sort: ID_DESC) {
155
+ ... on TextActivity { id type isLiked createdAt user { id name } }
156
+ ... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
157
+ ... on MessageActivity { messenger { name } id type isLiked message createdAt recipient { id name } }
158
+ }
159
+ }
160
+ }
161
161
  `;
162
- const userFollowingQuery = `query ($userId: Int!, $page: Int) {
163
- Page (page: $page) {
164
- pageInfo { total perPage currentPage lastPage hasNextPage }
165
- following(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
166
- }
167
- }
162
+ const userFollowingQuery = `query ($userId: Int!, $page: Int) {
163
+ Page (page: $page) {
164
+ pageInfo { total perPage currentPage lastPage hasNextPage }
165
+ following(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
166
+ }
167
+ }
168
168
  `;
169
- const userFollowersQuery = `query ($userId: Int!, $page: Int) {
170
- Page (page: $page) {
171
- pageInfo { total perPage currentPage lastPage hasNextPage }
172
- followers(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
173
- }
174
- }
169
+ const userFollowersQuery = `query ($userId: Int!, $page: Int) {
170
+ Page (page: $page) {
171
+ pageInfo { total perPage currentPage lastPage hasNextPage }
172
+ followers(userId: $userId, sort: [USERNAME]) { id name avatar { large medium } bannerImage isFollowing isFollower }
173
+ }
174
+ }
175
175
  `;
176
- const toggleFollowMutation = `mutation ($userId: Int!) {
177
- ToggleFollow(userId: $userId) { id name isFollower isFollowing }
178
- }
176
+ const toggleFollowMutation = `mutation ($userId: Int!) {
177
+ ToggleFollow(userId: $userId) { id name isFollower isFollowing }
178
+ }
179
179
  `;
180
- export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
180
+ const mangaDetailsQuery = `query ($id: Int) {
181
+ Media(id: $id, type: MANGA) {
182
+ id title { romaji english native userPreferred } coverImage { color medium large extraLarge }
183
+ bannerImage description chapters volumes status genres
184
+ startDate { year month day } endDate { year month day }
185
+ }
186
+ }
187
+ `;
188
+ export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
@@ -186,9 +186,9 @@ interface Myself {
186
186
  }[];
187
187
  }
188
188
  interface DateMonthYear {
189
- day?: number;
190
- month?: number;
191
- year?: number;
189
+ day?: number | null;
190
+ month?: number | null;
191
+ year?: number | null;
192
192
  }
193
193
  interface AnimeDetails {
194
194
  data?: {
@@ -432,4 +432,31 @@ type SpecificUserActivitiesResponse = {
432
432
  message: string;
433
433
  }[];
434
434
  };
435
- export { Activity, AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteMangaResponse, DeleteMediaListResponse, LikeActivityResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MediaEntry, MediaList, MediaListCollectionResponse, MediaListEntry, MediaTitle, MediaWithProgress, Myself, SaveMediaListEntryResponse, SaveTextActivityResponse, SpecificUserActivitiesResponse, TheActivity, ToggleFollowResponse, User, UserActivitiesResponse, UserFollower, UserFollowing, UserResponse, saveAnimeWithProgressResponse, };
435
+ type Error = {
436
+ message: string;
437
+ }[];
438
+ type CoverImage = {
439
+ color: string;
440
+ medium: string;
441
+ large: string;
442
+ extraLarge: string;
443
+ };
444
+ type MangaDetails = {
445
+ data?: {
446
+ Media: {
447
+ id: number;
448
+ title: MediaTitle;
449
+ coverImage: CoverImage;
450
+ bannerImage: string;
451
+ description: string;
452
+ chapters: number | null;
453
+ volumes: number | null;
454
+ status: string;
455
+ genres: [string];
456
+ startDate: DateMonthYear;
457
+ endDate: DateMonthYear;
458
+ };
459
+ };
460
+ errors?: Error;
461
+ };
462
+ export { Activity, AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteMangaResponse, DeleteMediaListResponse, LikeActivityResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MangaDetails, MediaEntry, MediaList, MediaListCollectionResponse, MediaListEntry, MediaTitle, MediaWithProgress, Myself, SaveMediaListEntryResponse, SaveTextActivityResponse, SpecificUserActivitiesResponse, TheActivity, ToggleFollowResponse, User, UserActivitiesResponse, UserFollower, UserFollowing, UserResponse, saveAnimeWithProgressResponse, };
@@ -1,4 +1,4 @@
1
- import { MALAnimeStatus, MALMangaStatus, MediaWithProgress, TheActivity } from "./types.js";
1
+ import { DateMonthYear, MALAnimeStatus, MALMangaStatus, MediaWithProgress, TheActivity } from "./types.js";
2
2
  declare const aniListEndpoint = "https://graphql.anilist.co";
3
3
  declare const redirectUri = "https://anilist.co/api/v2/oauth/pin";
4
4
  declare function getTitle(title: {
@@ -46,4 +46,5 @@ declare function activityBy(activity: TheActivity, count?: number): string;
46
46
  * @returns string of file path
47
47
  */
48
48
  declare function saveToPath(data_type: string, file_format: string): Promise<string>;
49
- export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, timestampToTimeAgo, };
49
+ declare function simpleDateFormat(date: DateMonthYear): string;
50
+ export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
@@ -202,49 +202,49 @@ function selectFile(fileType) {
202
202
  });
203
203
  }
204
204
  function createAnimeXML(malId, progress, status, episodes, title, format) {
205
- return `
206
- <anime>
207
- <series_animedb_id>${malId}</series_animedb_id>
208
- <series_title><![CDATA[${title}]]></series_title>
209
- <series_type>${format}</series_type>
210
- <series_episodes>${episodes}</series_episodes>
211
- <my_id>0</my_id>
212
- <my_watched_episodes>${progress}</my_watched_episodes>
213
- <my_start_date>0000-00-00</my_start_date>
214
- <my_finish_date>0000-00-00</my_finish_date>
215
- <my_score>0</my_score>
216
- <my_storage_value>0.00</my_storage_value>
217
- <my_status>${status}</my_status>
218
- <my_comments><![CDATA[]]></my_comments>
219
- <my_times_watched>0</my_times_watched>
220
- <my_rewatch_value></my_rewatch_value>
221
- <my_priority>LOW</my_priority>
222
- <my_tags><![CDATA[]]></my_tags>
223
- <my_rewatching>0</my_rewatching>
224
- <my_rewatching_ep>0</my_rewatching_ep>
225
- <my_discuss>0</my_discuss>
226
- <my_sns>default</my_sns>
227
- <update_on_import>1</update_on_import>
205
+ return `
206
+ <anime>
207
+ <series_animedb_id>${malId}</series_animedb_id>
208
+ <series_title><![CDATA[${title}]]></series_title>
209
+ <series_type>${format}</series_type>
210
+ <series_episodes>${episodes}</series_episodes>
211
+ <my_id>0</my_id>
212
+ <my_watched_episodes>${progress}</my_watched_episodes>
213
+ <my_start_date>0000-00-00</my_start_date>
214
+ <my_finish_date>0000-00-00</my_finish_date>
215
+ <my_score>0</my_score>
216
+ <my_storage_value>0.00</my_storage_value>
217
+ <my_status>${status}</my_status>
218
+ <my_comments><![CDATA[]]></my_comments>
219
+ <my_times_watched>0</my_times_watched>
220
+ <my_rewatch_value></my_rewatch_value>
221
+ <my_priority>LOW</my_priority>
222
+ <my_tags><![CDATA[]]></my_tags>
223
+ <my_rewatching>0</my_rewatching>
224
+ <my_rewatching_ep>0</my_rewatching_ep>
225
+ <my_discuss>0</my_discuss>
226
+ <my_sns>default</my_sns>
227
+ <update_on_import>1</update_on_import>
228
228
  </anime>`;
229
229
  }
230
230
  function createMangaXML(malId, progress, status, chapters, title) {
231
- return `
232
- <manga>
233
- <manga_mangadb_id>${malId}</manga_mangadb_id>
234
- <manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
235
- <manga_volumes>0</manga_volumes>
236
- <manga_chapters>${chapters ? chapters : 0}</manga_chapters>
237
- <my_id>0</my_id>
238
- <my_read_chapters>${progress}</my_read_chapters>
239
- <my_start_date>0000-00-00</my_start_date>
240
- <my_finish_date>0000-00-00</my_finish_date>
241
- <my_score>0</my_score>
242
- <my_status>${status}</my_status>
243
- <my_reread_value></my_reread_value>
244
- <my_priority>LOW</my_priority>
245
- <my_rereading>0</my_rereading>
246
- <my_discuss>0</my_discuss>
247
- <update_on_import>1</update_on_import>
231
+ return `
232
+ <manga>
233
+ <manga_mangadb_id>${malId}</manga_mangadb_id>
234
+ <manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
235
+ <manga_volumes>0</manga_volumes>
236
+ <manga_chapters>${chapters ? chapters : 0}</manga_chapters>
237
+ <my_id>0</my_id>
238
+ <my_read_chapters>${progress}</my_read_chapters>
239
+ <my_start_date>0000-00-00</my_start_date>
240
+ <my_finish_date>0000-00-00</my_finish_date>
241
+ <my_score>0</my_score>
242
+ <my_status>${status}</my_status>
243
+ <my_reread_value></my_reread_value>
244
+ <my_priority>LOW</my_priority>
245
+ <my_rereading>0</my_rereading>
246
+ <my_discuss>0</my_discuss>
247
+ <update_on_import>1</update_on_import>
248
248
  </manga>`;
249
249
  }
250
250
  function createAnimeListXML(mediaWithProgress) {
@@ -267,19 +267,19 @@ function createAnimeListXML(mediaWithProgress) {
267
267
  const format = anime.format ? anime.format : "";
268
268
  return createAnimeXML(malId, progress, status, episodes, title, format);
269
269
  });
270
- return `<myanimelist>
271
- <myinfo>
272
- <user_id/>
273
- <user_name>${yield Auth.MyUserName()}</user_name>
274
- <user_export_type>1</user_export_type>
275
- <user_total_anime>0</user_total_anime>
276
- <user_total_watching>0</user_total_watching>
277
- <user_total_completed>0</user_total_completed>
278
- <user_total_onhold>0</user_total_onhold>
279
- <user_total_dropped>0</user_total_dropped>
280
- <user_total_plantowatch>0</user_total_plantowatch>
281
- </myinfo>
282
- \n${xmlEntries.join("\n")}\n
270
+ return `<myanimelist>
271
+ <myinfo>
272
+ <user_id/>
273
+ <user_name>${yield Auth.MyUserName()}</user_name>
274
+ <user_export_type>1</user_export_type>
275
+ <user_total_anime>0</user_total_anime>
276
+ <user_total_watching>0</user_total_watching>
277
+ <user_total_completed>0</user_total_completed>
278
+ <user_total_onhold>0</user_total_onhold>
279
+ <user_total_dropped>0</user_total_dropped>
280
+ <user_total_plantowatch>0</user_total_plantowatch>
281
+ </myinfo>
282
+ \n${xmlEntries.join("\n")}\n
283
283
  </myanimelist>`;
284
284
  });
285
285
  }
@@ -302,19 +302,19 @@ function createMangaListXML(mediaWithProgress) {
302
302
  const status = statusMap[manga.status];
303
303
  return createMangaXML(malId, progress, status, chapters, title);
304
304
  });
305
- return `<myanimelist>
306
- <myinfo>
307
- <user_id/>
308
- <user_name>${yield Auth.MyUserName()}</user_name>
309
- <user_export_type>2</user_export_type>
310
- <user_total_manga>5</user_total_manga>
311
- <user_total_reading>1</user_total_reading>
312
- <user_total_completed>1</user_total_completed>
313
- <user_total_onhold>1</user_total_onhold>
314
- <user_total_dropped>1</user_total_dropped>
315
- <user_total_plantoread>1</user_total_plantoread>
316
- </myinfo>
317
- \n${xmlEntries.join("\n")}\n
305
+ return `<myanimelist>
306
+ <myinfo>
307
+ <user_id/>
308
+ <user_name>${yield Auth.MyUserName()}</user_name>
309
+ <user_export_type>2</user_export_type>
310
+ <user_total_manga>5</user_total_manga>
311
+ <user_total_reading>1</user_total_reading>
312
+ <user_total_completed>1</user_total_completed>
313
+ <user_total_onhold>1</user_total_onhold>
314
+ <user_total_dropped>1</user_total_dropped>
315
+ <user_total_plantoread>1</user_total_plantoread>
316
+ </myinfo>
317
+ \n${xmlEntries.join("\n")}\n
318
318
  </myanimelist>`;
319
319
  });
320
320
  }
@@ -383,21 +383,21 @@ const anidbToanilistMapper = (romanjiName, year, englishName) => __awaiter(void
383
383
  function activityBy(activity, count) {
384
384
  var _a, _b, _c, _d;
385
385
  if ((_a = activity === null || activity === void 0 ? void 0 : activity.messenger) === null || _a === void 0 ? void 0 : _a.name) {
386
- return `[${count ? `${count}/` : ""}${activity.id}]\t${activity.messenger.name} messaged ${activity.recipient.name}`;
386
+ return `[${count ? count : "?"}]\t${activity.messenger.name} >> messaged ${activity.recipient.name}`;
387
387
  }
388
388
  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) {
389
389
  if (activity.progress) {
390
- return `[${count ? `${count}/` : ""}${activity.id}]\t${activity.user.name} ${activity.status} ${activity.progress} of ${activity.media.title.userPreferred}`;
390
+ return `[${count ? count : "?"}]\t${activity.user.name} >> ${activity.status} ${activity.progress} of ${activity.media.title.userPreferred}`;
391
391
  }
392
392
  else {
393
- return `[${count ? `${count}/` : ""}${activity.id}]\t${activity.user.name} ${activity.status} ${activity.media.title.userPreferred}`;
393
+ return `[${count ? count : "?"}]\t${activity.user.name} >> ${activity.status} ${activity.media.title.userPreferred}`;
394
394
  }
395
395
  }
396
396
  else if ((_d = activity === null || activity === void 0 ? void 0 : activity.user) === null || _d === void 0 ? void 0 : _d.name) {
397
- return `[${count ? `${count}/` : ""}${activity.id}]\t${activity.user.name}`;
397
+ return `[${count ? count : "?"}]\t${activity.user.name}`;
398
398
  }
399
399
  else {
400
- return `[${count ? `${count}/` : ""}${activity === null || activity === void 0 ? void 0 : activity.id}] ???`;
400
+ return `[${count ? count : "?"} ???`;
401
401
  }
402
402
  }
403
403
  /**
@@ -411,4 +411,10 @@ function saveToPath(data_type, file_format) {
411
411
  return join(getDownloadFolderPath(), `${yield Auth.MyUserName()}@irfanshadikrishad-anilist-${data_type}-${getFormattedDate()}.${file_format}`);
412
412
  });
413
413
  }
414
- export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, timestampToTimeAgo, };
414
+ function simpleDateFormat(date) {
415
+ if (!date.day && !date.month && !date.year) {
416
+ return `null`;
417
+ }
418
+ return `${date === null || date === void 0 ? void 0 : date.day}/${date === null || date === void 0 ? void 0 : date.month}/${date === null || date === void 0 ? void 0 : date.year}`;
419
+ }
420
+ export { activityBy, anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
package/bin/index.js CHANGED
@@ -128,6 +128,13 @@ cli
128
128
  console.error(`\nInvalid or missing ID (${id}). Please provide a valid numeric ID.`);
129
129
  }
130
130
  }));
131
+ cli
132
+ .command("manga <id>")
133
+ .description("Get manga details by their ID")
134
+ .option("-c, --count <number>", "Number of items to get", "10")
135
+ .action((id) => __awaiter(void 0, void 0, void 0, function* () {
136
+ yield AniList.getMangaDetailsByID(id);
137
+ }));
131
138
  cli
132
139
  .command("search <query>")
133
140
  .alias("srch")
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@irfanshadikrishad/anilist",
3
3
  "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
4
  "author": "Irfan Shadik Rishad",
5
- "version": "1.0.0-forbidden.3",
5
+ "version": "1.0.0-forbidden.5",
6
6
  "main": "./bin/index.js",
7
7
  "type": "module",
8
8
  "types": "./bin/index.d.ts",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "scripts": {
16
16
  "build": "rm -rf ./bin && tsc",
17
- "buildw": "rm -rf ./bin && tsc -w",
17
+ "build:watch": "rm -rf ./bin && tsc -w",
18
18
  "format": "prettier . --write",
19
19
  "format:check": "prettier . --check",
20
20
  "lint": "eslint ./dist",
@@ -54,27 +54,27 @@
54
54
  },
55
55
  "license": "MPL-2.0",
56
56
  "devDependencies": {
57
- "@babel/preset-env": "^7.26.7",
58
- "@eslint/js": "^9.19.0",
57
+ "@babel/preset-env": "^7.26.9",
58
+ "@eslint/js": "^9.21.0",
59
59
  "@types/jest": "^29.5.14",
60
- "@types/node": "^22.12.0",
60
+ "@types/node": "^22.13.5",
61
61
  "@types/papaparse": "^5.3.15",
62
62
  "@types/xml2js": "^0.4.14",
63
- "@typescript-eslint/eslint-plugin": "^8.22.0",
64
- "eslint": "^9.19.0",
65
- "globals": "^15.14.0",
63
+ "@typescript-eslint/eslint-plugin": "^8.24.1",
64
+ "eslint": "^9.21.0",
65
+ "globals": "^16.0.0",
66
66
  "jest": "^29.7.0",
67
- "prettier": "^3.4.2",
67
+ "prettier": "^3.5.2",
68
68
  "prettier-plugin-organize-imports": "^4.1.0",
69
- "ts-jest": "^29.2.5",
69
+ "ts-jest": "^29.2.6",
70
70
  "ts-node": "^10.9.2",
71
71
  "typescript": "^5.7.3"
72
72
  },
73
73
  "dependencies": {
74
74
  "commander": "^13.1.0",
75
- "fast-xml-parser": "^4.5.1",
76
- "inquirer": "^12.3.3",
77
- "jsonrepair": "^3.11.2",
75
+ "fast-xml-parser": "^5.0.6",
76
+ "inquirer": "^12.4.2",
77
+ "jsonrepair": "^3.12.0",
78
78
  "node-fetch": "^3.3.2",
79
79
  "open": "^10.1.0",
80
80
  "papaparse": "^5.5.2",