diff --git a/README.md b/README.md index b4ca1c2..96db36f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# PythonCoderAS Sources +**Deprecated: I will no longer update these extensions. Please use other extensions as a replacement.** + +# PythonCoderAS Sources Misc. sources for scanlators and aggregators. # Websites diff --git a/src/CatManga/CatManga.ts b/src/CatManga/CatManga.ts index cc39993..0312cd4 100644 --- a/src/CatManga/CatManga.ts +++ b/src/CatManga/CatManga.ts @@ -2,12 +2,16 @@ import { Chapter, ChapterDetails, HomeSection, - Manga, MangaTile, MangaUpdates, + Manga, + MangaTile, + MangaUpdates, PagedResults, - Request, RequestManager, + Request, + RequestManager, SearchRequest, Source, SourceInfo, + TagType, } from "paperback-extensions-common" import {CatMangaParser} from "./CatMangaParser"; @@ -15,14 +19,24 @@ const BASE = "https://catmanga.org/" export const CatMangaInfo: SourceInfo = { icon: "icon.png", - version: "1.2.9", + version: "1.2.10", name: "CatManga", author: "PythonCoderAS", authorWebsite: "https://github.com/PythonCoderAS", description: "Extension that pulls manga from CatManga", language: "en", hentaiSource: false, - websiteBaseURL: BASE + websiteBaseURL: BASE, + sourceTags: [ + { + text: "Site Down Forever", + type: TagType.RED + }, + { + text: "Deprecated - Will Not Be Updated", + type: TagType.RED + } + ] } export class CatManga extends Source { @@ -101,18 +115,15 @@ export class CatManga extends Source { async searchRequest(query: SearchRequest, metadata: any): Promise { // TODO: Wait for search to be implemented on the website. const results = (await this.getWebsiteMangaDirectory(null)).results; + + let data: MangaTile[]; if (query.title){ - query.title = query.title.replace(/\+/g, " ").trim(); - } - const data: MangaTile[] = []; - for (let i = 0; i < results.length; i++) { - const key = results[i]; - if (query.title) { - if ((key.title.text || "").toLowerCase().includes((query.title.toLowerCase()))) { - data.push(key); - } - } + const filterTitle = query.title.replace(/\+/g, " ").trim().toLowerCase(); + data = results.filter((key) => (key.title.text || "").toLowerCase().includes(filterTitle)) + } else { + data = results; } + console.log(data.length) return createPagedResults({ results: data diff --git a/src/DankeFurs/DankeFurs.ts b/src/DankeFurs/DankeFurs.ts index 117d5c0..3741833 100644 --- a/src/DankeFurs/DankeFurs.ts +++ b/src/DankeFurs/DankeFurs.ts @@ -5,7 +5,7 @@ const BASE = "https://danke.moe/" export const DankeFursInfo: SourceInfo = { icon: "icon.png", - version: "1.1.2", + version: "1.1.3", name: "DankeFurs", author: "PythonCoderAS", authorWebsite: "https://github.com/PythonCoderAS", @@ -21,6 +21,10 @@ export const DankeFursInfo: SourceInfo = { { text: "Cloudflare", type: TagType.RED + }, + { + text: "Deprecated - Will Not Be Updated", + type: TagType.RED } ] } diff --git a/src/Dridespoon/Dridespoon.ts b/src/Dridespoon/Dridespoon.ts index cb71c0f..ba5ce4e 100644 --- a/src/Dridespoon/Dridespoon.ts +++ b/src/Dridespoon/Dridespoon.ts @@ -21,7 +21,7 @@ const BASE = "http://dridesp.ooo/" export const DridespoonInfo: SourceInfo = { icon: "icon.png", - version: "1.0.0", + version: "1.0.1", name: "Dridespoon", author: "PythonCoderAS", authorWebsite: "https://github.com/PythonCoderAS", @@ -33,6 +33,14 @@ export const DridespoonInfo: SourceInfo = { { text: "Notifications", type: TagType.GREEN + }, + { + text: "Site Down Forever", + type: TagType.RED + }, + { + text: "Deprecated - Will Not Be Updated", + type: TagType.RED } ] } diff --git a/src/GlitchyComics/GlitchyComics.ts b/src/GlitchyComics/GlitchyComics.ts deleted file mode 100644 index ac5bc68..0000000 --- a/src/GlitchyComics/GlitchyComics.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { - Chapter, - ChapterDetails, - HomeSection, - Manga, MangaUpdates, - PagedResults, - Request, RequestManager, - SearchRequest, - Source, - SourceInfo, -} from "paperback-extensions-common" -import {GlitchyComicsParser} from "./GlitchyComicsParser"; - -const BASE = "https://glitchycomics.com/" - -export const GlitchyComicsInfo: SourceInfo = { - icon: "icon.png", - version: "1.1.2", - name: "GlitchyComics", - author: "PythonCoderAS", - authorWebsite: "https://github.com/PythonCoderAS", - description: "Extension that pulls manga from GlitchyComics", - language: "en", - hentaiSource: false, - websiteBaseURL: BASE -} - -export class GlitchyComics extends Source { - - private readonly parser: GlitchyComicsParser = new GlitchyComicsParser(); - - readonly requestManager: RequestManager = createRequestManager({ - requestsPerSecond: 5, - requestTimeout: 10000 - }); - - getMangaShareUrl(mangaId: string): string | null { - return `${BASE}/${mangaId}`; - } - - async getHomePageSections(sectionCallback: (section: HomeSection) => void): Promise { - sectionCallback(createHomeSection({ - id: "1", - items: (await this.getWebsiteMangaDirectory(null)).results, - title: "All Manga" - })); - } - - async getWebsiteMangaDirectory(metadata: any): Promise { - const options: Request = createRequestObject({ - url: `${BASE}/series-list`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - return createPagedResults({ - results: this.parser.parseMangaList($, BASE) - }); - } - - async getChapterDetails(mangaId: string, chapterId: string): Promise { - const options: Request = createRequestObject({ - url: `${BASE}/${chapterId}`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - return createChapterDetails({ - id: chapterId, - longStrip: true, - mangaId: mangaId, - pages: this.parser.parsePages($) - }) - } - - async getChapters(mangaId: string): Promise { - const options: Request = createRequestObject({ - url: `${BASE}/${mangaId}`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - return this.parser.parseChapterList($, mangaId, BASE); - } - - async getMangaDetails(mangaId: string): Promise { - const options: Request = createRequestObject({ - url: `${BASE}/${mangaId}`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - return this.parser.parseManga($, mangaId, BASE); - } - - async doSearch(query: SearchRequest, page: number | null = null){ - let url = `${BASE}` - if (page !== null){ - url += `/page/${page}`; - } - if (query.title) { - url += `/?s=${query.title}` - } - const options: Request = createRequestObject({ - url: url, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - let tiles = this.parser.parseSearchResult($, BASE); - if ($("a.next").length !== 0){ - tiles = tiles.concat(await this.doSearch(query, (page || 1)+1)); - } - return tiles; - } - - async searchRequest(query: SearchRequest, metadata: any): Promise { - return createPagedResults({ - results: await this.doSearch(query) - }); - } - - async filterUpdatedManga(mangaUpdatesFoundCallback: (updates: MangaUpdates) => void, time: Date, ids: string[]): Promise { - mangaUpdatesFoundCallback(createMangaUpdates({ - ids: ids - })); - } -} \ No newline at end of file diff --git a/src/GlitchyComics/GlitchyComicsParser.ts b/src/GlitchyComics/GlitchyComicsParser.ts deleted file mode 100644 index c5bec02..0000000 --- a/src/GlitchyComics/GlitchyComicsParser.ts +++ /dev/null @@ -1,102 +0,0 @@ -import {Chapter, LanguageCode, Manga, MangaStatus, MangaTile} from "paperback-extensions-common"; - -export class GlitchyComicsParser { - parseMangaList($: CheerioStatic, base: string) { - const mangaTiles: MangaTile[] = []; - $("div.vc_row.wpb_row.vc_row-fluid.vc_row-o-equal-height.vc_row-flex").map(((index, element) => { - $("div.wpb_column.vc_column_container.vc_col-sm-3.vc_col-xs-6", element).map(((index1, element1) => { - const link = $("a.vc_single_image-wrapper.vc_box_rounded.vc_box_border_grey", element1).first(); - const cover = $("img", link).first(); - const linkId = link.attr("href") - const imageLink = cover.attr("src") || ""; - if (linkId) { - mangaTiles.push(createMangaTile({ - id: linkId.replace(base + "/", "").replace("category/", ""), - image: imageLink || "", - title: createIconText({ - text: $("a", $("h6.vc_custom_heading", element1).first()).first().text() - }) - })) - } - })) - })) - return mangaTiles; - } - - parsePages($: CheerioStatic) { - const pages: string[] = []; - $("div.wp-block-image img", $("div.s-post-content.s-post-small-el.bb-mb-el").first()).map((index, element) => { - if ("attribs" in element && element.attribs["src"]){ - pages.push(element.attribs["src"]) - } - }) - return pages; - } - - parseChapterList($: CheerioStatic, mangaId: string, base: string) { - const chapters: Chapter[] = []; - $("ul#post-items").first().children().map(((index, element) => { - const header = $("header.entry-header", element).first(); - const link = $("a", header).first(); - const linkId = link.attr("href"); - const time = $("time.entry-date.updated", element).first().attr("datetime"); - if (linkId) { - const data: Chapter = { - chapNum: Number(link.text().replace("Chapter ", "")), - id: linkId.replace(base + "/", ""), - langCode: LanguageCode.ENGLISH, - mangaId: mangaId, - } - if (time) { - data.time = new Date(time); - } - chapters.push(createChapter(data)) - } - })) - return chapters - } - - parseManga($: CheerioStatic, mangaId: string, base: string) { - const authorAndArtistBlock = $("h4.ult-responsive.info-list-heading", $("div.vc_row.wpb_row.vc_inner.vc_row-fluid").first()); - const chapterList = this.parseChapterList($, mangaId, base)[0]; - const mangaObj: Manga = { - artist: authorAndArtistBlock.first().text(), - author: authorAndArtistBlock.last().text(), - desc: $("div.wpb_text_column.wpb_content_element").first().text(), - id: mangaId, - image: $("img.vc_single_image-img.attachment-full").attr("src") || "", - rating: 0, - status: MangaStatus.ONGOING, - titles: [$("h2.vc_custom_heading").first().text()], - } - if (chapterList) { - const lastTime = chapterList.time; - if (lastTime) { - mangaObj.lastUpdate = lastTime.toString(); - } - } - return createManga(mangaObj) - } - - parseSearchResult($: CheerioStatic, base: string) { - if ($("section.no-results.not-found").length !== 0) { - return []; - } else { - const tiles: MangaTile[] = []; - $("li.post-item", $("ul#post-items").first()).map(((index, element) => { - const link = $("a", $("h2.entry-title", element)); - const linkId = link.attr("href"); - if (linkId) { - tiles.push(createMangaTile({ - id: linkId.replace(base + "/", "").replace("category/", ""), - image: "", - title: createIconText({ - text: link.text() - }) - })) - } - })) - return tiles; - } - } -} \ No newline at end of file diff --git a/src/GlitchyComics/includes/icon.png b/src/GlitchyComics/includes/icon.png deleted file mode 100644 index 694fad6..0000000 Binary files a/src/GlitchyComics/includes/icon.png and /dev/null differ diff --git a/src/Hachirumi/Hachirumi.ts b/src/Hachirumi/Hachirumi.ts index caa8237..d7e81aa 100644 --- a/src/Hachirumi/Hachirumi.ts +++ b/src/Hachirumi/Hachirumi.ts @@ -5,7 +5,7 @@ const BASE = "https://hachirumi.com/" export const HachirumiInfo: SourceInfo = { icon: "icon.png", - version: "1.1.0", + version: "1.1.1", name: "Hachirumi", author: "PythonCoderAS", authorWebsite: "https://github.com/PythonCoderAS", @@ -21,6 +21,10 @@ export const HachirumiInfo: SourceInfo = { { text: "Cloudflare", type: TagType.RED + }, + { + text: "Deprecated - Will Not Be Updated", + type: TagType.RED } ] } diff --git a/src/MahouShoujoBu/MahouShoujoBu.ts b/src/MahouShoujoBu/MahouShoujoBu.ts index 7edfdae..03b9cd6 100644 --- a/src/MahouShoujoBu/MahouShoujoBu.ts +++ b/src/MahouShoujoBu/MahouShoujoBu.ts @@ -5,7 +5,7 @@ const BASE = "https://mahoushoujobu.com/" export const MahouShoujoBuInfo: SourceInfo = { icon: "icon.png", - version: "1.0.5", + version: "1.0.6", name: "MahouShoujoBu", author: "PythonCoderAS", authorWebsite: "https://github.com/PythonCoderAS", @@ -17,6 +17,10 @@ export const MahouShoujoBuInfo: SourceInfo = { { text: "Notifications", type: TagType.GREEN + }, + { + text: "Deprecated - Will Not Be Updated", + type: TagType.RED } ] } diff --git a/src/NovelCool/NovelCool.ts b/src/NovelCool/NovelCool.ts index ba3fcec..e514bb2 100644 --- a/src/NovelCool/NovelCool.ts +++ b/src/NovelCool/NovelCool.ts @@ -9,7 +9,7 @@ import { SearchRequest, Source, SourceInfo, - TagSection, + TagSection, TagType, } from "paperback-extensions-common" import {NovelCoolParser} from "./NovelCoolParser"; @@ -17,14 +17,20 @@ const BASE = "https://www.novelcool.com/" export const NovelCoolInfo: SourceInfo = { icon: "icon.png", - version: "1.0.2", + version: "1.0.3", name: "NovelCool", author: "PythonCoderAS", authorWebsite: "https://github.com/PythonCoderAS", description: "Extension that pulls manga from NovelCool", language: "en", hentaiSource: false, - websiteBaseURL: BASE + websiteBaseURL: BASE, + sourceTags: [ + { + text: "Deprecated - Will Not Be Updated", + type: TagType.RED + } + ] } export class NovelCool extends Source { diff --git a/src/RainOfSnow/RainOfSnow.ts b/src/RainOfSnow/RainOfSnow.ts index 3a1c986..741063f 100644 --- a/src/RainOfSnow/RainOfSnow.ts +++ b/src/RainOfSnow/RainOfSnow.ts @@ -7,7 +7,7 @@ import { Request, RequestManager, SearchRequest, Source, - SourceInfo, + SourceInfo, TagType, } from "paperback-extensions-common" import {RainOfSnowParser} from "./RainOfSnowParser"; @@ -15,14 +15,20 @@ const BASE = "https://rainofsnow.com/" export const RainOfSnowInfo: SourceInfo = { icon: "icon.png", - version: "1.4.1", + version: "1.4.2", name: "RainOfSnow", author: "PythonCoderAS", authorWebsite: "https://github.com/PythonCoderAS", description: "Extension that pulls manga from RainOfSnow", language: "en", hentaiSource: false, - websiteBaseURL: BASE + websiteBaseURL: BASE, + sourceTags: [ + { + text: "Deprecated - Will Not Be Updated", + type: TagType.RED + } + ] } export class RainOfSnow extends Source { diff --git a/src/SenManga/SenManga.ts b/src/SenManga/SenManga.ts index c0a06eb..2bf41c5 100644 --- a/src/SenManga/SenManga.ts +++ b/src/SenManga/SenManga.ts @@ -17,7 +17,7 @@ const BASE = "https://raw.senmanga.com/" export const SenMangaInfo: SourceInfo = { icon: "icon.png", - version: "1.0.4", + version: "1.0.5", name: "SenManga", author: "PythonCoderAS", authorWebsite: "https://github.com/PythonCoderAS", @@ -29,6 +29,10 @@ export const SenMangaInfo: SourceInfo = { { text: "Notifications", type: TagType.GREEN + }, + { + text: "Deprecated - Will Not Be Updated", + type: TagType.RED } ] } diff --git a/src/VoidScans/VoidScans.ts b/src/VoidScans/VoidScans.ts deleted file mode 100644 index 5cb2e8a..0000000 --- a/src/VoidScans/VoidScans.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { - Chapter, - ChapterDetails, - HomeSection, - Manga, MangaTile, MangaUpdates, - PagedResults, - Request, RequestManager, - SearchRequest, - Source, - SourceInfo, TagType, -} from "paperback-extensions-common" -import {VoidScansParser} from "./VoidScansParser"; - -const BASE = "https://voidscans.net/" - -export const VoidScansInfo: SourceInfo = { - icon: "icon.svg", - version: "1.4.2", - name: "VoidScans", - author: "PythonCoderAS", - authorWebsite: "https://github.com/PythonCoderAS", - description: "Extension that pulls manga from VoidScans", - language: "en", - hentaiSource: false, - websiteBaseURL: BASE, - sourceTags: [ - { - text: "Broken", - type: TagType.RED - } - ] -} - -export class VoidScans extends Source { - - private readonly parser: VoidScansParser = new VoidScansParser(); - - - readonly requestManager: RequestManager = createRequestManager({ - requestsPerSecond: 5, - requestTimeout: 10000 - }); - - getMangaShareUrl(mangaId: string): string | null { - return `${BASE}/library/${mangaId}`; - } - - async getHomePageSections(sectionCallback: (section: HomeSection) => void): Promise { - sectionCallback(createHomeSection({ - id: "1", - items: (await this.getWebsiteMangaDirectory(null)).results, - title: "All Manga" - })); - } - - async getWebsiteMangaDirectory(metadata: any): Promise { - const options: Request = createRequestObject({ - url: `${BASE}/library`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - return createPagedResults({ - results: this.parser.parseMangaList($, BASE) - }); - } - - async getChapterDetails(mangaId: string, chapterId: string): Promise { - const options: Request = createRequestObject({ - url: `${BASE}/read/${mangaId}/${chapterId}`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - const pages = this.parser.parsePages($) - return createChapterDetails({ - id: chapterId, - longStrip: false, - mangaId: mangaId, - pages: pages - }) - } - - async getChapters(mangaId: string): Promise { - const options: Request = createRequestObject({ - url: `${BASE}/library/${mangaId}`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - return this.parser.parseChapterList($, mangaId); - } - - async getMangaDetails(mangaId: string): Promise { - const options: Request = createRequestObject({ - url: `${BASE}/library/${mangaId}`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - return this.parser.parseManga($, mangaId); - } - - async searchRequest(query: SearchRequest, metadata: any): Promise { - // TODO: Wait for search to be implemented on the website. - const results = (await this.getWebsiteMangaDirectory(null)).results; - const data: MangaTile[] = []; - for (let i = 0; i < results.length; i++) { - const key = results[i]; - if (query.title) { - if ((key.title.text || "").toLowerCase().includes((query.title.toLowerCase()))) { - data.push(key); - } - } - } - return createPagedResults({ - results: data - }); - } - - - async filterUpdatedManga(mangaUpdatesFoundCallback: (updates: MangaUpdates) => void, time: Date, ids: string[]): Promise { - // TODO: Wait for times to be implemented. - /* - const options: Request = createRequestObject({ - url: `${BASE}`, - method: 'GET' - }); - let response = await this.requestManager.schedule(options, 1); - let $ = this.cheerio.load(response.data); - mangaUpdatesFoundCallback(createMangaUpdates({ - ids: this.parser.parseUpdatedManga($, BASE, time) - })); - */ - } -} \ No newline at end of file diff --git a/src/VoidScans/VoidScansParser.ts b/src/VoidScans/VoidScansParser.ts deleted file mode 100644 index d1f0d64..0000000 --- a/src/VoidScans/VoidScansParser.ts +++ /dev/null @@ -1,99 +0,0 @@ -import {Chapter, LanguageCode, Manga, MangaStatus, MangaTile} from "paperback-extensions-common"; - -export class VoidScansParser { - parseMangaList($: CheerioStatic, base: string) { - const mangaTiles: MangaTile[] = []; - $("div.col").map((index, element) => { - const link = $("a.btn", element); - const linkId = link.attr("href"); - if (linkId){ - mangaTiles.push(createMangaTile({ - id: linkId.replace(`${base}/library/`, ""), - title: createIconText({ - text: $("h2", element).text() - }), - image: $("img", element).attr("src") || "", - primaryText: createIconText({ - text: $("p.card-text", element).text() - }) - })) - } - }) - return mangaTiles; - } - - parseUpdatedManga($: CheerioStatic, base: string, dateToCheck: Date){ - const ids: string[] = []; - $("div.col").map((index, element) => { - const link = $("a.btn", element); - const linkId = link.attr("href"); - if (linkId){ - const dateUpdated = $("small.text-muted").text(); - const parts = dateUpdated.split(" "); - if (parts.length === 2){ - const date = parts[0]; - const dateParts = date.split("/"); - let day = 0, month = 0, year = 0; - if (dateParts.length === 3){ - year = Number(dateParts[0]); - month = Number(dateParts[1]) - 1; - day = Number(dateParts[2]); - } - const time = parts[1]; - const timeParts = time.split("/"); - let second = 0, minute = 0, hour = 0; - if (timeParts.length === 3){ - hour = Number(timeParts[0]) - minute = Number(timeParts[1]) - second = Number(timeParts[2]) - const dateObj = new Date(Date.UTC(year, month, day, hour, minute, second)); - if (dateObj > dateToCheck){ - ids.push(linkId.replace(`${base}/library/`, "")) - } - } - } - } - }) - return ids; - } - - parsePages($: CheerioStatic): string[] { - const pages: string[] = []; - - $("#slideshow-container img").map((index, element) => { - if (element.attribs["src"]){ - pages.push(element.attribs["src"]) - } - }) - return pages; - } - - parseChapterList($: CheerioStatic, mangaId: string) { - const chapters: Chapter[] = []; - $("ul.list-group").first().children().map((index, element) => { - const link = $(element).first(); - const chapNum = Number(link.text().replace("Chapter ", "")); - const data: Chapter = { - chapNum: chapNum, - id: String(chapNum), - langCode: LanguageCode.ENGLISH, - mangaId: mangaId, - } - chapters.push(createChapter(data)) - }) - return chapters - } - - parseManga($: CheerioStatic, mangaId: string) { - const mangaObj: Manga = { - desc: $("p").first().text().trim(), - id: mangaId, - image: $("img#manga-img").attr("src") || "", - rating: 0, - status: MangaStatus.ONGOING, - titles: [$("h1").first().text()], - } - return createManga(mangaObj) - } - -} \ No newline at end of file diff --git a/src/VoidScans/includes/icon.svg b/src/VoidScans/includes/icon.svg deleted file mode 100644 index 7dde5e8..0000000 --- a/src/VoidScans/includes/icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/tests/GlitchyComics.test.ts b/src/tests/GlitchyComics.test.ts deleted file mode 100644 index b8dc9d0..0000000 --- a/src/tests/GlitchyComics.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -import cheerio from "cheerio"; -import {GlitchyComics} from "../GlitchyComics/GlitchyComics"; -import {APIWrapper, Source} from "paperback-extensions-common"; - -describe("GlitchyComics Tests", function () { - let wrapper: APIWrapper = new APIWrapper(); - let source: Source = new GlitchyComics(cheerio); - let chai = require("chai"), - expect = chai.expect; - let chaiAsPromised = require("chai-as-promised"); - chai.use(chaiAsPromised); - - let mangaId = "forced-to-become-the-villains-son-in-law"; - - it("Retrieve Manga Details", async () => { - let details = await wrapper.getMangaDetails(source, mangaId); - expect( - details, - "No results found with test-defined ID [" + mangaId + "]" - ).to.exist; - - // Validate that the fields are filled - let data = details; - expect(data.id, "Missing ID").to.be.not.empty; - expect(data.image, "Missing Image").to.exist; - expect(data.status, "Missing Status").to.exist; - expect(data.titles, "Missing Titles").to.be.not.empty; - expect(data.rating, "Missing Rating").to.exist; - expect(data.artist, "Missing Artist").to.be.not.empty; - expect(data.author, "Missing Author").to.be.not.empty; - expect(data.desc, "Missing Description").to.be.not.empty; - expect(data.lastUpdate, "Missing Last Update").to.be.not.empty; - }); - - it("Get Chapters", async () => { - let data = await wrapper.getChapters(source, mangaId); - - expect(data, "No chapters present for: [" + mangaId + "]").to.not.be.empty; - - let entry = data[0]; - expect(entry.id, "No ID present").to.not.be.empty; - expect(entry.chapNum, "No chapter number present").to.exist; - expect(entry.time, "No time present").to.be.a("date"); - }); - - it("Get Chapter Details", async () => { - let chapters = await wrapper.getChapters(source, mangaId); - let data = await wrapper.getChapterDetails(source, mangaId, chapters[0].id); - - expect(data, "Empty server response").to.not.be.empty; - - expect(data.id, "Missing ID").to.be.not.empty; - expect(data.mangaId, "Missing MangaID").to.be.not.empty; - expect(data.pages, "No pages present").to.be.not.empty; - }); - - it("Testing search", async () => { - let testSearch = createSearchRequest({ - title: "Son", - }); - - let search = await wrapper.searchRequest(source, testSearch); - let result = search.results[0]; - - expect(result, "No response from server").to.exist; - - expect(result.id, "No ID found for search query").to.be.not.empty; - expect(result.title, "No title").to.be.not.empty; - }); - - it("Testing Home Page", async () => { - let result = await wrapper.getHomePageSections(source); - expect(result, "No response from server").to.exist; - let item = result[0]; - expect(item, "Empty response from server").to.exist; - if (item.items) { - let subitem = item.items[0]; - - expect(subitem.id, "No ID found for homepage item").to.not.be.empty; - expect(subitem.title, "No Title found for homepage item").to.not.be.empty; - expect(subitem.image, "No Image found for homepage item").to.not.be.empty; - } - }) -}); \ No newline at end of file diff --git a/src/tests/VoidScans.test.ts b/src/tests/VoidScans.test.ts deleted file mode 100644 index a66dce6..0000000 --- a/src/tests/VoidScans.test.ts +++ /dev/null @@ -1,80 +0,0 @@ -import cheerio from "cheerio"; -import {VoidScans} from "../VoidScans/VoidScans"; -import {APIWrapper, Source} from "paperback-extensions-common"; - -describe("VoidScans Tests", function () { - let wrapper: APIWrapper = new APIWrapper(); - let source: Source = new VoidScans(cheerio); - let chai = require("chai"), - expect = chai.expect; - let chaiAsPromised = require("chai-as-promised"); - chai.use(chaiAsPromised); - - let mangaId = "6"; - - it("Retrieve Manga Details", async () => { - let details = await wrapper.getMangaDetails(source, mangaId); - expect( - details, - "No results found with test-defined ID [" + mangaId + "]" - ).to.exist; - - // Validate that the fields are filled - let data = details; - expect(data.id, "Missing ID").to.be.not.empty; - expect(data.image, "Missing Image").to.exist; - expect(data.status, "Missing Status").to.exist; - expect(data.titles, "Missing Titles").to.be.not.empty; - expect(data.rating, "Missing Rating").to.exist; - expect(data.desc, "Missing Description").to.be.not.empty; - }); - - it("Get Chapters", async () => { - let data = await wrapper.getChapters(source, mangaId); - - expect(data, "No chapters present for: [" + mangaId + "]").to.not.be.empty; - - let entry = data[0]; - expect(entry.id, "No ID present").to.not.be.empty; - expect(entry.chapNum, "No chapter number present").to.exist; - }); - - it("Get Chapter Details", async () => { - let chapters = await wrapper.getChapters(source, mangaId); - let data = await wrapper.getChapterDetails(source, mangaId, chapters[0].id); - - expect(data, "Empty server response").to.not.be.empty; - - expect(data.id, "Missing ID").to.be.not.empty; - expect(data.mangaId, "Missing MangaID").to.be.not.empty; - expect(data.pages, "No pages present").to.be.not.empty; - }); - - it("Testing search", async () => { - let testSearch = createSearchRequest({ - title: "Son", - }); - - let search = await wrapper.searchRequest(source, testSearch); - let result = search.results[0]; - - expect(result, "No response from server").to.exist; - - expect(result.id, "No ID found for search query").to.be.not.empty; - expect(result.title, "No title").to.be.not.empty; - }); - - it("Testing Home Page", async () => { - let result = await wrapper.getHomePageSections(source); - expect(result, "No response from server").to.exist; - let item = result[0]; - expect(item, "Empty response from server").to.exist; - if (item.items) { - let subitem = item.items[0]; - - expect(subitem.id, "No ID found for homepage item").to.not.be.empty; - expect(subitem.title, "No Title found for homepage item").to.not.be.empty; - expect(subitem.image, "No Image found for homepage item").to.not.be.empty; - } - }) -}); \ No newline at end of file