Feat: resolveUrl, add neobook (#803)

* neobook

* add qs

* fix

* /

* fix

* expandURL -> resolveUrl

* fix Agitoon

* Update ranobelib.ts

---------

Co-authored-by: nyagami <hoangquan05112002@gmail.com>
This commit is contained in:
Rider21
2024-02-28 16:22:20 +03:00
committed by GitHub
parent 9b1417954f
commit bc17c5f576
24 changed files with 854 additions and 285 deletions
+6 -5
View File
@@ -67,7 +67,7 @@ class RNBH implements Plugin.PluginBase {
novels.push({
name: novel.names.rus || novel.names.eng || novel.names.original,
cover: novel.poster.medium,
path: "/ranobe/" + novel.id,
path: novel.id.toString(),
}),
);
@@ -75,7 +75,7 @@ class RNBH implements Plugin.PluginBase {
}
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel> {
const result = await fetchApi(this.site + "/api" + novelPath);
const result = await fetchApi(this.site + "/api/ranobe/" + novelPath);
const json = (await result.json()) as { data: responseNovel };
const novel: Plugin.SourceNovel = {
@@ -98,7 +98,7 @@ class RNBH implements Plugin.PluginBase {
const chapters: Plugin.ChapterItem[] = [];
const chaptersRaw = await fetchApi(
this.site + "/api" + novelPath + "/contents",
this.site + "/api/ranobe/" + novelPath + "/contents",
);
const chaptersJSON = (await chaptersRaw.json()) as {
volumes: VolumesEntity[];
@@ -123,7 +123,7 @@ class RNBH implements Plugin.PluginBase {
}
async parseChapter(chapterPath: string): Promise<string> {
const result = await fetchApi(this.site + chapterPath);
const result = await fetchApi(this.resolveUrl(chapterPath));
const body = await result.text();
const loadedCheerio = parseHTML(body);
@@ -161,7 +161,7 @@ class RNBH implements Plugin.PluginBase {
novel.name ||
novel?.names?.original ||
"",
path: "/ranobe/" + novel.id,
path: novel.id.toString(),
cover: novel?.image?.replace("/small", "/medium"),
}),
);
@@ -170,6 +170,7 @@ class RNBH implements Plugin.PluginBase {
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) => this.site + "/ranobe/" + path;
filters = {
sort: {