项目作者: jerradpatch

项目描述 :
A javascript nodejs client for anime news network
高级语言: TypeScript
项目地址: git://github.com/jerradpatch/animeNewsNetwork_Client.git
创建时间: 2018-02-05T08:18:57Z
项目社区:https://github.com/jerradpatch/animeNewsNetwork_Client

开源协议:

下载


Description

A javascript parser for Anime News Network, is meant to run in a NodeJS environment

Dependencies

1) NodeJs
2) RxJs
3) Bottelneck

Install

  1. npm install --save https://github.com/jerradpatch/animeNewsNetwork_Client/tarball/master

Example

  1. let ops = {apiBackOff: 10};
  2. let ann = new ANN_Client(ops);
  3. let ar = ann.findTitlesLike(['good']);

Classes

// this is the main class

  1. export class ANN_Client {
  2. //default {apiBackOff: 10, useDerivedValues: true}
  3. //back off uses
  4. //https://www.npmjs.com/package/bottleneck
  5. constructor(private ops: {
  6. //the time between requests in seconds
  7. apiBackOff?: number,
  8. //should d_ values (calculated) be returned in response?
  9. useDerivedValues?: boolean,
  10. //using your own request function, bypasses the request throttleing (apiBackOff)
  11. //**not user-agent must be in the header else the ann api with throw an infinite redirect loop
  12. requestFn?: (url: string)=>Promise<string>
  13. });
  14. /*
  15. return types are derived from
  16. https://www.npmjs.com/package/xml-js
  17. convert.xml2js(xmlPage, {compact: true, alwaysArray: true, trim: true, nativeType: true})
  18. useDerivedValues = true; adds derived types, they can take a while as they are fetched from multiple calls
  19. anime.d_genre: string[]
  20. anime.d_mainTitle: string;
  21. anime.d_plotSummary: string;
  22. anime.d_episodes: {title: string, occurrence: number};
  23. anime.d_series: number; // 1 or 2 or 3 .... for type anime.type === 'TV' (for now)
  24. */
  25. findTitlesLike(titles: string[]): Promise<any>;
  26. findTitleWithId(id: string): Promise<any>;
  27. }