fix: Plugins (#578)
* test * test * fix * any * update * update * fix LightNovelReader * Why did I do that * typo * fix * type * unused icons have been removed * madara... * ops * fix * close #563 * update * LitSpace * fix jaomix * fix renovels * fix ficbook * update ficbook
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { load as parseHTML } from "cheerio";
|
||||
import { fetchFile, fetchApi } from "@libs/fetch";
|
||||
import { Novel, Plugin, Chapter } from "@typings/plugin";
|
||||
import { FilterInputs } from "@libs/filterInputs";
|
||||
import { defaultCover } from "@libs/defaultCover";
|
||||
import { NovelStatus } from "@libs/novelStatus"
|
||||
import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
@@ -14,19 +15,24 @@ export const version = "1.0.0";
|
||||
export const site = "https://turkcelightnovels.com/";
|
||||
const baseUrl = site;
|
||||
|
||||
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
|
||||
export const popularNovels: Plugin.popularNovels = async (pageNo, {filters, showLatestNovels}) => {
|
||||
const novels: Novel.Item[] = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
|
||||
let url = site + "light-novel" + '/page/' + pageNo + sortOrder;
|
||||
let url = site;
|
||||
|
||||
if (filters?.genres) {
|
||||
url += "novel-genre/" + filters.genres + '/';
|
||||
} else {
|
||||
url += "light-novel/";
|
||||
}
|
||||
|
||||
url += '/page/' + pageNo + '/' +
|
||||
'?m_orderby=' + (showLatestNovels ? 'latest' : (filters?.sort || 'rating'));
|
||||
|
||||
const body = await fetchApi(url).then(res => res.text());
|
||||
|
||||
const loadedCheerio = parseHTML(body);
|
||||
|
||||
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
@@ -202,4 +208,6 @@ export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
|
||||
|
||||
export const fetchImage: Plugin.fetchImage = async (url) => {
|
||||
return await fetchFile(url);
|
||||
};
|
||||
};
|
||||
|
||||
export const filters = [{"key":"sort","label":"Order by","values":[{"label":"Rating","value":"rating"},{"label":"A-Z","value":"alphabet"},{"label":"Latest","value":"latest"},{"label":"Most Views","value":"views"},{"label":"New","value":"new-manga"},{"label":"Trending","value":"trending"}],"inputType":FilterInputs.Picker}];
|
||||
@@ -2,6 +2,7 @@
|
||||
import { load as parseHTML } from "cheerio";
|
||||
import { fetchFile, fetchApi } from "@libs/fetch";
|
||||
import { Novel, Plugin, Chapter } from "@typings/plugin";
|
||||
import { FilterInputs } from "@libs/filterInputs";
|
||||
import { defaultCover } from "@libs/defaultCover";
|
||||
import { NovelStatus } from "@libs/novelStatus"
|
||||
import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
@@ -14,19 +15,24 @@ export const version = "1.0.0";
|
||||
export const site = "https://www.webnoveloku.com/";
|
||||
const baseUrl = site;
|
||||
|
||||
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
|
||||
export const popularNovels: Plugin.popularNovels = async (pageNo, {filters, showLatestNovels}) => {
|
||||
const novels: Novel.Item[] = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
|
||||
let url = site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
let url = site;
|
||||
|
||||
if (filters?.genres) {
|
||||
url += "novel-genre/" + filters.genres + '/';
|
||||
} else {
|
||||
url += "novel/";
|
||||
}
|
||||
|
||||
url += '/page/' + pageNo + '/' +
|
||||
'?m_orderby=' + (showLatestNovels ? 'latest' : (filters?.sort || 'rating'));
|
||||
|
||||
const body = await fetchApi(url).then(res => res.text());
|
||||
|
||||
const loadedCheerio = parseHTML(body);
|
||||
|
||||
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
@@ -202,4 +208,6 @@ export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
|
||||
|
||||
export const fetchImage: Plugin.fetchImage = async (url) => {
|
||||
return await fetchFile(url);
|
||||
};
|
||||
};
|
||||
|
||||
export const filters = [{"key":"sort","label":"Sırala","values":[{"label":"A-Z","value":"alphabet"},{"label":"En Son","value":"latest"},{"label":"Görüntülenme","value":"views"},{"label":"Popülarite","value":"trending"},{"label":"Reyting","value":"rating"},{"label":"Yeni","value":"new-manga"}],"inputType":FilterInputs.Picker}];
|
||||
Reference in New Issue
Block a user