From bc00df3e28b2f28fa4c7807fcc2b8addfa853c01 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Mon, 29 Apr 2024 10:50:27 -0500 Subject: [PATCH 01/15] feat: add scraper models --- src/models/AnimeScraperModel.ts | 8 ++++++++ src/models/BaseScraperModel.ts | 8 ++++++++ src/models/MangaScraperModel.ts | 6 ++++++ src/scraper/ScraperAnimeModel.ts | 15 --------------- 4 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 src/models/AnimeScraperModel.ts create mode 100644 src/models/BaseScraperModel.ts create mode 100644 src/models/MangaScraperModel.ts delete mode 100644 src/scraper/ScraperAnimeModel.ts diff --git a/src/models/AnimeScraperModel.ts b/src/models/AnimeScraperModel.ts new file mode 100644 index 0000000..4b3a1e0 --- /dev/null +++ b/src/models/AnimeScraperModel.ts @@ -0,0 +1,8 @@ +import type { Anime } from "../types/anime"; +import type { IAnimeSearch } from "../types/search"; +import type { Episode } from "../types/episode"; +import { BaseScraperModel } from "./BaseScraperModel"; + +export abstract class AnimeScraperModel extends BaseScraperModel { + public abstract GetEpisodeServers(...args: unknown[]): Promise; +} diff --git a/src/models/BaseScraperModel.ts b/src/models/BaseScraperModel.ts new file mode 100644 index 0000000..ece424b --- /dev/null +++ b/src/models/BaseScraperModel.ts @@ -0,0 +1,8 @@ +import type { IResultSearch } from "@animetypes/search"; + +export abstract class BaseScraperModel { + public abstract readonly url: string; + + public abstract GetItemInfo(item: string): Promise; + public abstract GetItemByFilter(...args: unknown[]): Promise>; +} diff --git a/src/models/MangaScraperModel.ts b/src/models/MangaScraperModel.ts new file mode 100644 index 0000000..548b249 --- /dev/null +++ b/src/models/MangaScraperModel.ts @@ -0,0 +1,6 @@ +import type { IMangaResult, Manga, MangaChapter, MangaVolume } from "@animetypes/manga"; +import { BaseScraperModel } from "./BaseScraperModel"; + +export abstract class MangaScraperModel extends BaseScraperModel { + public abstract GetMangaChapters(...args: unknown[]): Promise +} diff --git a/src/scraper/ScraperAnimeModel.ts b/src/scraper/ScraperAnimeModel.ts deleted file mode 100644 index 0b9dda7..0000000 --- a/src/scraper/ScraperAnimeModel.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Anime } from "../types/anime"; -import { type IResultSearch, type IAnimeSearch } from "../types/search"; -import { Episode } from "../types/episode"; - -export abstract class AnimeProviderModel { - abstract readonly url: string; - - abstract GetAnimeInfo(anime: string): Promise; - - abstract GetAnimeByFilter( - ...args: any[] - ): Promise>; - - abstract GetEpisodeServers(...args: any[]): Promise; -} From 9b257a913749021933e78ce76274cd969c748a12 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Mon, 29 Apr 2024 20:16:45 -0500 Subject: [PATCH 02/15] fix: import class --- src/routes/v1/anime/animeblix/AnimeBlixRoutes.ts | 4 ++-- src/routes/v1/anime/animeflv/AnimeflvRoutes.ts | 4 ++-- .../anime/animelatinohd/AnimeLatinoHDRoutes.ts | 4 ++-- .../v1/anime/animevostfr/AnimevostfrRoutes.ts | 4 ++-- src/routes/v1/anime/wcostream/wcostreamRoutes.ts | 4 ++-- src/routes/v1/anime/zoro/ZoroRoutes.ts | 4 ++-- src/scraper/sites/anime/animeBlixs/AnimeBlix.ts | 8 ++++---- src/scraper/sites/anime/animeflv/AnimeFlv.ts | 8 ++++---- .../sites/anime/animelatinohd/AnimeLatinoHD.ts | 8 ++++---- .../sites/anime/animevostfr/Animevostfr.ts | 16 ++++++++-------- src/scraper/sites/anime/wcostream/WcoStream.ts | 8 ++++---- src/scraper/sites/anime/zoro/Zoro.ts | 8 ++++---- src/test/Animeflv.spec.ts | 4 ++-- src/test/Animelatinohd.spec.ts | 4 ++-- src/test/Zoro.spec.ts | 4 ++-- 15 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/routes/v1/anime/animeblix/AnimeBlixRoutes.ts b/src/routes/v1/anime/animeblix/AnimeBlixRoutes.ts index 3e29104..e7172a5 100644 --- a/src/routes/v1/anime/animeblix/AnimeBlixRoutes.ts +++ b/src/routes/v1/anime/animeblix/AnimeBlixRoutes.ts @@ -8,7 +8,7 @@ const router = Router(); router.get("/anime/animeblix/filter", async (req, res) => { const { search, type, page, year, genre } = req.query; - const data = await Anime.GetAnimeByFilter( + const data = await Anime.GetItemByFilter( search as string, type as unknown as number, page as unknown as number, @@ -21,7 +21,7 @@ router.get("/anime/animeblix/filter", async (req, res) => { // Anime Info +(Episodes list) router.get("/anime/animeblix/name/:name", async (req, res) => { const { name } = req.params; - const data = await Anime.GetAnimeInfo( + const data = await Anime.GetItemInfo( name.includes("ver-") ? name.replace("ver-", "") : name, ); res.send(data); diff --git a/src/routes/v1/anime/animeflv/AnimeflvRoutes.ts b/src/routes/v1/anime/animeflv/AnimeflvRoutes.ts index d230be2..3c671f9 100644 --- a/src/routes/v1/anime/animeflv/AnimeflvRoutes.ts +++ b/src/routes/v1/anime/animeflv/AnimeflvRoutes.ts @@ -13,7 +13,7 @@ r.get("/anime/flv/name/:name", async (req, res) => { try { const { name } = req.params; const flv = new AnimeFlv(); - const animeInfo = await flv.GetAnimeInfo(name); + const animeInfo = await flv.GetItemInfo(name); res.send(animeInfo); } catch (error) { console.log(error); @@ -46,7 +46,7 @@ r.get("/anime/flv/filter", async (req, res) => { const title = req.query.title as string; const flv = new AnimeFlv(); - const animeInfo = await flv.GetAnimeByFilter( + const animeInfo = await flv.GetItemByFilter( gen, date, type, diff --git a/src/routes/v1/anime/animelatinohd/AnimeLatinoHDRoutes.ts b/src/routes/v1/anime/animelatinohd/AnimeLatinoHDRoutes.ts index d9a380c..35836c6 100644 --- a/src/routes/v1/anime/animelatinohd/AnimeLatinoHDRoutes.ts +++ b/src/routes/v1/anime/animelatinohd/AnimeLatinoHDRoutes.ts @@ -7,7 +7,7 @@ const router = Router(); router.get("/anime/animelatinohd/filter", async (req, res) => { const { search, type, page, year, genre } = req.query; - const data = await Anime.GetAnimeByFilter( + const data = await Anime.GetItemByFilter( search as string, type as unknown as number, page as unknown as number, @@ -20,7 +20,7 @@ router.get("/anime/animelatinohd/filter", async (req, res) => { // Anime Info +(Episodes list) router.get("/anime/animelatinohd/name/:name", async (req, res) => { const { name } = req.params; - const data = await Anime.GetAnimeInfo(name); + const data = await Anime.GetItemInfo(name); res.send(data); }); diff --git a/src/routes/v1/anime/animevostfr/AnimevostfrRoutes.ts b/src/routes/v1/anime/animevostfr/AnimevostfrRoutes.ts index a786c5d..1f2c514 100644 --- a/src/routes/v1/anime/animevostfr/AnimevostfrRoutes.ts +++ b/src/routes/v1/anime/animevostfr/AnimevostfrRoutes.ts @@ -7,7 +7,7 @@ const router = Router(); router.get("/anime/animevostfr/filter", async (req, res) => { const { search, type, page, year, genre } = req.query; - const data = await Anime.GetAnimeByFilter( + const data = await Anime.GetItemByFilter( search as string, type as unknown as number, page as unknown as number, @@ -20,7 +20,7 @@ router.get("/anime/animevostfr/filter", async (req, res) => { // Anime Info +(Episodes list) router.get("/anime/animevostfr/name/:name", async (req, res) => { const { name } = req.params; - const data = await Anime.GetAnimeInfo(name); + const data = await Anime.GetItemInfo(name); res.send(data); }); diff --git a/src/routes/v1/anime/wcostream/wcostreamRoutes.ts b/src/routes/v1/anime/wcostream/wcostreamRoutes.ts index f6d0a56..0e5637e 100644 --- a/src/routes/v1/anime/wcostream/wcostreamRoutes.ts +++ b/src/routes/v1/anime/wcostream/wcostreamRoutes.ts @@ -6,7 +6,7 @@ const router = Router(); router.get("/anime/wcostream/name/:name", async (req, res) => { const { name } = req.params; - const data = await Anime.GetAnimeInfo(name); + const data = await Anime.GetItemInfo(name); res.send(data); }); @@ -24,7 +24,7 @@ router.get("/anime/wcostream/episode/:episode", async (req, res) => { router.get("/anime/wcostream/filter", async (req, res) => { const { search, page } = req.query; - const data = await Anime.GetAnimeByFilter( + const data = await Anime.GetItemByFilter( search as string, page as unknown as number, ); diff --git a/src/routes/v1/anime/zoro/ZoroRoutes.ts b/src/routes/v1/anime/zoro/ZoroRoutes.ts index d163b40..cdcc825 100644 --- a/src/routes/v1/anime/zoro/ZoroRoutes.ts +++ b/src/routes/v1/anime/zoro/ZoroRoutes.ts @@ -7,7 +7,7 @@ r.get("/anime/zoro/name/:name", async (req, res) => { try { const { name } = req.params; const zoro = new Zoro(); - const animeInfo = await zoro.GetAnimeInfo(name); + const animeInfo = await zoro.GetItemInfo(name); res.send(animeInfo); } catch (error) { console.log(error); @@ -41,7 +41,7 @@ r.get("/anime/zoro/filter", async (req, res) => { const page = req.query.page as string; const zoro = new Zoro(); - const animeInfo = await zoro.GetAnimeByFilter( + const animeInfo = await zoro.GetItemByFilter( type, rated, score, diff --git a/src/scraper/sites/anime/animeBlixs/AnimeBlix.ts b/src/scraper/sites/anime/animeBlixs/AnimeBlix.ts index 83aa1a5..f78dd09 100644 --- a/src/scraper/sites/anime/animeBlixs/AnimeBlix.ts +++ b/src/scraper/sites/anime/animeBlixs/AnimeBlix.ts @@ -8,7 +8,7 @@ import { type IResultSearch, type IAnimeSearch, } from "../../../../types/search"; -import { AnimeProviderModel } from "../../../ScraperAnimeModel"; +import { AnimeScraperModel } from "../../../../models/AnimeScraperModel"; //import { Calendar } from "@animetypes/date"; /** List of Domains @@ -20,11 +20,11 @@ import { AnimeProviderModel } from "../../../ScraperAnimeModel"; * */ -export class AnimeBlix extends AnimeProviderModel { +export class AnimeBlix extends AnimeScraperModel { readonly url = "https://vwv.animeblix.org"; readonly api = "https://api.animelatinohd.com"; - async GetAnimeInfo(anime: string): Promise { + async GetItemInfo(anime: string): Promise { try { const { data } = await axios.get( `${this.url}/animes/${anime.includes("ver-") ? anime : "ver-" + anime}` @@ -165,7 +165,7 @@ export class AnimeBlix extends AnimeProviderModel { } } - async GetAnimeByFilter( + async GetItemByFilter( search?: string, type?: number, page?: number, diff --git a/src/scraper/sites/anime/animeflv/AnimeFlv.ts b/src/scraper/sites/anime/animeflv/AnimeFlv.ts index 5c43387..ab0330b 100644 --- a/src/scraper/sites/anime/animeflv/AnimeFlv.ts +++ b/src/scraper/sites/anime/animeflv/AnimeFlv.ts @@ -14,12 +14,12 @@ import { type IResultSearch, type IAnimeSearch, } from "../../../../types/search"; -import { AnimeProviderModel } from "../../../ScraperAnimeModel"; +import { AnimeScraperModel } from "../../../../models/AnimeScraperModel"; -export class AnimeFlv extends AnimeProviderModel { +export class AnimeFlv extends AnimeScraperModel { readonly url = "https://animeflv.ws"; - async GetAnimeInfo(anime: string): Promise { + async GetItemInfo(anime: string): Promise { try { const { data } = await axios.get(`${this.url}/anime/${anime}`); const $ = load(data); @@ -76,7 +76,7 @@ export class AnimeFlv extends AnimeProviderModel { } } - async GetAnimeByFilter( + async GetItemByFilter( gen?: Genres | string, date?: string, type?: TypeAnimeflv, diff --git a/src/scraper/sites/anime/animelatinohd/AnimeLatinoHD.ts b/src/scraper/sites/anime/animelatinohd/AnimeLatinoHD.ts index cc5ad4c..b22394f 100644 --- a/src/scraper/sites/anime/animelatinohd/AnimeLatinoHD.ts +++ b/src/scraper/sites/anime/animelatinohd/AnimeLatinoHD.ts @@ -8,13 +8,13 @@ import { type IResultSearch, type IAnimeSearch, } from "../../../../types/search"; -import { AnimeProviderModel } from "../../../ScraperAnimeModel"; +import { AnimeScraperModel } from "../../../../models/AnimeScraperModel"; -export class AnimeLatinoHD extends AnimeProviderModel { +export class AnimeLatinoHD extends AnimeScraperModel { readonly url = "https://www.animelatinohd.com"; readonly api = "https://api.animelatinohd.com"; - async GetAnimeInfo(anime: string): Promise { + async GetItemInfo(anime: string): Promise { try { const { data } = await axios.get(`${this.url}/anime/${anime}`); const $ = cheerio.load(data); @@ -143,7 +143,7 @@ export class AnimeLatinoHD extends AnimeProviderModel { } } - async GetAnimeByFilter( + async GetItemByFilter( search?: string, type?: number, page?: number, diff --git a/src/scraper/sites/anime/animevostfr/Animevostfr.ts b/src/scraper/sites/anime/animevostfr/Animevostfr.ts index c9334a0..c80c9a4 100644 --- a/src/scraper/sites/anime/animevostfr/Animevostfr.ts +++ b/src/scraper/sites/anime/animevostfr/Animevostfr.ts @@ -8,7 +8,7 @@ import { type IResultSearch, type IAnimeSearch, } from "../../../../types/search"; -import { AnimeProviderModel } from "../../../ScraperAnimeModel"; +import { AnimeScraperModel } from "../../../../models/AnimeScraperModel"; //import { Calendar } from "@animetypes/date"; /** List of Domains @@ -17,11 +17,11 @@ import { AnimeProviderModel } from "../../../ScraperAnimeModel"; * */ -export class Animevostfr extends AnimeProviderModel { +export class Animevostfr extends AnimeScraperModel { readonly url = "https://animevostfr.tv"; readonly api = "https://api.animelatinohd.com"; - async GetAnimeInfo(anime: string): Promise { + async GetItemInfo(anime: string): Promise { try { const { data } = await axios.get(`${this.url}/${anime}`); const $ = cheerio.load(data); @@ -120,12 +120,12 @@ export class Animevostfr extends AnimeProviderModel { "SERVER_VIP" "SERVER_HYDRAX" "SERVER_PHOTOSS" - "SERVER_DOWNLOAD" - "SERVER_PHOTOS" + "SERVER_DOWNLOAD" + "SERVER_PHOTOS" "SERVER_OPEN_LOAD" - "SERVER_OPEN_LOADS" + "SERVER_OPEN_LOADS" "SERVER_OPEN_CDN" - "SERVER_OPEN_CDNO" + "SERVER_OPEN_CDNO" "SERVER_PHOTO" "SERVER_STREAM_MANGO" "SERVER_RAPID_VIDEO" @@ -167,7 +167,7 @@ export class Animevostfr extends AnimeProviderModel { } } - async GetAnimeByFilter( + async GetItemByFilter( search?: string, type?: number, page?: number, diff --git a/src/scraper/sites/anime/wcostream/WcoStream.ts b/src/scraper/sites/anime/wcostream/WcoStream.ts index 730b6cb..fabffe2 100644 --- a/src/scraper/sites/anime/wcostream/WcoStream.ts +++ b/src/scraper/sites/anime/wcostream/WcoStream.ts @@ -9,7 +9,7 @@ import { AnimeSearch, } from "../../../../types/search"; import { UnPacked } from "../../../../types/utils"; -import { AnimeProviderModel } from "../../../ScraperAnimeModel"; +import { AnimeScraperModel } from "../../../../models/AnimeScraperModel"; /** List of Domains * https://wcostream.tv @@ -36,10 +36,10 @@ axios.defaults.withCredentials = true; axios.defaults.headers.common["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.55"; -export class WcoStream extends AnimeProviderModel { +export class WcoStream extends AnimeScraperModel { readonly url = "https://www.wcostream.tv"; - async GetAnimeInfo(anime: string): Promise { + async GetItemInfo(anime: string): Promise { try { const { data } = await axios.get(`${this.url}/anime/${anime}`, { headers: { @@ -222,7 +222,7 @@ export class WcoStream extends AnimeProviderModel { } } - async GetAnimeByFilter( + async GetItemByFilter( search?: string, page?: number ): Promise> { diff --git a/src/scraper/sites/anime/zoro/Zoro.ts b/src/scraper/sites/anime/zoro/Zoro.ts index 67acb94..36aa3c8 100644 --- a/src/scraper/sites/anime/zoro/Zoro.ts +++ b/src/scraper/sites/anime/zoro/Zoro.ts @@ -1,5 +1,6 @@ import axios from "axios"; import { load } from "cheerio"; +import { AnimeScraperModel } from "../../../../models/AnimeScraperModel"; import { Anime, Chronology } from "../../../../types/anime"; import { Episode, EpisodeServer } from "../../../../types/episode"; import { @@ -7,12 +8,11 @@ import { ResultSearch, type IAnimeSearch, } from "../../../../types/search"; -import { AnimeProviderModel } from "../../../ScraperAnimeModel"; -export class Zoro extends AnimeProviderModel { +export class Zoro extends AnimeScraperModel { readonly url = "https://aniwatch.to"; - async GetAnimeInfo(animeName: string): Promise { + async GetItemInfo(animeName: string): Promise { try { const response = await axios.get(`${this.url}/${animeName}`); const $ = load(response.data); @@ -63,7 +63,7 @@ export class Zoro extends AnimeProviderModel { } } //filter - async GetAnimeByFilter( + async GetItemByFilter( type?: string, rated?: string, score?: string, diff --git a/src/test/Animeflv.spec.ts b/src/test/Animeflv.spec.ts index 4219661..adcee4f 100644 --- a/src/test/Animeflv.spec.ts +++ b/src/test/Animeflv.spec.ts @@ -11,7 +11,7 @@ describe("AnimeFlv", () => { }); it("should get anime info successfully", async () => { - const animeInfo = await animeFlv.GetAnimeInfo("wonder-egg-priority"); + const animeInfo = await animeFlv.GetItemInfo("wonder-egg-priority"); expect(animeInfo.name).toBe("Wonder Egg Priority"); expect(animeInfo.alt_name).toContain("ワンダーエッグ・プライオリティ"); expect(animeInfo.image.url).toContain(".jpg"); @@ -23,7 +23,7 @@ describe("AnimeFlv", () => { }); it("should filter anime successfully", async () => { - const result = await animeFlv.GetAnimeByFilter( + const result = await animeFlv.GetItemByFilter( Genres.Action, "all", "all", diff --git a/src/test/Animelatinohd.spec.ts b/src/test/Animelatinohd.spec.ts index 2fb063c..455b6de 100644 --- a/src/test/Animelatinohd.spec.ts +++ b/src/test/Animelatinohd.spec.ts @@ -8,7 +8,7 @@ describe("AnimeLatinohd", () => { }); it("should get anime info successfully", async () => { - const animeInfo = await animelatinohd.GetAnimeInfo("wonder-egg-priority"); + const animeInfo = await animelatinohd.GetItemInfo("wonder-egg-priority"); expect(animeInfo.name).toBe("Wonder Egg Priority"); expect(animeInfo.alt_name).toContain("ワンダーエッグ・プライオリティ"); expect(animeInfo.image.url).toContain(".jpg"); @@ -19,7 +19,7 @@ describe("AnimeLatinohd", () => { }); it("should filter anime successfully", async () => { - const result = await animelatinohd.GetAnimeByFilter(); + const result = await animelatinohd.GetItemByFilter(); expect(result.results.length).toBeGreaterThan(0); }, 10000); }); diff --git a/src/test/Zoro.spec.ts b/src/test/Zoro.spec.ts index e2ad366..5e4d165 100644 --- a/src/test/Zoro.spec.ts +++ b/src/test/Zoro.spec.ts @@ -7,7 +7,7 @@ describe("Zoro", () => { zoro = new Zoro(); }); it("should get anime info successfully", async () => { - const animeInfo = await zoro.GetAnimeInfo("tokyo-ghoul-790"); + const animeInfo = await zoro.GetItemInfo("tokyo-ghoul-790"); expect(animeInfo.name).toBe("Tokyo Ghoul"); expect(animeInfo.alt_name).toContain("東京喰種-トーキョーグール-"); expect(animeInfo.image.url).toContain(".jpg"); @@ -16,7 +16,7 @@ describe("Zoro", () => { expect(animeInfo.genres.length).toBeGreaterThan(0); }); it("should filter anime successfully", async () => { - const result = await zoro.GetAnimeByFilter("2"); + const result = await zoro.GetItemByFilter("2"); expect(result.results.length).toBeGreaterThan(0); }); }); From 7361f6cdb71f2ea8a371569fc9a8a61dc75807b0 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Tue, 21 May 2024 20:11:44 -0500 Subject: [PATCH 03/15] feat(types)!: base abstractions BREAKING CHANGE: This will be the base class of all type of providers. --- src/types/base.ts | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/types/base.ts diff --git a/src/types/base.ts b/src/types/base.ts new file mode 100644 index 0000000..484aa2e --- /dev/null +++ b/src/types/base.ts @@ -0,0 +1,78 @@ +/** + * Here will stay all possible names of the types of providers. These options + * will be used to create a new URL of the media in the API. Modify it every + * time you need to add a new type of provider. + * + * Examples: `/anime/flv/...` or `/manga/comick/...` + * + * @author Victor + */ +export type MediaURLOptions = "anime" | "manga"; + +/** + * The base interface to create new types of providers. + * + * @author Victor + */ +export interface IBaseMedia { + /** Name or title of the media */ + name: string; + /** URL or location of the media in the API. */ + url: `/${MediaURLOptions}/${string}/name/${string}` | string; + /** Alternative names or titles in different languages. */ + alt_names?: string[] | string; + /** Description or synopsis of the media. */ + synopsis?: string; + /** Genres that apply to the media. */ + genres?: string[]; + /** Indicates the status of the media, such as ongoing, completed, on air, finished, or on hold. */ + status?: string | boolean | "ongoing" | "completed"; + /** Indicates if the content is intended for adult audiences. */ + nsfw?: boolean; +} + +/** + * The base interface to create new search results of any new type of provider. + * + * @author Victor + */ +export interface IBaseResult { + /** Name of the media that was the result of your search */ + name: string; + /** The media URL from the API */ + url: `/${MediaURLOptions}/${string}/name/${string}` | string; +} + +/** + * Create the structure of the base media. + * + * @author Victor + */ +export abstract class BaseMedia implements IBaseMedia { + /** @inheritdoc */ + name: string; + /** @inheritdoc */ + url: `/${MediaURLOptions}/${string}/name/${string}` | string; + /** @inheritdoc */ + alt_names?: string[] | string; + /** @inheritdoc */ + synopsis?: string; + /** @inheritdoc */ + genres?: string[]; + /** @inheritdoc */ + status?: string | boolean | "ongoing" | "completed"; + /** @inheritdoc */ + nsfw?: boolean; +} + +/** + * Create the result search of the base media. + * + * @author Victor + */ +export abstract class BaseResult implements IBaseResult { + /** @inheritdoc */ + name: string; + /** @inheritdoc */ + url: `/${MediaURLOptions}/${string}/name/${string}` | string; +} From a7d277a9d5717534897c17d7afb358be4e56ed1a Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Tue, 21 May 2024 20:15:03 -0500 Subject: [PATCH 04/15] feat(types)!: add anime types inherited from base types BREAKING CHANGE: Some properties of anime class has changed its name. --- src/types/anime.ts | 45 ++++++++------------------------------------- src/types/search.ts | 18 ++++++------------ 2 files changed, 14 insertions(+), 49 deletions(-) diff --git a/src/types/anime.ts b/src/types/anime.ts index 5d6b4c2..3e70139 100644 --- a/src/types/anime.ts +++ b/src/types/anime.ts @@ -1,5 +1,6 @@ //anime data return standard +import { BaseMedia, type IBaseMedia } from "./base"; import { ICalendar, IDatePeriod } from "./date"; import { IEpisode } from "./episode"; import { IImage } from "./image"; @@ -37,29 +38,19 @@ export interface IChronology { * Spectify the anime structure that you scrapped * @author Zukaritasu */ -export interface IAnime { - /** Name of the anime */ - name: string; - /** Alternative names describing the name of the anime in another language */ - alt_name?: string | string[]; - /** Anime identifier that can be used when the anime name is not used in the URL. */ - id?: number; - /** The URL or location of the anime in the API */ - url: `/anime/${string}/name/${string}` | string; - /** The anime synopsis */ - synopsis?: string; +export interface IAnimeMedia extends IBaseMedia { /** * An IImage interface object representing the anime * image and its banner. */ image: IImage; + /** Anime identifier that can be used when the anime name is not used in the URL. */ + id?: number; /** * The date from when the anime started until it ended. The end date may be * auxiliary in case the anime has not ended. */ date?: IDatePeriod | ICalendar; /** The type of anime that indicates whether it is a movie, a special, TV, etc.. */ type?: AnimeType; - /** Genres that apply to anime */ - genres?: string[]; /** Climatic station of which the anime was released */ station?: ClimaticStation | string; /** @@ -72,12 +63,6 @@ export interface IAnime { * A list of the episodes of this anime. This property must be null or not used * if an IAnime object is used in IChronology. */ episodes?: IEpisode[]; - /** - * The status of the anime indicating whether it is on air, finished - * or still on hold. */ - status?: string | boolean; - /** Indicates whether the anime is adult content. */ - nsfw?: boolean; } /**---------------- Interfaces implementation ---------------- **/ @@ -120,35 +105,21 @@ export class Chronology implements IChronology { * Spectify the anime structure that you scrapped * @author Zukaritasu */ -export class Anime implements IAnime { - /** @inheritdoc */ - name: string; +export class AnimeMedia extends BaseMedia implements IAnimeMedia { /** @inheritdoc */ - alt_name?: string | string[]; + image: IImage; /** @inheritdoc */ id?: number; /** @inheritdoc */ - url: `/anime/${string}/name/${string}` | string; - /** @inheritdoc */ - synopsis: string; - /** @inheritdoc */ - image: IImage; - /** @inheritdoc */ date?: IDatePeriod | ICalendar; /** @inheritdoc */ type?: AnimeType; /** @inheritdoc */ - genres: string[] = []; + station?: ClimaticStation | string; /** @inheritdoc */ stats?: IAnimeStats; /** @inheritdoc */ - station?: ClimaticStation | string; - /** @inheritdoc */ chronology?: IChronology[]; /** @inheritdoc */ - episodes: IEpisode[] = []; - /** @inheritdoc */ - status?: string | boolean; - /** @inheritdoc */ - nsfw?: boolean; + episodes?: IEpisode[]; } diff --git a/src/types/search.ts b/src/types/search.ts index 035e465..539a298 100644 --- a/src/types/search.ts +++ b/src/types/search.ts @@ -1,5 +1,7 @@ //Spanish Providers - TypeScript version +import { BaseResult, type IBaseResult } from "./base"; + /** * Anime search helpers, use them with you scrapping by filter (searching..), * this format help you how you can return @@ -8,13 +10,9 @@ * @author Mawfyy * @author Zukaritasu */ -export interface IAnimeSearch { - /** Name of the anime that was the result of your search */ - name: string; +export interface IAnimeResult extends IBaseResult { /** The URL of the anime image */ image: string; - /** The anime URL from the API */ - url: `/anime/${string}/name/${string}` | string; // API url /** * Defines the type of content to which the anime is directed, which * can be a movie, OVA, ONA, etc... */ @@ -45,7 +43,7 @@ export interface IPageNavigation { * * @author Zukaritasu */ -export interface IResultSearch { +export interface IResultSearch { /** Search by navigation */ nav?: IPageNavigation; /** A list of the results obtained */ @@ -60,14 +58,10 @@ export interface IResultSearch { * @author Mawfyy * @author Zukaritasu */ -export class AnimeSearch implements IAnimeSearch { - /** @inheritdoc */ - name: string; +export class AnimeResult extends BaseResult implements IAnimeResult { /** @inheritdoc */ image: string; /** @inheritdoc */ - url: `/anime/${string}/name/${string}` | string; // API url - /** @inheritdoc */ type?: string; } @@ -77,7 +71,7 @@ export class AnimeSearch implements IAnimeSearch { * * @author Zukaritasu */ -export class ResultSearch implements IResultSearch { +export class ResultSearch implements IResultSearch { /** @inheritdoc */ nav?: IPageNavigation; /** @inheritdoc */ From d3712a751d8c58c7e9707c0ecd25b00d1dbc2370 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Tue, 21 May 2024 20:15:44 -0500 Subject: [PATCH 05/15] feat(types)!: add manga types inherited from base types BREAKING CHANGE: Some properties of manga class has changed its name. --- src/types/manga.ts | 51 ++++++++++------------------------------------ 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/src/types/manga.ts b/src/types/manga.ts index 529a531..cba719e 100644 --- a/src/types/manga.ts +++ b/src/types/manga.ts @@ -1,6 +1,7 @@ import { IImage } from "./image"; import { ICalendar } from "./date"; import { IResultSearch } from "./search"; +import { BaseMedia, type IBaseMedia, type IBaseResult } from "./base"; /** * The chapter is part of the manga and is also part of a volume. It is made @@ -79,27 +80,15 @@ export interface IMangaVolume { * * @author Zukaritasu */ -export interface IManga { +export interface IMangaMedia extends IBaseMedia { /** Manga ID */ id: number | string; - /** The URL of the manga in the API location */ - url: `/manga/${string}/title/${string}`; - /** The title of the manga. */ - title: string; - /** The title of the manga in other languages (alternative names) */ - altTitles?: string[]; /** * Manga cover or miniature. Some manga pages show the cover and the * banner, hence the use of the IImage interface. */ thumbnail?: IImage; - /** Synopsis or description of the manga */ - description?: string; - /** Indicates the status of the manga, in progress or completed. */ - status?: "ongoing" | "completed"; /** A list with the name of the authors of the manga */ authors?: string[]; - /** Genres manga */ - genres?: string[]; /** A list of the characters that are part of the history of manga */ characters?: string[]; @@ -113,8 +102,6 @@ export interface IManga { chapters?: IMangaChapter[]; /** A list of manga volumes */ volumes?: IMangaVolume[]; - /** Indicates if the content of the manga is for +18 */ - isNSFW: boolean; } /** @@ -126,15 +113,13 @@ export interface IManga { * * @author Zukaritasu */ -export interface IMangaResult { - /** {@inheritdoc IManga.id} */ +export interface IMangaResult extends IBaseResult { + /** Manga ID */ id: number | string; - /** {@inheritdoc IManga.title} */ - title: string; - /** {@inheritdoc IManga.thumbnail} */ + /** + * Manga cover or miniature. Some manga pages show the cover and the + * banner, hence the use of the IImage interface. */ thumbnail?: IImage; - /** {@inheritdoc IManga.url} */ - url: `/manga/${string}/title/${string}`; } //filter /** @@ -143,35 +128,21 @@ export interface IMangaResult { * * @author Zukaritasu */ -export class Manga implements IManga { - /** @inheritdoc */ - id: string; - /** @inheritdoc */ - url: `/manga/${string}/title/${string}`; - /** @inheritdoc */ - title: string; +export class MangaMedia extends BaseMedia implements IMangaMedia { /** @inheritdoc */ - altTitles?: string[]; + id: string | number; /** @inheritdoc */ thumbnail?: IImage; /** @inheritdoc */ - description?: string; - /** @inheritdoc */ - status?: "ongoing" | "completed"; - /** @inheritdoc */ authors?: string[]; /** @inheritdoc */ - langlist?: string[]; - /** @inheritdoc */ - genres?: string[]; - /** @inheritdoc */ characters?: string[]; /** @inheritdoc */ + langlist?: string[]; + /** @inheritdoc */ chapters?: IMangaChapter[]; /** @inheritdoc */ volumes?: IMangaVolume[]; - /** @inheritdoc */ - isNSFW: boolean; } //////////////////// From 5756046742d308bdfeeb3cf0d5f2a293b6e12117 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sat, 25 May 2024 17:46:30 -0500 Subject: [PATCH 06/15] fix(properties)!: remove url from base interface BREAKING CHANGE: The 'url' property was removed from base interfaces and classes. Now, the 'url' property should be created individually for every interface. This allows us to not to set urls of wrong type of provider. --- src/types/anime.ts | 4 ++++ src/types/base.ts | 9 --------- src/types/manga.ts | 6 ++++++ src/types/search.ts | 4 ++++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/types/anime.ts b/src/types/anime.ts index 3e70139..8e82ed8 100644 --- a/src/types/anime.ts +++ b/src/types/anime.ts @@ -43,6 +43,8 @@ export interface IAnimeMedia extends IBaseMedia { * An IImage interface object representing the anime * image and its banner. */ image: IImage; + /** URL or location of the anime in the API. */ + url: `/anime/${string}/name/${string}` | string; /** Anime identifier that can be used when the anime name is not used in the URL. */ id?: number; /** @@ -109,6 +111,8 @@ export class AnimeMedia extends BaseMedia implements IAnimeMedia { /** @inheritdoc */ image: IImage; /** @inheritdoc */ + url: `/anime/${string}/name/${string}` | string; + /** @inheritdoc */ id?: number; /** @inheritdoc */ date?: IDatePeriod | ICalendar; diff --git a/src/types/base.ts b/src/types/base.ts index 484aa2e..5ee0e20 100644 --- a/src/types/base.ts +++ b/src/types/base.ts @@ -7,7 +7,6 @@ * * @author Victor */ -export type MediaURLOptions = "anime" | "manga"; /** * The base interface to create new types of providers. @@ -17,8 +16,6 @@ export type MediaURLOptions = "anime" | "manga"; export interface IBaseMedia { /** Name or title of the media */ name: string; - /** URL or location of the media in the API. */ - url: `/${MediaURLOptions}/${string}/name/${string}` | string; /** Alternative names or titles in different languages. */ alt_names?: string[] | string; /** Description or synopsis of the media. */ @@ -39,8 +36,6 @@ export interface IBaseMedia { export interface IBaseResult { /** Name of the media that was the result of your search */ name: string; - /** The media URL from the API */ - url: `/${MediaURLOptions}/${string}/name/${string}` | string; } /** @@ -52,8 +47,6 @@ export abstract class BaseMedia implements IBaseMedia { /** @inheritdoc */ name: string; /** @inheritdoc */ - url: `/${MediaURLOptions}/${string}/name/${string}` | string; - /** @inheritdoc */ alt_names?: string[] | string; /** @inheritdoc */ synopsis?: string; @@ -73,6 +66,4 @@ export abstract class BaseMedia implements IBaseMedia { export abstract class BaseResult implements IBaseResult { /** @inheritdoc */ name: string; - /** @inheritdoc */ - url: `/${MediaURLOptions}/${string}/name/${string}` | string; } diff --git a/src/types/manga.ts b/src/types/manga.ts index cba719e..ecf4529 100644 --- a/src/types/manga.ts +++ b/src/types/manga.ts @@ -83,6 +83,8 @@ export interface IMangaVolume { export interface IMangaMedia extends IBaseMedia { /** Manga ID */ id: number | string; + /** URL or location of the manga in the API. */ + url: `/manga/${string}/name/${string}` | string; /** * Manga cover or miniature. Some manga pages show the cover and the * banner, hence the use of the IImage interface. */ @@ -116,6 +118,8 @@ export interface IMangaMedia extends IBaseMedia { export interface IMangaResult extends IBaseResult { /** Manga ID */ id: number | string; + /** The manga URL from the API */ + url: `/manga/${string}/name/${string}` | string; /** * Manga cover or miniature. Some manga pages show the cover and the * banner, hence the use of the IImage interface. */ @@ -132,6 +136,8 @@ export class MangaMedia extends BaseMedia implements IMangaMedia { /** @inheritdoc */ id: string | number; /** @inheritdoc */ + url: `/manga/${string}/name/${string}` | string; + /** @inheritdoc */ thumbnail?: IImage; /** @inheritdoc */ authors?: string[]; diff --git a/src/types/search.ts b/src/types/search.ts index 539a298..c98d727 100644 --- a/src/types/search.ts +++ b/src/types/search.ts @@ -11,6 +11,8 @@ import { BaseResult, type IBaseResult } from "./base"; * @author Zukaritasu */ export interface IAnimeResult extends IBaseResult { + /** The anime URL from the API */ + url: `/anime/${string}/name/${string}` | string; /** The URL of the anime image */ image: string; /** @@ -59,6 +61,8 @@ export interface IResultSearch { * @author Zukaritasu */ export class AnimeResult extends BaseResult implements IAnimeResult { + /** @inheritdoc */ + url: `/anime/${string}/name/${string}` | string; /** @inheritdoc */ image: string; /** @inheritdoc */ From bc200794630644b008bb8e576de1020c0522106e Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sat, 25 May 2024 17:48:30 -0500 Subject: [PATCH 07/15] chore: remove doc of unused base types --- src/types/base.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/types/base.ts b/src/types/base.ts index 5ee0e20..413b50b 100644 --- a/src/types/base.ts +++ b/src/types/base.ts @@ -1,13 +1,3 @@ -/** - * Here will stay all possible names of the types of providers. These options - * will be used to create a new URL of the media in the API. Modify it every - * time you need to add a new type of provider. - * - * Examples: `/anime/flv/...` or `/manga/comick/...` - * - * @author Victor - */ - /** * The base interface to create new types of providers. * From 70a19ee0d7aee8eb239c0e397ce963dbb90dfb9c Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sat, 25 May 2024 21:29:08 -0500 Subject: [PATCH 08/15] feat(base)!: add base interface and class for chapters BREAKING CHANGE: Some properties of the new inherited chapters interfaces will change. --- src/types/base.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/types/base.ts b/src/types/base.ts index 413b50b..240a05b 100644 --- a/src/types/base.ts +++ b/src/types/base.ts @@ -1,3 +1,5 @@ +import type { IImage } from "./image"; + /** * The base interface to create new types of providers. * @@ -18,6 +20,23 @@ export interface IBaseMedia { nsfw?: boolean; } +/** + * The base interface to create new chapter classes for new types of providers. + * + * @author Victor + */ +export interface IBaseChapter { + /** + * Name of the media chapter. May contain the chapter number concatenated + * with the media name. + */ + name: string; + /** The chapter number. */ + num: number; + /** The image of the chapter shown as thumbnail */ + thumbnail?: IImage; +} + /** * The base interface to create new search results of any new type of provider. * @@ -57,3 +76,17 @@ export abstract class BaseResult implements IBaseResult { /** @inheritdoc */ name: string; } + +/** + * Extends the properties of a base chapter to create a new one. + * + * @author Victor + */ +export abstract class BaseChapter implements IBaseChapter { + /** @inheritdoc */ + name: string; + /** @inheritdoc */ + num: number; + /** @inheritdoc */ + thumbnail?: IImage; +} From 241b01588a591904aea3b35e5e5ba1acc37137f1 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sat, 25 May 2024 21:34:12 -0500 Subject: [PATCH 09/15] feat(episode)!: add episode interface inherited from base BREAKING CHANGE: Some old properties of the episode interface was renamed to the base properties name. --- src/types/episode.ts | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/types/episode.ts b/src/types/episode.ts index 41e61ea..ca7c619 100644 --- a/src/types/episode.ts +++ b/src/types/episode.ts @@ -1,5 +1,7 @@ //Spanish Providers - TypeScript version +import { BaseChapter, type IBaseChapter } from "./base"; + /** * This interface only puts the server name where host episode, * and url to that episode @@ -25,21 +27,13 @@ export interface IEpisodeServer { * * @author Zukaritasu */ -export interface IEpisode { - /** - * Name of anime episode. May contain the chapter number concatenated - * with the anime name. */ - name: string; +export interface IEpisode extends IBaseChapter { /** The episode URL in the API query */ url: `/anime/${string}/episode/${string | number}` | string; - /** The episode number. By default the value can be 0 in string or integer. */ - number: number | string; /** * List of available servers where the episode is located. Remember that * this is not the download link of the episode but of the video player. */ servers?: IEpisodeServer[]; - /** The image of the episode shown as thumbnail */ - image: string; } /** @@ -70,15 +64,9 @@ export class EpisodeServer implements IEpisodeServer { * * @author Zukaritasu */ -export class Episode implements IEpisode { - /** @inheritdoc */ - name: string; +export class Episode extends BaseChapter implements IEpisode { /** @inheritdoc */ url: `/anime/${string}/episode/${string | number}` | string; /** @inheritdoc */ - number: number | string; - /** @inheritdoc */ servers?: IEpisodeServer[] = []; - /** @inheritdoc */ - image: string; } From 6a7381c59a37fc5c45ee2f2be1babeeb5287eca0 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sat, 25 May 2024 21:34:55 -0500 Subject: [PATCH 10/15] feat(MangaChapter)!: add manga chapter interface inherited from base BREAKING CHANGE: Some old properties of the Manga chapter interface was renamed to the base properties name. --- src/types/manga.ts | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/types/manga.ts b/src/types/manga.ts index ecf4529..75d8be8 100644 --- a/src/types/manga.ts +++ b/src/types/manga.ts @@ -1,7 +1,7 @@ import { IImage } from "./image"; import { ICalendar } from "./date"; import { IResultSearch } from "./search"; -import { BaseMedia, type IBaseMedia, type IBaseResult } from "./base"; +import { BaseChapter, BaseMedia, type IBaseChapter, type IBaseMedia, type IBaseResult } from "./base"; /** * The chapter is part of the manga and is also part of a volume. It is made @@ -9,25 +9,19 @@ import { BaseMedia, type IBaseMedia, type IBaseResult } from "./base"; * * @author Zukaritasu */ -export interface IMangaChapter { +export interface IMangaChapter extends IBaseChapter { /** ID or chapter identifier of the chapter that is part of the manga */ id: number | string; - /** Chapter title. May contain the manga chapter number. */ - title: string; - /** - * A brief description of what the new chapter brings. This property - * is optional because not all websites have it available. */ - description?: string; /** URL of the chapter in the API location */ url: `/manga/${string}/chapter/${string}`; - /** Chapter number */ - number: number; /** * Images of the manga chapter. * The first image may contain the cover of the chapter. */ images: string[]; - /** The cover page of the chapter. Refers to the first page of the chapter. */ - cover?: string; + /** + * A brief description of what the new chapter brings. This property + * is optional because not all websites have it available. */ + description?: string; /** * The date on which the chapter was published. This is optional because * in some cases it is not specified. */ @@ -159,22 +153,16 @@ export class MangaMedia extends BaseMedia implements IMangaMedia { * * @author Zukaritasu */ -export class MangaChapter implements IMangaChapter { +export class MangaChapter extends BaseChapter implements IMangaChapter { /** @inheritdoc */ id: number | string; /** @inheritdoc */ - title: string; - /** @inheritdoc */ description?: string; /** @inheritdoc */ url: `/manga/${string}/chapter/${string}`; /** @inheritdoc */ - number: number; - /** @inheritdoc */ images: string[] = []; /** @inheritdoc */ - cover?: string; - /** @inheritdoc */ date?: ICalendar; } From 068b1b9c9eb8dd84b3a0d94844801dfe51d31565 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sun, 26 May 2024 12:10:50 -0500 Subject: [PATCH 11/15] feat(BaseScraperModel): add generics extension This change allow us to only pass interfaces inherited from the base interfaces. --- src/models/BaseScraperModel.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/models/BaseScraperModel.ts b/src/models/BaseScraperModel.ts index ece424b..4c8378a 100644 --- a/src/models/BaseScraperModel.ts +++ b/src/models/BaseScraperModel.ts @@ -1,8 +1,9 @@ +import type { BaseMedia, BaseResult } from "@animetypes/base"; import type { IResultSearch } from "@animetypes/search"; -export abstract class BaseScraperModel { +export abstract class BaseScraperModel { public abstract readonly url: string; - public abstract GetItemInfo(item: string): Promise; - public abstract GetItemByFilter(...args: unknown[]): Promise>; + public abstract GetItemInfo(item: string): Promise; + public abstract GetItemByFilter(...args: unknown[]): Promise>; } From 319266aee1041bf853782da915872580ea4cf33a Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sun, 26 May 2024 12:11:44 -0500 Subject: [PATCH 12/15] feat(AnimeScraperModel): add extension to new anime interfaces --- src/models/AnimeScraperModel.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/models/AnimeScraperModel.ts b/src/models/AnimeScraperModel.ts index 4b3a1e0..f545bf7 100644 --- a/src/models/AnimeScraperModel.ts +++ b/src/models/AnimeScraperModel.ts @@ -1,8 +1,8 @@ -import type { Anime } from "../types/anime"; -import type { IAnimeSearch } from "../types/search"; -import type { Episode } from "../types/episode"; +import type { AnimeMedia } from "@animetypes/anime"; +import type { Episode } from "@animetypes/episode"; +import type { IAnimeResult } from "@animetypes/search"; import { BaseScraperModel } from "./BaseScraperModel"; -export abstract class AnimeScraperModel extends BaseScraperModel { +export abstract class AnimeScraperModel extends BaseScraperModel { public abstract GetEpisodeServers(...args: unknown[]): Promise; } From b0c63c9d4f21731bde76049844b65343cb699386 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sun, 26 May 2024 12:12:08 -0500 Subject: [PATCH 13/15] feat(MangaScraperModel): add extension to new manga interfaces --- src/models/MangaScraperModel.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/MangaScraperModel.ts b/src/models/MangaScraperModel.ts index 548b249..c648b5b 100644 --- a/src/models/MangaScraperModel.ts +++ b/src/models/MangaScraperModel.ts @@ -1,6 +1,6 @@ -import type { IMangaResult, Manga, MangaChapter, MangaVolume } from "@animetypes/manga"; +import type { MangaMedia, MangaChapter, MangaVolume, IMangaResult } from "@animetypes/manga"; import { BaseScraperModel } from "./BaseScraperModel"; -export abstract class MangaScraperModel extends BaseScraperModel { +export abstract class MangaScraperModel extends BaseScraperModel { public abstract GetMangaChapters(...args: unknown[]): Promise } From 6938ccaaf57e73d85a6e85a88a821545eb8c1a58 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Sun, 26 May 2024 12:12:22 -0500 Subject: [PATCH 14/15] delete: mangaStructure file --- src/scraper/sites/manga/mangaStructure.ts | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 src/scraper/sites/manga/mangaStructure.ts diff --git a/src/scraper/sites/manga/mangaStructure.ts b/src/scraper/sites/manga/mangaStructure.ts deleted file mode 100644 index d3f4510..0000000 --- a/src/scraper/sites/manga/mangaStructure.ts +++ /dev/null @@ -1,11 +0,0 @@ -//example - -export class MangaProvider { - readonly url = "link"; - - async GetMangaInfo() {} - - async Filter() {} - - async GetMangaChapters() {} -} From d60ba03406390eeb2b33e467ccbc2f8aa38d8419 Mon Sep 17 00:00:00 2001 From: barrientosvctor Date: Thu, 13 Jun 2024 17:50:44 -0500 Subject: [PATCH 15/15] feat(manga-types)!: add base inherited interface to IMangaVolume BREAKING CHANGE: Now, MangaVolume has been inherited from the base BaseChapter class. --- src/types/manga.ts | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/types/manga.ts b/src/types/manga.ts index 75d8be8..d440572 100644 --- a/src/types/manga.ts +++ b/src/types/manga.ts @@ -38,7 +38,7 @@ export interface IMangaChapter extends IBaseChapter { * * @author Zukaritasu */ -export interface IMangaVolume { +export interface IMangaVolume extends IBaseChapter { /** Manga volume ID */ id: number | string; /** @@ -46,24 +46,14 @@ export interface IMangaVolume { * the number of the first chapter of the volume is the beginning and * the last chapter is the end. */ range: [number, number]; - /** - * The title of the volume. The title may contain a short explanation - * of what the volume contains. */ - title?: string; /** * Description or introduction that explains a little of what is to * come in the next chapters that make up the volume. */ - description?: string; - /** Manga volume number */ - number?: number; //number + synopsis?: string; /** Images of the manga volume. */ images: string[]; /** The date on which the first chapter of the volume was published. */ date?: ICalendar; - /** - * The image or cover of the volume. - * This property contains the URL of the image */ - thumbnail?: string; /** URL of the volume in the API location */ url?: `/manga/${string}/volume/${string}`; // title or number } @@ -176,23 +166,17 @@ export class MangaChapter extends BaseChapter implements IMangaChapter { * * @author Zukaritasu */ -export class MangaVolume implements IMangaVolume { +export class MangaVolume extends BaseChapter implements IMangaVolume { /** @inheritdoc */ id: number | string; /** @inheritdoc */ range: [number, number] = [0, 0]; /** @inheritdoc */ - title?: string; - /** @inheritdoc */ - description?: string; - /** @inheritdoc */ - number?: number; //number + synopsis?: string; /** @inheritdoc */ images: string[]; /** @inheritdoc */ date?: ICalendar; /** @inheritdoc */ - thumbnail?: string; - /** @inheritdoc */ url?: `/manga/${string}/volume/${string}`; // title or number }