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:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user