Skip to content

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
- Updated lists query so that it can handle lists larger than 600 better. Each entry will now provide bare minimum information.

- Fixed an issue with list media trying to format recommendations when there was none.
  • Loading branch information
AurelicButter committed Apr 21, 2020
1 parent ad27f58 commit bc7925f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 35 deletions.
40 changes: 28 additions & 12 deletions documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ Names must be strings and ids must be numbers.
- `staff.characters` | An array of ids and the english names of all characters that the staff has voiced (Up to the first 25 on the list.)

# Search
- `Anilist.search(type, term, page, amount)` | Searches the database for an anime or manga that resembles the term provided.
Accepted types: anime, manga, character, staff, studio
Term: Search input (ie: Occultic;Nine)
Page: Page number of the search
Amount: Amount of results on the page
- `Anilist.search(type, term, page, amount)` | Searches the database for an anime or manga that resembles the term provided.<br>
Accepted types: anime, manga, character, staff, studio<br>
Term: Search input (ie: Occultic;Nine)<br>
Page: Page number of the search, defaults to 1.<br>
Amount: Amount of results on the page, defaults to 5.
- `search.pageInfo` | Page object
- `pageInfo.total` | Total amount of pages in search
- `pageInfo.currentPage` | Current page of the search
Expand All @@ -110,9 +110,9 @@ Names must be strings and ids must be numbers.
# User
## Functions
Usernames must be strings and ids must be numbers!<br/>
`Anilist.user.all(username|id)` | All user profile function<br/>
`Anilist.user.stats(username|id)` | User stats function<br/>
`Anilist.user.profile(username|id)` | User profile function<br/>
`Anilist.user.all(username|id)` | All user profile function, grabs both statistics and profile items.<br/>
`Anilist.user.stats(username|id)` | Grabs all statistics for the given user. Contains no profile unique items.<br/>
`Anilist.user.profile(username|id)` | Grabs all profile unique data. Contains no statistics of the user.<br/>

## Profile Unique
- `profile.id` | User's id
Expand Down Expand Up @@ -189,13 +189,29 @@ Usernames must be strings and ids must be numbers!<br/>
- `list.isCustomList` | Checks if the list is a custom one (not created by default by AniList)
- `list.isSplitCompletedList` | Checks if the list is a split completed list ie. if the user chose to have each completed media format in a separate list (toggled in user's settings)
- `list.status` | The user's list status ("CURRENT", "PLANNING", "COMPLETED", "PAUSED", "DROPPED", "REPEATING")
- `list.entries` | List of entries in this list, containing the media and related information
- `entry.media` | The media linked to that entry (refer to the `Media` paragraph for all properties)
- `entry.userId` | The user's id
- `list.entries` | List of entries in this list
- `entry.media` | An object containing various media information for the entry.
- `media.id` | The id of the media
- `media.idMAL` | The MAL id of the media
- `media.title` | Media title. Gives four values: romaji, English, native, userPreferred [Requires login for userPreferred]
- `media.description` | Media description
- `media.format` | Format of the media (ie: TV, OVA, Novel)
- `media.tags` | Tags that describes the media. Gives a name and checks if it is a media spoiler for each tag
- `media.startDate` | Official release date of the media
- `media.endDate` | Official end date of the media
- `media.genres` | Media genres
- `media.isFavourite` | [Requires login] Checks if media is on the user's favourites list
- `media.isAdult` | Checks if media is for adult audiences (ie: Hentai)
- `media.synonyms` | Media's alternative titles
- `media.siteUrl` | The media's Anilist page
- `media.duration` | Anime only. General length of an episode
- `media.episodes` | Anime only. Number of episodes
- `media.volumes` | Manga only. Number of volumes
- `media.chapters` | Manga only. Number of chapters.
- `entry.status` | The user's status ("CURRENT", "PLANNING", "COMPLETED", "PAUSED", "DROPPED", "REPEATING") for that media
- `entry.score` | The user's score for that media
- `entry.progress` | The user's progress for that media (episodes for anime, chapters for manga)
- `entry.progressVolumes` | Only if the media is a mange. The user's volume progress for that manga
- `entry.progressVolumes` | Manga media only. The user's volume progress for that manga
- `entry.repeat` | The amount of times the user rewatched or read the media
- `entry.priority` | The user's priority for that media
- `entry.private` | Check if the entry should only be visible to authenticated user
Expand Down
5 changes: 2 additions & 3 deletions lib/fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ async function formatMedia(media) {

if (media.airingSchedule) { media.airingSchedule = media.airingSchedule.nodes; }
if (media.studios) { media.studios = media.studios.nodes; }
media.recommendations = media.recommendations.nodes;
media.relations = media.relations.nodes;
media.trends = media.trends.nodes;
media.recommendations = media.recommendations.nodes;

if (media.synonyms.length < 1) { media.synonyms = null; }

Expand Down Expand Up @@ -133,8 +133,7 @@ module.exports = {
return json.data.User;
} else if (json.data.MediaListCollection) {
json.data.MediaListCollection.lists.forEach(list => {
list.entries.map(entry => {
formatMedia(entry.media);
list.entries.map(entry => { //Media does not need to be formated in a list query.
entry.dates = {
'startedAt': convertFuzzyDate(entry.startedAt),
'completedAt': convertFuzzyDate(entry.completedAt),
Expand Down
26 changes: 8 additions & 18 deletions lib/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@ module.exports = {

var start = variables(user, 'ANIME');
var query = start[1] + `lists { name isCustomList isSplitCompletedList status entries {
media { id idMal title { romaji english native userPreferred } type episodes description format status startDate { year month day }
endDate { year month day } season duration countryOfOrigin isLicensed source hashtag trailer { id site } updatedAt coverImage { large medium }
bannerImage genres synonyms averageScore meanScore popularity trending tags { name isMediaSpoiler }
relations { nodes { id idMal title { english native romaji userPreferred } type format } }
characters { nodes { id name { full } } } staff { nodes { id name { full native } } } studios { nodes { id name } }
isFavourite isAdult nextAiringEpisode { timeUntilAiring airingAt } airingSchedule { nodes { airingAt timeUntilAiring } }
trends { nodes { date trending popularity inProgress } } externalLinks { url }
streamingEpisodes { title thumbnail url site } rankings { id } mediaListEntry { id }
reviews { nodes { id score summary body } } siteUrl autoCreateForumThread modNotes }
userId status score progress repeat priority private notes hiddenFromStatusLists
media { id idMal title { romaji english native userPreferred }
episodes description format startDate { year month day } endDate { year month day }
duration genres synonyms tags { name isMediaSpoiler } isFavourite isAdult siteUrl }
status score progress repeat priority private notes hiddenFromStatusLists
advancedScores startedAt { year month day } completedAt { year month day } updatedAt createdAt } } } }`;
return send(query, start[0]);
},
Expand All @@ -41,14 +35,10 @@ module.exports = {

var start = variables(user, 'MANGA');
var query = start[1] + `lists { name isCustomList isSplitCompletedList status entries {
media { id idMal title { romaji english native userPreferred }
type description format status startDate { year month day } endDate { year month day } volumes countryOfOrigin isLicensed updatedAt
coverImage { large medium } bannerImage genres synonyms averageScore meanScore siteUrl autoCreateForumThread modNotes
popularity trending tags { name isMediaSpoiler } relations { nodes { id idMal title { english native romaji userPreferred } type format } }
characters { nodes { id name { full } } } staff { nodes { id name { full native } } } isFavourite isAdult
trends { nodes { date trending popularity inProgress } } externalLinks { url } rankings { id }
mediaListEntry { id } reviews { nodes { id score summary body } } }
userId status score progress progressVolumes repeat priority private notes hiddenFromStatusLists
media { id idMal title { romaji english native userPreferred }
volumes chapters description format startDate { year month day } endDate { year month day }
genres synonyms tags { name isMediaSpoiler } isFavourite isAdult siteUrl }
status score progress progressVolumes repeat priority private notes hiddenFromStatusLists
advancedScores startedAt { year month day } completedAt { year month day } updatedAt createdAt } } } }`;
return send(query, start[0]);
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "anilist-node",
"version": "1.3.1",
"version": "1.4.0",
"description": "A lightweight Node.js wrapper for the AniList API",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit bc7925f

Please sign in to comment.