@irfanshadikrishad/anilist 1.1.9 → 1.2.0-forbidden.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 → LICENSE.md} +382 -382
- package/README.md +245 -232
- package/assets/binance.jpg +0 -0
- package/bin/helpers/auth.d.ts +4 -0
- package/bin/helpers/auth.js +238 -50
- package/bin/helpers/fetcher.d.ts +3 -2
- package/bin/helpers/fetcher.js +9 -3
- package/bin/helpers/lists.d.ts +1 -1
- package/bin/helpers/lists.js +2 -2
- package/bin/helpers/mutations.d.ts +2 -1
- package/bin/helpers/mutations.js +37 -32
- package/bin/helpers/queries.d.ts +6 -3
- package/bin/helpers/queries.js +157 -128
- package/bin/helpers/workers.d.ts +2 -1
- package/bin/helpers/workers.js +76 -68
- package/bin/index.js +9 -5
- package/package.json +80 -75
package/bin/helpers/queries.js
CHANGED
|
@@ -1,132 +1,161 @@
|
|
|
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 } manga { count chaptersRead volumesRead } }
|
|
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 } manga { count chaptersRead volumesRead } }
|
|
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 } 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) {
|
|
124
|
-
id title { romaji english } }
|
|
125
|
-
}
|
|
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 } 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 } } }
|
|
126
124
|
`;
|
|
127
|
-
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
128
|
-
Media(idMal: $malId, type: MANGA) {
|
|
129
|
-
id title { romaji english } }
|
|
130
|
-
}
|
|
125
|
+
const malIdToAnilistMangaId = `query ($malId: Int) {
|
|
126
|
+
Media(idMal: $malId, type: MANGA) { id title { romaji english } } }
|
|
131
127
|
`;
|
|
132
|
-
|
|
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
|
+
`;
|
|
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
|
+
`;
|
|
150
|
+
const specificUserActivitiesQuery = `
|
|
151
|
+
query ($page: Int, $perPage: Int, $userId: Int) {
|
|
152
|
+
Page(page: $page, perPage: $perPage) {
|
|
153
|
+
activities(userId: $userId, sort: ID_DESC) {
|
|
154
|
+
... on TextActivity { id type isLiked createdAt user { id name } }
|
|
155
|
+
... on ListActivity { id type isLiked status progress media { title { userPreferred } } createdAt user { id name } }
|
|
156
|
+
... on MessageActivity { id type isLiked message createdAt recipient { id name } }
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
`;
|
|
161
|
+
export { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, animeDetailsQuery, animeSearchQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, deleteMangaEntryMutation, deleteMediaEntryMutation, followingActivitiesQuery, globalActivitiesQuery, malIdToAnilistAnimeId, malIdToAnilistMangaId, mangaSearchQuery, popularQuery, specificUserActivitiesQuery, trendingQuery, upcomingAnimesQuery, userActivityQuery, userQuery, };
|
package/bin/helpers/workers.d.ts
CHANGED
|
@@ -34,4 +34,5 @@ declare function createAnimeXML(malId: number, progress: number, status: MALAnim
|
|
|
34
34
|
declare function createMangaXML(malId: number, progress: number, status: MALMangaStatus, chapters: number, title: string): string;
|
|
35
35
|
declare function createAnimeListXML(mediaWithProgress: MediaWithProgress[]): Promise<string>;
|
|
36
36
|
declare function createMangaListXML(mediaWithProgress: MediaWithProgress[]): Promise<string>;
|
|
37
|
-
|
|
37
|
+
declare function getCurrentPackageVersion(): string | null;
|
|
38
|
+
export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, };
|
package/bin/helpers/workers.js
CHANGED
|
@@ -11,6 +11,7 @@ import fs from "fs";
|
|
|
11
11
|
import { readdir, writeFile } from "fs/promises";
|
|
12
12
|
import inquirer from "inquirer";
|
|
13
13
|
import { parse } from "json2csv";
|
|
14
|
+
import { createRequire } from "module";
|
|
14
15
|
import open from "open";
|
|
15
16
|
import { homedir } from "os";
|
|
16
17
|
import { join } from "path";
|
|
@@ -140,9 +141,10 @@ function selectFile(fileType) {
|
|
|
140
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
142
|
try {
|
|
142
143
|
const files = yield listFilesInDownloadFolder();
|
|
144
|
+
console.log(getDownloadFolderPath());
|
|
143
145
|
// Filter to include only files, not directories, with the specified extension
|
|
144
146
|
const onlyFiles = files.filter((file) => {
|
|
145
|
-
const filePath =
|
|
147
|
+
const filePath = `${getDownloadFolderPath()}/${file}`; // Adjust this to the correct path
|
|
146
148
|
const isFile = fs.lstatSync(filePath).isFile(); // Check if it's a file
|
|
147
149
|
return isFile && file.endsWith(fileType);
|
|
148
150
|
});
|
|
@@ -168,49 +170,49 @@ function selectFile(fileType) {
|
|
|
168
170
|
});
|
|
169
171
|
}
|
|
170
172
|
function createAnimeXML(malId, progress, status, episodes, title) {
|
|
171
|
-
return `
|
|
172
|
-
<anime>
|
|
173
|
-
<series_animedb_id>${malId}</series_animedb_id>
|
|
174
|
-
<series_title><![CDATA[${title}]]></series_title>
|
|
175
|
-
<series_type>""</series_type>
|
|
176
|
-
<series_episodes>${episodes}</series_episodes>
|
|
177
|
-
<my_id>0</my_id>
|
|
178
|
-
<my_watched_episodes>${progress}</my_watched_episodes>
|
|
179
|
-
<my_start_date>0000-00-00</my_start_date>
|
|
180
|
-
<my_finish_date>0000-00-00</my_finish_date>
|
|
181
|
-
<my_score>0</my_score>
|
|
182
|
-
<my_storage_value>0.00</my_storage_value>
|
|
183
|
-
<my_status>${status}</my_status>
|
|
184
|
-
<my_comments><![CDATA[]]></my_comments>
|
|
185
|
-
<my_times_watched>0</my_times_watched>
|
|
186
|
-
<my_rewatch_value></my_rewatch_value>
|
|
187
|
-
<my_priority>LOW</my_priority>
|
|
188
|
-
<my_tags><![CDATA[]]></my_tags>
|
|
189
|
-
<my_rewatching>0</my_rewatching>
|
|
190
|
-
<my_rewatching_ep>0</my_rewatching_ep>
|
|
191
|
-
<my_discuss>0</my_discuss>
|
|
192
|
-
<my_sns>default</my_sns>
|
|
193
|
-
<update_on_import>1</update_on_import>
|
|
173
|
+
return `
|
|
174
|
+
<anime>
|
|
175
|
+
<series_animedb_id>${malId}</series_animedb_id>
|
|
176
|
+
<series_title><![CDATA[${title}]]></series_title>
|
|
177
|
+
<series_type>""</series_type>
|
|
178
|
+
<series_episodes>${episodes}</series_episodes>
|
|
179
|
+
<my_id>0</my_id>
|
|
180
|
+
<my_watched_episodes>${progress}</my_watched_episodes>
|
|
181
|
+
<my_start_date>0000-00-00</my_start_date>
|
|
182
|
+
<my_finish_date>0000-00-00</my_finish_date>
|
|
183
|
+
<my_score>0</my_score>
|
|
184
|
+
<my_storage_value>0.00</my_storage_value>
|
|
185
|
+
<my_status>${status}</my_status>
|
|
186
|
+
<my_comments><![CDATA[]]></my_comments>
|
|
187
|
+
<my_times_watched>0</my_times_watched>
|
|
188
|
+
<my_rewatch_value></my_rewatch_value>
|
|
189
|
+
<my_priority>LOW</my_priority>
|
|
190
|
+
<my_tags><![CDATA[]]></my_tags>
|
|
191
|
+
<my_rewatching>0</my_rewatching>
|
|
192
|
+
<my_rewatching_ep>0</my_rewatching_ep>
|
|
193
|
+
<my_discuss>0</my_discuss>
|
|
194
|
+
<my_sns>default</my_sns>
|
|
195
|
+
<update_on_import>1</update_on_import>
|
|
194
196
|
</anime>`;
|
|
195
197
|
}
|
|
196
198
|
function createMangaXML(malId, progress, status, chapters, title) {
|
|
197
|
-
return `
|
|
198
|
-
<manga>
|
|
199
|
-
<manga_mangadb_id>${malId}</manga_mangadb_id>
|
|
200
|
-
<manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
|
|
201
|
-
<manga_volumes>0</manga_volumes>
|
|
202
|
-
<manga_chapters>${chapters ? chapters : 0}</manga_chapters>
|
|
203
|
-
<my_id>0</my_id>
|
|
204
|
-
<my_read_chapters>${progress}</my_read_chapters>
|
|
205
|
-
<my_start_date>0000-00-00</my_start_date>
|
|
206
|
-
<my_finish_date>0000-00-00</my_finish_date>
|
|
207
|
-
<my_score>0</my_score>
|
|
208
|
-
<my_status>${status}</my_status>
|
|
209
|
-
<my_reread_value></my_reread_value>
|
|
210
|
-
<my_priority>LOW</my_priority>
|
|
211
|
-
<my_rereading>0</my_rereading>
|
|
212
|
-
<my_discuss>0</my_discuss>
|
|
213
|
-
<update_on_import>1</update_on_import>
|
|
199
|
+
return `
|
|
200
|
+
<manga>
|
|
201
|
+
<manga_mangadb_id>${malId}</manga_mangadb_id>
|
|
202
|
+
<manga_title><![CDATA[${title ? title : "unknown"}]]></manga_title>
|
|
203
|
+
<manga_volumes>0</manga_volumes>
|
|
204
|
+
<manga_chapters>${chapters ? chapters : 0}</manga_chapters>
|
|
205
|
+
<my_id>0</my_id>
|
|
206
|
+
<my_read_chapters>${progress}</my_read_chapters>
|
|
207
|
+
<my_start_date>0000-00-00</my_start_date>
|
|
208
|
+
<my_finish_date>0000-00-00</my_finish_date>
|
|
209
|
+
<my_score>0</my_score>
|
|
210
|
+
<my_status>${status}</my_status>
|
|
211
|
+
<my_reread_value></my_reread_value>
|
|
212
|
+
<my_priority>LOW</my_priority>
|
|
213
|
+
<my_rereading>0</my_rereading>
|
|
214
|
+
<my_discuss>0</my_discuss>
|
|
215
|
+
<update_on_import>1</update_on_import>
|
|
214
216
|
</manga>`;
|
|
215
217
|
}
|
|
216
218
|
function createAnimeListXML(mediaWithProgress) {
|
|
@@ -230,19 +232,19 @@ function createAnimeListXML(mediaWithProgress) {
|
|
|
230
232
|
const status = statusMap[anime.status];
|
|
231
233
|
return createAnimeXML(malId, progress, status, episodes, title);
|
|
232
234
|
});
|
|
233
|
-
return `<myanimelist>
|
|
234
|
-
<myinfo>
|
|
235
|
-
<user_id/>
|
|
236
|
-
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
237
|
-
<user_export_type>1</user_export_type>
|
|
238
|
-
<user_total_anime>0</user_total_anime>
|
|
239
|
-
<user_total_watching>0</user_total_watching>
|
|
240
|
-
<user_total_completed>0</user_total_completed>
|
|
241
|
-
<user_total_onhold>0</user_total_onhold>
|
|
242
|
-
<user_total_dropped>0</user_total_dropped>
|
|
243
|
-
<user_total_plantowatch>0</user_total_plantowatch>
|
|
244
|
-
</myinfo>
|
|
245
|
-
\n${xmlEntries.join("\n")}\n
|
|
235
|
+
return `<myanimelist>
|
|
236
|
+
<myinfo>
|
|
237
|
+
<user_id/>
|
|
238
|
+
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
239
|
+
<user_export_type>1</user_export_type>
|
|
240
|
+
<user_total_anime>0</user_total_anime>
|
|
241
|
+
<user_total_watching>0</user_total_watching>
|
|
242
|
+
<user_total_completed>0</user_total_completed>
|
|
243
|
+
<user_total_onhold>0</user_total_onhold>
|
|
244
|
+
<user_total_dropped>0</user_total_dropped>
|
|
245
|
+
<user_total_plantowatch>0</user_total_plantowatch>
|
|
246
|
+
</myinfo>
|
|
247
|
+
\n${xmlEntries.join("\n")}\n
|
|
246
248
|
</myanimelist>`;
|
|
247
249
|
});
|
|
248
250
|
}
|
|
@@ -263,20 +265,26 @@ function createMangaListXML(mediaWithProgress) {
|
|
|
263
265
|
const status = statusMap[manga.status];
|
|
264
266
|
return createMangaXML(malId, progress, status, chapters, title);
|
|
265
267
|
});
|
|
266
|
-
return `<myanimelist>
|
|
267
|
-
<myinfo>
|
|
268
|
-
<user_id/>
|
|
269
|
-
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
270
|
-
<user_export_type>2</user_export_type>
|
|
271
|
-
<user_total_manga>5</user_total_manga>
|
|
272
|
-
<user_total_reading>1</user_total_reading>
|
|
273
|
-
<user_total_completed>1</user_total_completed>
|
|
274
|
-
<user_total_onhold>1</user_total_onhold>
|
|
275
|
-
<user_total_dropped>1</user_total_dropped>
|
|
276
|
-
<user_total_plantoread>1</user_total_plantoread>
|
|
277
|
-
</myinfo>
|
|
278
|
-
\n${xmlEntries.join("\n")}\n
|
|
268
|
+
return `<myanimelist>
|
|
269
|
+
<myinfo>
|
|
270
|
+
<user_id/>
|
|
271
|
+
<user_name>${yield Auth.MyUserName()}</user_name>
|
|
272
|
+
<user_export_type>2</user_export_type>
|
|
273
|
+
<user_total_manga>5</user_total_manga>
|
|
274
|
+
<user_total_reading>1</user_total_reading>
|
|
275
|
+
<user_total_completed>1</user_total_completed>
|
|
276
|
+
<user_total_onhold>1</user_total_onhold>
|
|
277
|
+
<user_total_dropped>1</user_total_dropped>
|
|
278
|
+
<user_total_plantoread>1</user_total_plantoread>
|
|
279
|
+
</myinfo>
|
|
280
|
+
\n${xmlEntries.join("\n")}\n
|
|
279
281
|
</myanimelist>`;
|
|
280
282
|
});
|
|
281
283
|
}
|
|
282
|
-
|
|
284
|
+
function getCurrentPackageVersion() {
|
|
285
|
+
const require = createRequire(import.meta.url);
|
|
286
|
+
const packageJson = require("../../package.json");
|
|
287
|
+
const version = packageJson.version;
|
|
288
|
+
return version || null;
|
|
289
|
+
}
|
|
290
|
+
export { aniListEndpoint, createAnimeListXML, createAnimeXML, createMangaListXML, createMangaXML, formatDateObject, getCurrentPackageVersion, getDownloadFolderPath, getFormattedDate, getNextSeasonAndYear, getTitle, redirectUri, removeHtmlAndMarkdown, saveJSONasCSV, saveJSONasJSON, selectFile, };
|
package/bin/index.js
CHANGED
|
@@ -9,18 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { Command } from "commander";
|
|
12
|
-
import { createRequire } from "module";
|
|
13
12
|
import process from "process";
|
|
14
13
|
import { Auth } from "./helpers/auth.js";
|
|
15
14
|
import { AniList } from "./helpers/lists.js";
|
|
16
|
-
|
|
17
|
-
const packageJson = require("../package.json");
|
|
18
|
-
const version = packageJson.version;
|
|
15
|
+
import { getCurrentPackageVersion } from "./helpers/workers.js";
|
|
19
16
|
const cli = new Command();
|
|
20
17
|
cli
|
|
21
18
|
.name("anilist")
|
|
22
19
|
.description("Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts.")
|
|
23
|
-
.version(
|
|
20
|
+
.version(getCurrentPackageVersion());
|
|
24
21
|
cli
|
|
25
22
|
.command("login")
|
|
26
23
|
.description("Login with AniList")
|
|
@@ -206,4 +203,11 @@ cli
|
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
205
|
}));
|
|
206
|
+
cli
|
|
207
|
+
.command("autolike")
|
|
208
|
+
.alias("al")
|
|
209
|
+
.description("Autolike following or global activities.")
|
|
210
|
+
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
211
|
+
yield Auth.AutoLike();
|
|
212
|
+
}));
|
|
209
213
|
cli.parse(process.argv);
|