Add TopLiba (#1003)

* test

* cleanup

deleted unused `fetchFile` import
replaced fetch with `fetchApi`

* eslint

* fix

* fix multi

* Hmm, what to do next.

* test URLSearchParams

* fix
This commit is contained in:
Rider21
2024-06-30 07:28:11 +03:00
committed by GitHub
parent 938e3b16a3
commit fae73534dd
121 changed files with 10534 additions and 8079 deletions
+4 -12
View File
@@ -1,7 +1,6 @@
import { load, load as parseHTML } from 'cheerio';
import { fetchApi, fetchFile } from '@libs/fetch';
import { load as parseHTML } from 'cheerio';
import { fetchApi } from '@libs/fetch';
import { Plugin } from '@typings/plugin';
import { Filters } from '@libs/filterInputs';
import { defaultCover } from '@libs/defaultCover';
class NovelHall implements Plugin.PluginBase {
@@ -9,13 +8,9 @@ class NovelHall implements Plugin.PluginBase {
name = 'Novel Hall';
version = '1.0.1';
icon = 'src/en/novelhall/icon.png';
filters?: Filters | undefined; //TODO: Filters Requires hideOnSelect
site = 'https://novelhall.com/';
async popularNovels(
page: number,
options: Plugin.PopularNovelsOptions<Filters>,
): Promise<Plugin.NovelItem[]> {
async popularNovels(page: number): Promise<Plugin.NovelItem[]> {
const url = `${this.site}all2022-${page}.html`;
const body = await fetchApi(url).then(r => r.text());
@@ -94,10 +89,7 @@ class NovelHall implements Plugin.PluginBase {
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo: number,
): Promise<Plugin.NovelItem[]> {
async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
const url = `${this.site}index.php?s=so&module=book&keyword=${searchTerm}`;
const body = await fetchApi(url).then(r => r.text());
const loadedCheerio = parseHTML(body);