2.1.0 • Published 4 years ago

node-anemy v2.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

Node-anemy

GitHub license Github all releases GitHub stars GitHub watchers GitHub issues GitHub issues-closed

node-anemy is a unofficial module which facilitates the use of the apis of the anemy site

New Features!

  • Decode html entities
  • Convert html to markdown
  • Set limit string length
  • Automatically choose between like and static

Installation

install with npm

npm install node-anemy

install with yarn

yarn add node-anemy

Exemple

await/async function

const {Client} = require('node-anemy');
const anemy = new Client({
    token: '[your token]',
});

async function test() {
    const anime = await anemy.getAnime({id: 1});
    console.log(anime);
};

test();

returns

{
  id: 1,
  nom: 'March Comes in Like a Lion 2',
  affiche: 'https://cdn.anemy.fr/animes/affiche/3-gatsu-no-Lion-2-14-Octobre-2017-1-SipRnMVyTKg.jpg',
  image: 'https://cdn.anemy.fr/animes/banniere/3-gatsu-no-Lion-2-14-Octobre-2017-1-SipRnMVyTKg.jpg',
  episodes: '22',
  date_debut1: '14',
  date_debut2: 'Octobre',
  date_debut3: '2017',
  date_fin1: '31',
  date_fin2: 'Mars',
  date_fin3: '2018',
  statut: 'Terminé',
  licence: 'Wakanim',
  saison: 'Automne 2017',
  studio: 'Shaft',
  producteurs: " Aniplex, Dentsu, NHK, Hakusensha, Asmik Ace, Toy's Factory",
  source: 'Manga',
  hashtag: '3gatsunolion2',
  duree: '25min',
  categorie: 'Drame, Tranche de vie',
  format: 'Série TV',
  romaji: '3-gatsu no Lion 2',
  anglais: 'March Comes in Like a Lion 2',
  native: '3月のライオン 2',
  description: '<p>Deuxi&egrave;me saison de 3-gatsu no Lion</p>\r\n',
  trailer: 'SipRnMVyTKg',
  pays: 'Japon',
  adulte: 0,
  id_pseudo_uploader: 1
}

Promise function

const Anemy = require('node-anemy');
const anemy = new Anemy();

anemy.getAnime({id: 1}).then(console.log);

returns

{
  id: 1,
  nom: 'March Comes in Like a Lion 2',
  affiche: 'https://cdn.anemy.fr/animes/affiche/3-gatsu-no-Lion-2-14-Octobre-2017-1-SipRnMVyTKg.jpg',
  image: 'https://cdn.anemy.fr/animes/banniere/3-gatsu-no-Lion-2-14-Octobre-2017-1-SipRnMVyTKg.jpg',
  episodes: '22',
  date_debut1: '14',
  date_debut2: 'Octobre',
  date_debut3: '2017',
  date_fin1: '31',
  date_fin2: 'Mars',
  date_fin3: '2018',
  statut: 'Terminé',
  licence: 'Wakanim',
  saison: 'Automne 2017',
  studio: 'Shaft',
  producteurs: " Aniplex, Dentsu, NHK, Hakusensha, Asmik Ace, Toy's Factory",
  source: 'Manga',
  hashtag: '3gatsunolion2',
  duree: '25min',
  categorie: 'Drame, Tranche de vie',
  format: 'Série TV',
  romaji: '3-gatsu no Lion 2',
  anglais: 'March Comes in Like a Lion 2',
  native: '3月のライオン 2',
  description: '<p>Deuxi&egrave;me saison de 3-gatsu no Lion</p>\r\n',
  trailer: 'SipRnMVyTKg',
  pays: 'Japon',
  adulte: 0,
  id_pseudo_uploader: 1
}

Options

client option

{
    // You can get your token here: https://anemy.fr/developpeur.php
    // default null
    token: '[Your token]',
    // You can modify the urls and the version of the requests
    http: {
        // API url
        api: 'https://api.anemy.fr', // default
        // CDN url
        cdn: 'https://cdn.anemy.fr', // default
        // Version of API
        version: 1, // default
    },
    // add% either in front, behind or both for as params like
    // choose from 'front', 'behind', 'both'
    percent: 'both', // default
    // request timeout
    restRequestTimeout: 15000, // default
    // Decode html entities
    htmlEntitiesDecoder: false, // default
    // Convert html to markdown
    MarkdownEncoder: false, // default
    // Set limite string
    // default null
    setLimitString: 1000,
}

getAnime option

{
    // id [number]
    id: 167,
    // name [string]
    name: 'That Time I Got Reincarnated as a Slime',
    // episodes [number]
    episodes: 24,
    // dayStart [number] (it's the day the anime starts to air)
    dayStart: 2,
    // monthStart [number] (this is the month when the anime started to air)
    monthStart: 9,
    // yearStart [number] (c'est l'année de début de diffusion de l'anime)
    yearStart: 2018,
    // dayEnd [number] (it's the day the anime ends)
    dayEnd: 19,
    // monthEnd [number] (this is the end of the anime's broadcast month)
    monthEnd: 3,
    // yearEnd [number] (this is the year when the anime ended)
    yearEnd: 2019,
    // statut [string] (Terminé, Sortie en cours, Pas sortie, Annulé)
    statut: 'Terminé',
    // season [string] (Hiver 2019, Printemps 2019, Été 2019, Automne 2019, ... And all possible years)
    season: 'Automne 2018',
    // studio [string]
    studio: '8-bit',
    // source [string]
    source: 'Manga',
    // duration [number]
    duration: '24',
    // category [string]
    category: ',Aventure,Comédie,Fantastique',
    // format [string] (Série TV, Film, OAV, ONA, Spécial, Musique)
    format: 'Série TV',
    // country [string] (Japon, Chine, Corée du Sud, Taïwan, France, other)
    country: 'Japan',
    // adult [number] (0 or 1) 1 is that the anime is +18 and 0 no !
    adult: 0,
}

getPersonnage option

{
    // id [number]
    id: 1,
    // pageId [string] (The id_page starts with "," and this ends with "," so if you want to display characters from different files you have to put the id like this ", 1,25,50,65,")
    id_page: ',1,',
    // firstName [string]
    prenom: 'Rei',
    // lastName [string]
    name: 'Kiriyama',
    // native [string]
    native: '桐山零',
    // alternative [string]
    alternative: 'Rookie King',
}

getStaff option

{
    // id [number]
    id: 1,
    // pageId [string] (The id_page starts with "," and this ends with "," so if you want to display characters from different files you have to put the id like this ", 1,25,50,65,")
    id_page: ',4,23,',
    // firstName [string]
    prenom: 'Jiajun',
    // lastName [string]
    name: 'Qian',
    // native [string]
    native: '钱家骏',
    // alternative [string]
    alternative: '',
}

advanced exemple

Discord configuration

const {Client} = require('node-anemy');
const anemy = new Client({
    token: '[your token]',
    htmlEntitiesDecoder: true,
    MarkdownEncoder: true,
    setLimitString: 2000,
});

async function test() {
    const anime = await anemy.getAnime({id: 1});
    console.log(anime);
};

test();

returns

{
  id: 1,
  nom: 'March Comes in Like a Lion 2',
  affiche: 'https://cdn.anemy.fr/animes/affiche/3-gatsu-no-Lion-2-14-Octobre-2017-1-SipRnMVyTKg.jpg',
  image: 'https://cdn.anemy.fr/animes/banniere/3-gatsu-no-Lion-2-14-Octobre-2017-1-SipRnMVyTKg.jpg',
  episodes: '22',
  date_debut1: '14',
  date_debut2: 'Octobre',
  date_debut3: '2017',
  date_fin1: '31',
  date_fin2: 'Mars',
  date_fin3: '2018',
  statut: 'Terminé',
  licence: 'Wakanim',
  saison: 'Automne 2017',
  studio: 'Shaft',
  producteurs: "Aniplex, Dentsu, NHK, Hakusensha, Asmik Ace, Toy's Factory",
  source: 'Manga',
  hashtag: '3gatsunolion2',
  duree: '25min',
  categorie: 'Drame, Tranche de vie',
  format: 'Série TV',
  romaji: '3-gatsu no Lion 2',
  anglais: 'March Comes in Like a Lion 2',
  native: '3月のライオン 2',
  description: 'Deuxième saison de 3-gatsu no Lion',
  trailer: 'SipRnMVyTKg',
  pays: 'Japon',
  adulte: 0,
  id_pseudo_uploader: 1
}

Test

git clone https://github.com/Shaynlink/node-anemy.git
cd node-anemy
npm install
npm test

Server running on http://localhost:3000

License

MIT

2.1.0

4 years ago

2.0.0

4 years ago

1.0.2

4 years ago

1.0.0

4 years ago

0.1.0

4 years ago