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
+16 -20
View File
@@ -1,7 +1,6 @@
import { load as parseHTML } from 'cheerio';
import { fetchFile } from '@libs/fetch';
import { fetchApi } from '@libs/fetch';
import { Plugin } from '@typings/plugin';
import { Filters } from '@libs/filterInputs';
class EpikNovel implements Plugin.PluginBase {
id = 'epiknovel';
@@ -9,18 +8,15 @@ class EpikNovel implements Plugin.PluginBase {
icon = 'src/tr/epiknovel/icon.png';
site = 'https://www.epiknovel.com/';
version = '1.0.0';
async popularNovels(
pageNo: number,
options: Plugin.PopularNovelsOptions<Filters>,
): Promise<Plugin.NovelItem[]> {
let url = this.site + 'seri-listesi?Sayfa=' + pageNo;
async popularNovels(pageNo: number): Promise<Plugin.NovelItem[]> {
const url = this.site + 'seri-listesi?Sayfa=' + pageNo;
const result = await fetch(url);
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
let novels: Plugin.NovelItem[] = [];
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div.col-lg-12.col-md-12').each((idx, ele) => {
const novelName = loadedCheerio(ele).find('h3').text();
@@ -46,12 +42,12 @@ class EpikNovel implements Plugin.PluginBase {
const url = this.site + novelPath;
// console.log(url);
const result = await fetch(url);
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
let novel: Plugin.SourceNovel = {
const novel: Plugin.SourceNovel = {
path: novelPath,
name: loadedCheerio('h1#tables').text().trim(),
};
@@ -75,7 +71,7 @@ class EpikNovel implements Plugin.PluginBase {
.replace(/Publisher:|\s/g, '')
.trim();
let novelChapters: Plugin.ChapterItem[] = [];
const novelChapters: Plugin.ChapterItem[] = [];
loadedCheerio('table').find('tr').first().remove();
@@ -113,14 +109,14 @@ class EpikNovel implements Plugin.PluginBase {
// console.log(url);
const result = await fetch(url);
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
let chapterText = '';
if (result.url === 'https://www.epiknovel.com/login') {
if (result.url === this.site + 'login') {
chapterText = 'Premium Chapter';
} else {
chapterText = loadedCheerio('div#icerik').html() || '';
@@ -134,12 +130,12 @@ class EpikNovel implements Plugin.PluginBase {
): Promise<Plugin.NovelItem[]> {
const url = this.site + 'seri-listesi?q=' + searchTerm + '&Sayfa=' + pageNo;
const result = await fetch(url);
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
let novels: Plugin.NovelItem[] = [];
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div.col-lg-12.col-md-12').each((idx, ele) => {
const novelName = loadedCheerio(ele).find('h3').text();
+5 -5
View File
@@ -1,5 +1,5 @@
import { load as parseHTML } from 'cheerio';
import { fetchApi, fetchFile } from '@libs/fetch';
import { fetchApi } from '@libs/fetch';
import { FilterTypes, Filters } from '@libs/filterInputs';
import { Plugin } from '@typings/plugin';
@@ -38,7 +38,7 @@ class LSHNovel implements Plugin.PluginBase {
loadedCheerio('article.bs').each(function () {
const novelName = loadedCheerio(this).find('.ntitle').text().trim();
let image = loadedCheerio(this).find('img');
const image = loadedCheerio(this).find('img');
const novelCover = image.attr('data-src') || image.attr('src');
const novelUrl = loadedCheerio(this).find('a').attr('href');
@@ -63,7 +63,7 @@ class LSHNovel implements Plugin.PluginBase {
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
@@ -99,7 +99,7 @@ class LSHNovel implements Plugin.PluginBase {
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
const chapter: Plugin.ChapterItem[] = [];
loadedCheerio('.eplister')
.find('li')
@@ -133,7 +133,7 @@ class LSHNovel implements Plugin.PluginBase {
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio('.epcontent').html() || '';
const chapterText = loadedCheerio('.epcontent').html() || '';
return chapterText;
}