@irfanshadikrishad/anilist 1.2.15 → 1.2.16
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 +11 -0
- package/bin/helpers/lists.d.ts +1 -0
- package/bin/helpers/lists.js +29 -2
- package/bin/helpers/queries.d.ts +2 -1
- package/bin/helpers/queries.js +9 -1
- package/bin/helpers/types.d.ts +31 -4
- package/bin/helpers/workers.d.ts +3 -2
- package/bin/helpers/workers.js +7 -1
- package/bin/index.js +7 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -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) |
|
|
@@ -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
|
package/bin/helpers/lists.d.ts
CHANGED
|
@@ -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
|
}
|
package/bin/helpers/lists.js
CHANGED
|
@@ -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;
|
package/bin/helpers/queries.d.ts
CHANGED
|
@@ -22,4 +22,5 @@ declare const malIdToAnilistMangaId = "query ($malId: Int) {\n Media(idMal: $ma
|
|
|
22
22
|
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";
|
|
23
23
|
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";
|
|
24
24
|
declare const toggleFollowMutation = "mutation ($userId: Int!) {\n ToggleFollow(userId: $userId) { id name isFollower isFollowing }\n}\n";
|
|
25
|
-
|
|
25
|
+
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";
|
|
26
|
+
export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
|
package/bin/helpers/queries.js
CHANGED
|
@@ -147,4 +147,12 @@ const toggleFollowMutation = `mutation ($userId: Int!) {
|
|
|
147
147
|
ToggleFollow(userId: $userId) { id name isFollower isFollowing }
|
|
148
148
|
}
|
|
149
149
|
`;
|
|
150
|
-
|
|
150
|
+
const mangaDetailsQuery = `query ($id: Int) {
|
|
151
|
+
Media(id: $id, type: MANGA) {
|
|
152
|
+
id title { romaji english native userPreferred } coverImage { color medium large extraLarge }
|
|
153
|
+
bannerImage description chapters volumes status genres
|
|
154
|
+
startDate { year month day } endDate { year month day }
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaDetailsQuery, mangaSearchQuery, popularQuery, toggleFollowMutation, trendingQuery, upcomingAnimesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, };
|
package/bin/helpers/types.d.ts
CHANGED
|
@@ -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?: {
|
|
@@ -380,4 +380,31 @@ type Activity = {
|
|
|
380
380
|
};
|
|
381
381
|
createdAt: number;
|
|
382
382
|
};
|
|
383
|
-
|
|
383
|
+
type Error = {
|
|
384
|
+
message: string;
|
|
385
|
+
}[];
|
|
386
|
+
type CoverImage = {
|
|
387
|
+
color: string;
|
|
388
|
+
medium: string;
|
|
389
|
+
large: string;
|
|
390
|
+
extraLarge: string;
|
|
391
|
+
};
|
|
392
|
+
type MangaDetails = {
|
|
393
|
+
data?: {
|
|
394
|
+
Media: {
|
|
395
|
+
id: number;
|
|
396
|
+
title: MediaTitle;
|
|
397
|
+
coverImage: CoverImage;
|
|
398
|
+
bannerImage: string;
|
|
399
|
+
description: string;
|
|
400
|
+
chapters: number | null;
|
|
401
|
+
volumes: number | null;
|
|
402
|
+
status: string;
|
|
403
|
+
genres: [string];
|
|
404
|
+
startDate: DateMonthYear;
|
|
405
|
+
endDate: DateMonthYear;
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
errors?: Error;
|
|
409
|
+
};
|
|
410
|
+
export { Activity, AniListMediaStatus, AnimeDetails, AnimeList, AnimeSearchResponse, DateMonthYear, DeleteMangaResponse, DeleteMediaListResponse, List, MALAnimeStatus, MALAnimeXML, MALMangaStatus, MalIdToAnilistIdResponse, MangaDetails, MediaEntry, MediaList, MediaListCollectionResponse, MediaListEntry, MediaTitle, MediaWithProgress, Myself, SaveMediaListEntryResponse, SaveTextActivityResponse, ToggleFollowResponse, User, UserActivitiesResponse, UserFollower, UserFollowing, UserResponse, saveAnimeWithProgressResponse, };
|
package/bin/helpers/workers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MALAnimeStatus, MALMangaStatus, MediaWithProgress } from "./types.js";
|
|
1
|
+
import { DateMonthYear, MALAnimeStatus, MALMangaStatus, MediaWithProgress } 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: {
|
|
@@ -45,4 +45,5 @@ declare const anidbToanilistMapper: (romanjiName: string, year: number, englishN
|
|
|
45
45
|
* @returns string of file path
|
|
46
46
|
*/
|
|
47
47
|
declare function saveToPath(data_type: string, file_format: string): Promise<string>;
|
|
48
|
-
|
|
48
|
+
declare function simpleDateFormat(date: DateMonthYear): string;
|
|
49
|
+
export { anidbToanilistMapper, aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, saveJSONasXML, saveToPath, selectFile, simpleDateFormat, timestampToTimeAgo, };
|
package/bin/helpers/workers.js
CHANGED
|
@@ -392,4 +392,10 @@ function saveToPath(data_type, file_format) {
|
|
|
392
392
|
return join(getDownloadFolderPath(), `${yield Auth.MyUserName()}@irfanshadikrishad-anilist-${data_type}-${getFormattedDate()}.${file_format}`);
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
|
-
|
|
395
|
+
function simpleDateFormat(date) {
|
|
396
|
+
if (!date.day && !date.month && !date.year) {
|
|
397
|
+
return `null`;
|
|
398
|
+
}
|
|
399
|
+
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}`;
|
|
400
|
+
}
|
|
401
|
+
export { 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.2.
|
|
5
|
+
"version": "1.2.16",
|
|
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
|
-
"
|
|
17
|
+
"build:watch": "rm -rf ./bin && tsc -w",
|
|
18
18
|
"format": "prettier . --write",
|
|
19
19
|
"format:check": "prettier . --check",
|
|
20
20
|
"lint": "eslint ./dist",
|