Socket
Socket
Sign inDemoInstall

bahamut-anime

Package Overview
Dependencies
8
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

4

lib/index.d.ts

@@ -358,2 +358,3 @@ declare type NumericString = `${number}`;

anime: Anime;
fetcher: Fetcher;
constructor(sn: number, anime: Anime);

@@ -367,2 +368,3 @@ info(): Promise<EndpointResult<"v3/video.php?sn=">>;

sn: number;
fetcher: Fetcher;
constructor(sn: number);

@@ -382,2 +384,4 @@ info(): Promise<EndpointResult<"v3/video.php?anime_sn=">>;

declare class BahamutAnime {
fetcher: Fetcher;
constructor(f?: Fetcher);
search(keyword: string): Promise<Anime[]>;

@@ -384,0 +388,0 @@ list(type: AnimeCategory, page: number, sort?: number): Promise<Anime[]>;

41

lib/index.js

@@ -114,5 +114,6 @@ "use strict";

this.anime = anime;
this.fetcher = fetcher;
}
async info() {
return fetcher.get(`v3/video.php?sn=${this.sn}`);
return this.fetcher.get(`v3/video.php?sn=${this.sn}`);
}

@@ -124,3 +125,3 @@ async ep() {

async danmu() {
const token = await fetcher.get(`v3/token.php?sn=${this.sn}`);
const token = await this.fetcher.get(`v3/token.php?sn=${this.sn}`);
return token.danmu;

@@ -134,5 +135,6 @@ }

this.sn = sn;
this.fetcher = fetcher;
}
async info() {
return fetcher.get(`v3/video.php?anime_sn=${this.sn}`);
return this.fetcher.get(`v3/video.php?anime_sn=${this.sn}`);
}

@@ -145,3 +147,5 @@ async news() {

const info = await this.info();
return info.data.relative_anime.map((item) => new Anime(+item.anime_sn));
const animes = info.data.relative_anime.map((item) => new Anime(+item.anime_sn));
animes.forEach((anime) => anime.fetcher = this.fetcher);
return animes;
}

@@ -159,5 +163,7 @@ async anime() {

return Object.entries(anime.volumes).reduce((acc, [volume, episode]) => {
acc[volume] = episode.map(
(item) => new Episode(item.video_sn, this)
);
acc[volume] = episode.map((item) => {
const ep = new Episode(item.video_sn, this);
ep.fetcher = this.fetcher;
return ep;
});
return acc;

@@ -170,18 +176,27 @@ }, {});

var BahamutAnime = class {
constructor(f = fetcher) {
this.fetcher = f;
}
async search(keyword) {
const results = await fetcher.get(`v1/search.php?kw=${keyword}`);
return results.anime.map((item) => new Anime(item.anime_sn));
const results = await this.fetcher.get(`v1/search.php?kw=${keyword}`);
const animes = results.anime.map((item) => new Anime(item.anime_sn));
animes.forEach((anime) => anime.fetcher = this.fetcher);
return animes;
}
async list(type, page, sort = 0) {
const results = await fetcher.get(
const results = await this.fetcher.get(
`v2/list.php?c=${AnimeCategory[type]}&page=${page}&sort=${sort}`
);
return results.data.animeList.map((item) => new Anime(item.anime_sn));
const animes = results.data.animeList.map((item) => new Anime(item.anime_sn));
animes.forEach((anime) => anime.fetcher = this.fetcher);
return animes;
}
async updates() {
const results = await fetcher.get("v3/index.php");
return results.data.newAnime.date.map((item) => ({
const results = await this.fetcher.get("v3/index.php");
const updates = results.data.newAnime.date.map((item) => ({
anime: new Anime(+item.animeSn),
time: new Date(`${new Date().getFullYear()} ${item.upTime} ${item.upTimeHours}`)
}));
updates.forEach((update) => update.anime.fetcher = this.fetcher);
return updates;
}

@@ -188,0 +203,0 @@ };

{
"name": "bahamut-anime",
"version": "1.0.0",
"version": "1.1.0",
"description": "Interact with the Bahamut Anime API in a simple and easy way.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc