node-shikimori-api - Why? Because.
Installing
Using npm
npm i node-shikimori-api
Using yarn
yarn add node-shikimori-api
Common Usage
Basics:
const Shikimori = ;const shiki = ; shikiapi;
Authorizing with OAuth2
const Shikimori = ;const shiki = ; shikiauth;
Address paths
Shikimori uses some parts of the address as parameters (for example, user id)
How to transfer them? Suppose we need to make a request to ../api/users/zerotwo/history, where zerotwo is the user id (https://shikimori.org/api/doc/1.0/users/history)
To do this, do the following:
shikiapi;
Also, if the method should be sent POST request instead of GET (for example, to send a message)
To do this, use the parameter "method"
shikiapi;
V2 api support
shikiapi;
Parameters for request is merged with wrapper parameters
In deep, he's get next parameters if exists: method, user_id, anime_id, id, v
And removes it from request parameters
Custom methods
The module has some of its methods that were implemented by parsing and sniffing traffic to the site
Search
shikiutils;
Available types: animes, mangas, ranobe, characters, people, users
Also, "people" type may take kind params: seyu, producer, mangaka
Example:
shikiutils;
Mark history by days
By default, the site's api does not sort the user history, but a function was written that marks array elements by day
This will help you filter/sort the array.
Usage:
shikiapi
Default response:
id: 136013914 created_at: "2019-03-12T18:37:35.621+03:00" description: "Просмотрены 2-й и 3-й эпизоды" target: {} //...
Marked response:
id: 136013914 created_at: "2019-03-12T18:37:35.621+03:00" day_mark: "today" // this one day_mark_ru: "Сегодня" // and this description: "Просмотрены 2-й и 3-й эпизоды" target: {} //...
day_mark may have next values: today, yesterday, weekly, other