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
+6 -6
View File
@@ -1,5 +1,5 @@
import { load as parseHTML } from 'cheerio';
import { fetchText, fetchFile } from '@libs/fetch';
import { fetchText } from '@libs/fetch';
import { FilterTypes, Filters } from '@libs/filterInputs';
import { Plugin } from '@typings/plugin';
import { NovelStatus } from '@libs/novelStatus';
@@ -35,7 +35,7 @@ class Shu69 implements Plugin.PluginBase {
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div.book-coverlist').each((i, el) => {
let url = loadedCheerio(el).find('a.cover').attr('href');
const url = loadedCheerio(el).find('a.cover').attr('href');
const novelName = loadedCheerio(el).find('h4.name').text().trim();
const novelCover = loadedCheerio(el).find('a.cover > img').attr('src');
@@ -59,7 +59,7 @@ class Shu69 implements Plugin.PluginBase {
const body = await fetchText(url);
if (body === '') throw Error('无法获取小说内容,请检查网络');
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
path: novelPath,
@@ -84,7 +84,7 @@ class Shu69 implements Plugin.PluginBase {
novel.genres = '';
// Table of Content is on a different page than the summary page
let chapters: Plugin.ChapterItem[] = [];
const chapters: Plugin.ChapterItem[] = [];
const allUrl = loadedCheerio('dd.all > a').attr('href');
if (allUrl) {
@@ -156,12 +156,12 @@ class Shu69 implements Plugin.PluginBase {
});
if (body === '') throw Error('无法获取搜索结果,请检查网络');
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div.book-coverlist').each((i, el) => {
let url = loadedCheerio(el).find('a.cover').attr('href');
const url = loadedCheerio(el).find('a.cover').attr('href');
const novelName = loadedCheerio(el).find('h4.name').text().trim();
const novelCover = loadedCheerio(el).find('a.cover > img').attr('src');
+4 -4
View File
@@ -1,5 +1,5 @@
import { load as parseHTML } from 'cheerio';
import { fetchText, fetchFile } from '@libs/fetch';
import { fetchText } from '@libs/fetch';
import { FilterTypes, Filters } from '@libs/filterInputs';
import { Plugin } from '@typings/plugin';
// import { encode } from 'urlencode';
@@ -66,7 +66,7 @@ class XinShu69 implements Plugin.PluginBase {
const body = await fetchText(url, {}, 'gbk');
if (body === '') throw Error('无法获取小说内容,请检查网络');
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
path: novelPath,
@@ -97,7 +97,7 @@ class XinShu69 implements Plugin.PluginBase {
}
// Table of Content is on a different page than the summary page
let chapters: Plugin.ChapterItem[] = [];
const chapters: Plugin.ChapterItem[] = [];
const chaptersUrl = loadedCheerio('a.more-btn').attr('href');
if (chaptersUrl) {
@@ -160,7 +160,7 @@ class XinShu69 implements Plugin.PluginBase {
);
if (body === '') throw Error('无法获取搜索结果,请检查网络');
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
+6 -6
View File
@@ -1,5 +1,5 @@
import { CheerioAPI, load as parseHTML } from 'cheerio';
import { fetchText, fetchFile } from '@libs/fetch';
import { fetchText } from '@libs/fetch';
import { FilterTypes, Filters } from '@libs/filterInputs';
import { Plugin } from '@typings/plugin';
import { NovelStatus } from '@libs/novelStatus';
@@ -29,7 +29,7 @@ class Linovelib implements Plugin.PluginBase {
const novels: Plugin.NovelItem[] = [];
loadedCheerio('.module-rank-booklist .book-layout').each((i, el) => {
let url = loadedCheerio(el).attr('href');
const url = loadedCheerio(el).attr('href');
const novelName = loadedCheerio(el).find('.book-title').text();
const novelCover = loadedCheerio(el)
@@ -55,7 +55,7 @@ class Linovelib implements Plugin.PluginBase {
const body = await fetchText(url);
if (body === '') throw Error('无法获取小说内容,请检查网络');
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
path: novelPath,
@@ -83,7 +83,7 @@ class Linovelib implements Plugin.PluginBase {
.join(',');
// Table of Content is on a different page than the summary page
let chapter: Plugin.ChapterItem[] = [];
const chapter: Plugin.ChapterItem[] = [];
const idPattern = /\/(\d+)\.html/;
const novelId = url.match(idPattern)?.[1];
@@ -421,7 +421,7 @@ class Linovelib implements Plugin.PluginBase {
};
let url = this.site + chapterPath;
let baseUrl = url;
const baseUrl = url;
do {
const page = await loadPage(url);
hasNextPage = page.pageHasNextPage;
@@ -502,7 +502,7 @@ class Linovelib implements Plugin.PluginBase {
// await addPage(pageCheerio, redirect);
pageCheerio('.book-ol .book-layout').each((i, el) => {
let nUrl = pageCheerio(el).attr('href');
const nUrl = pageCheerio(el).attr('href');
const novelName = pageCheerio(el).find('.book-title').text();
const novelCover = pageCheerio(el)