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:
Rider21
2023-10-30 09:45:33 +03:00
committed by GitHub
parent 5258464743
commit ac96c62066
244 changed files with 45894 additions and 18184 deletions
+25 -15
View File
@@ -10,45 +10,53 @@ export const generateAll: ScrpitGeneratorFunction = function () {
};
const generator = function generator(sourceJson: sourceData) {
const { pluginId, baseUrl, sourceName, options } = sourceJson;
const { id, sourceSite, sourceName, options } = sourceJson;
const lang = options?.lang || "English";
const path = options?.path || {
novels: "novel",
novel: "novel",
chapter: "novel",
const path = {
genres: options?.path?.genres || "novel-genre",
novels: options?.path?.novels || "novel",
novel: options?.path?.novel || "novel",
chapter: options?.path?.chapter || "novel",
};
const useNewChapterEndpoint = options?.useNewChapterEndpoint || false;
const iconFileName = sourceName.replace(/\s+/g, "").toLowerCase();
const filters = sourceJson.filters;
const filetersString = JSON.stringify(filters).replace(/(\"inputType\":)\s*\"([^\"]+)\"/g, "$1FilterInputs.$2");
const pluginScript = `
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";
import dayjs from "dayjs";
export const id = "${pluginId}";
export const id = "${id}";
export const name = "${sourceName} [madara]";
export const icon = "multisrc/madara/icons/${iconFileName}.png";
export const version = "1.0.0";
export const site = "${baseUrl}";
export const site = "${sourceSite}";
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 + "${path.novels}" + '/page/' + pageNo + sortOrder;
let url = site;
if (filters?.genres) {
url += "${path.genres}/" + filters.genres + '/';
} else {
url += "${path.novels}/";
}
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 () {
@@ -224,7 +232,9 @@ export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};`;
};
export const filters = ${filetersString};`;
return {
lang,
File diff suppressed because it is too large Load Diff
-242
View File
@@ -1,242 +0,0 @@
import { ScrpitGeneratorFunction } from "../generate";
import list from "./sources.json";
type sourceData = (typeof list)[number];
export const generateAll: ScrpitGeneratorFunction = function () {
return list.map((source) => {
return generator(source);
});
};
const generator = function generator(sourceJson: sourceData) {
const pluginId = sourceJson.id;
const sourceName = sourceJson.sourceName;
const lang = "Russian";
const site = sourceJson.sourceSite;
const filters = sourceJson.filters || [];
const filetersString = JSON.stringify(filters).replace(/(\"inputType\":)\s*\"([^\"]+)\"/g, "$1FilterInputs.$2");
const pluginScript = `
import { load as parseHTML } from "cheerio";
import dayjs from 'dayjs';
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
// import { parseMadaraDate } from "@libs/parseMadaraDate";
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
// import { showToast } from "@libs/showToast";
import { Filter, FilterInputs } from "@libs/filterInputs";
import { NovelStatus } from '@libs/novelStatus';
import { defaultCover } from "@libs/defaultCover";
export const id = "${pluginId}";
export const name = "${sourceName}";
export const icon = "";
export const version = "1.0.0";
export const site = "${site}";
export const filters: Filter[] = ${filetersString};
const baseUrl = site;
const domain = baseUrl.split('//')[1];
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters }
) {
const result = await fetchApi('https://api.novel.tl/api/site/v2/graphql', {
method: 'post',
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
'Content-Type': 'application/json',
'Alt-Used': 'api.novel.tl',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
},
referrer: baseUrl,
body: JSON.stringify({
operationName: 'Projects',
query:
'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
variables: {
filter: filters?.tags?.length ?? 0 > 0 ? { tags: filters?.tags } : {},
hostname: domain,
limit: 40,
page,
},
}),
});
const json: any = await result.json();
const novels: Novel.Item[] = json.data?.projects?.content?.map((novel: any) => ({
name: novel.title,
url: baseUrl + '/r/' + novel.url,
cover: novel.covers[0]?.url
? baseUrl + novel.covers[0].url
: defaultCover,
}));
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const result = await fetchApi('https://api.novel.tl/api/site/v2/graphql', {
method: 'post',
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
'Content-Type': 'application/json',
'Alt-Used': 'api.novel.tl',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
},
referrer: baseUrl,
body: JSON.stringify({
operationName: 'Book',
query:
'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
variables: {
hostname: domain,
project: novelUrl,
url: novelUrl,
},
}),
});
const json: any = await result.json();
const novel: Novel.instance = {
url: novelUrl,
name: json.data.project.title,
cover: json.data.project.covers[0]?.url
? baseUrl + json.data.project.covers[0].url
: defaultCover,
summary: parseHTML(json.data.project.annotation?.text).text(),
author:
json.data.project.persons[0].name.firstName +
' ' +
json.data.project.persons[0].name.lastName,
status:
json.data.project.translationStatus === 'active'
? NovelStatus.Ongoing
: NovelStatus.Completed,
};
let genres = []
.concat(json.data.project.tags, json.data.project.genres)
.map((item: any) => item?.nameRu || item?.nameEng)
.filter(item => item);
if (genres.length > 0) {
novel.genres = genres.join(',');
}
let novelChapters: Chapter.Item[] = [];
json.data.project.subprojects.content.forEach((work: any) =>
work.volumes.content.forEach((volume: any) =>
volume.chapters.forEach(
(chapter: any) =>
chapter?.published &&
novelChapters.push({
name: volume.shortName + ' ' + chapter.title,
url: novelUrl + '/' + volume.url + '/' + chapter.url,
releaseTime: dayjs(chapter.publishDate).format('LLL'),
}),
),
),
);
novel.chapters = novelChapters;
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi('https://api.novel.tl/api/site/v2/graphql', {
method: 'post',
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
'Content-Type': 'application/json',
'Alt-Used': 'api.novel.tl',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
},
referrer: baseUrl,
body: JSON.stringify({
operationName: 'EReaderData',
query:
'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
variables: {
chapterSelector: {
fullUrl: chapterUrl,
},
url: chapterUrl,
},
}),
});
const json: any = await result.json();
return parseHTML(json.data.chapter.text.text).html();
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const result = await fetchApi('https://api.novel.tl/api/site/v2/graphql', {
method: 'post',
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
'Content-Type': 'application/json',
'Alt-Used': 'api.novel.tl',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
},
referrer: baseUrl,
body: JSON.stringify({
operationName: 'Projects',
query:
'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
variables: {
filter: {
query: searchTerm,
},
hostname: domain,
limit: 40,
page: 1,
},
}),
});
const json: any = await result.json();
const novels: Novel.Item[] = [];
json?.data?.projects?.content?.forEach((novel: any) =>
novels.push({
name: novel.title,
url: baseUrl + '/r/' + novel.url,
cover: novel.covers[0]?.url
? baseUrl + novel.covers[0].url
: defaultCover,
}),
);
return novels;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url, {});
};
`
return {
lang,
filename: site.split('//')[1].replace(/\./g, ''),
pluginScript,
};
};
File diff suppressed because it is too large Load Diff
+196 -194
View File
@@ -14,203 +14,205 @@ const generator = function generator(sourceJson: sourceData) {
const sourceName = sourceJson.sourceName;
const site = sourceJson.sourceSite;
const iconFileName = sourceName.split('.')[0].toLowerCase() + '.png';
const filters = sourceJson.filters;
const filetersString = JSON.stringify(filters)
.replace(/(\"inputType\":)\s*\"([^\"]+)\"/g, " $1FilterInputs.$2");
const pluginScript = `
import { load as parseHTML } from "cheerio";
// import dayjs from 'dayjs';
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
// import { parseMadaraDate } from "@libs/parseMadaraDate";
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
// import { showToast } from "@libs/showToast";
// import { Filter, FilterInputs } from "@libs/filterInputs";
// import { NovelStatus } from '@libs/novelStatus';
// import { defaultCover } from "@libs/defaultCover";
export const id = "${pluginId}";
export const name = "${sourceName}";
export const icon = "multisrc/readwn/icon/${iconFileName}";
export const version = "1.0.0";
export const site = "${site}";
// export const filters: Filter[] = [];
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters, showLatestNovels }
) {
const novels: Novel.Item[] = [];
const pageNo = page - 1;
const url = baseUrl + 'list/all/all-onclick-' + pageNo +'.html';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio('li.novel-item').each(function () {
const novelName = loadedCheerio(this).find('h4').text();
const novelUrl = baseUrl + loadedCheerio(this).find('a').attr('href');
const coverUri = loadedCheerio(this)
.find('.novel-cover > img')
.attr('data-src');
const novelCover = baseUrl + coverUri;
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
import { load as parseHTML } from "cheerio";
// import dayjs from 'dayjs';
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { parseMadaraDate } from "@libs/parseMadaraDate";
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
// import { showToast } from "@libs/showToast";
import { FilterInputs } from "@libs/filterInputs";
// import { NovelStatus } from '@libs/novelStatus';
// import { defaultCover } from "@libs/defaultCover";
export const id = "${pluginId}";
export const name = "${sourceName}";
export const icon = "multisrc/readwn/icons/${iconFileName}";
export const version = "1.0.0";
export const site = "${site}";
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters, showLatestNovels }
) {
const novels: Novel.Item[] = [];
const pageNo = page - 1;
let url = site + 'list/';
url += (filters?.genres || 'all') + '/';
url += (filters?.status || 'all') + '-';
url += (showLatestNovels ? 'lastdotime' : filters?.sort || 'newstime') + '-';
url += pageNo + '.html';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio('li.novel-item').each(function () {
const novelName = loadedCheerio(this).find('h4').text();
const novelUrl = site + loadedCheerio(this).find('a').attr('href');
const coverUri = loadedCheerio(this)
.find('.novel-cover > img')
.attr('data-src');
const novelCover = site + coverUri;
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const result = await fetchApi(novelUrl);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
url: novelUrl,
chapters: [],
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const result = await fetchApi(novelUrl);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
url: novelUrl,
chapters: [],
};
novel.name = loadedCheerio('h1.novel-title').text();
const coverUri = loadedCheerio('figure.cover > img').attr('data-src');
novel.cover = baseUrl + coverUri;
novel.summary = loadedCheerio('.summary')
.text()
.replace('Summary', '')
.trim();
novel.genres = '';
loadedCheerio('div.categories > ul > li').each(function () {
novel.genres += loadedCheerio(this).text().trim() + ',';
});
loadedCheerio('div.header-stats > span').each(function () {
if (loadedCheerio(this).find('small').text() === 'Status') {
novel.status = loadedCheerio(this).find('strong').text();
}
});
novel.genres = novel.genres.slice(0, -1);
novel.author = loadedCheerio('span[itemprop=author]').text();
let novelChapters: Chapter.Item[] = [];
const novelId = novelUrl.replace('.html', '').replace(baseUrl, '');
const latestChapterNo = parseInt(loadedCheerio('.header-stats')
.find('span > strong')
.first()
.text()
.trim());
let lastChapterNo = 1;
loadedCheerio('.chapter-list li').each(function () {
const chapterName = loadedCheerio(this)
.find('a .chapter-title')
.text()
.trim();
const chapterUrl = baseUrl + loadedCheerio(this).find('a').attr('href')?.trim();
const releaseDate = loadedCheerio(this)
.find('a .chapter-update')
.text()
.trim();
lastChapterNo = parseInt(loadedCheerio(this).find('a .chapter-no').text().trim());
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
novelChapters.push(chapter);
});
// Itterate once more before loop to finish off
lastChapterNo++;
for (let i = lastChapterNo; i <= latestChapterNo; i++) {
const chapterName = 'Chapter ' + i;
const chapterUrl = baseUrl + novelId+'_'+ i +'.html';
const releaseDate = null;
const chapter = { name: chapterName, releaseTime: releaseDate,url: chapterUrl };
novelChapters.push(chapter);
}
novel.chapters = novelChapters;
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio('.chapter-content').html();
return chapterText;
novel.name = loadedCheerio('h1.novel-title').text();
const coverUri = loadedCheerio('figure.cover > img').attr('data-src');
novel.cover = site + coverUri;
novel.summary = loadedCheerio('.summary')
.text()
.replace('Summary', '')
.trim();
novel.genres = '';
loadedCheerio('div.categories > ul > li').each(function () {
novel.genres += loadedCheerio(this).text().trim() + ',';
});
loadedCheerio('div.header-stats > span').each(function () {
if (loadedCheerio(this).find('small').text() === 'Status') {
novel.status = loadedCheerio(this).find('strong').text();
}
});
novel.genres = novel.genres.slice(0, -1);
novel.author = loadedCheerio('span[itemprop=author]').text();
let novelChapters: Chapter.Item[] = [];
const novelId = novelUrl.replace('.html', '').replace(site, '');
const latestChapterNo = parseInt(loadedCheerio('.header-stats')
.find('span > strong')
.first()
.text()
.trim());
let lastChapterNo = 1;
loadedCheerio('.chapter-list li').each(function () {
const chapterName = loadedCheerio(this)
.find('a .chapter-title')
.text()
.trim();
const chapterUrl = site + loadedCheerio(this).find('a').attr('href')?.trim();
const releaseDate = loadedCheerio(this)
.find('a .chapter-update')
.text()
.trim();
lastChapterNo = parseInt(loadedCheerio(this).find('a .chapter-no').text().trim());
const chapter = { name: chapterName, releaseTime: parseMadaraDate(releaseDate), url: chapterUrl };
novelChapters.push(chapter);
});
// Itterate once more before loop to finish off
lastChapterNo++;
for (let i = lastChapterNo; i <= latestChapterNo; i++) {
const chapterName = 'Chapter ' + i;
const chapterUrl = site + novelId+'_'+ i +'.html';
const releaseDate = null;
const chapter = { name: chapterName, releaseTime: releaseDate,url: chapterUrl };
novelChapters.push(chapter);
}
novel.chapters = novelChapters;
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio('.chapter-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const searchUrl = site + 'e/search/index.php';
const result = await fetchApi(searchUrl, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Referer: site + 'search.html',
Origin: site,
'user-agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
},
method: 'POST',
body: JSON.stringify({
show: 'title',
tempid: 1,
tbname: 'news',
keyboard: searchTerm,
}),
});
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio('li.novel-item').each(function () {
const novelName = loadedCheerio(this).find('h4').text();
const novelUrl = site + loadedCheerio(this).find('a').attr('href');
const coverUri = site + loadedCheerio(this).find('img').attr('data-src');
const novelCover = site + coverUri;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const searchUrl = baseUrl + 'e/search/index.php';
const result = await fetchApi(searchUrl, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Referer: baseUrl + 'search.html',
Origin: baseUrl,
'user-agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
},
method: 'POST',
body: JSON.stringify({
show: 'title',
tempid: 1,
tbname: 'news',
keyboard: searchTerm,
}),
});
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio('li.novel-item').each(function () {
const novelName = loadedCheerio(this).find('h4').text();
const novelUrl = baseUrl + loadedCheerio(this).find('a').attr('href');
const coverUri = baseUrl + loadedCheerio(this).find('img').attr('data-src');
const novelCover = baseUrl + coverUri;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url, {});
};
`
novels.push(novel);
});
return novels;
};
export const fetchImage: Plugin.fetchImage = fetchFile;
export const filters = ${filetersString};`
return {
lang: "English",
filename: sourceName,
+817 -16
View File
@@ -1,17 +1,818 @@
[
{
"id": "Readwn.com",
"sourceSite": "https://www.readwn.com/",
"sourceName": "Readwn.com"
},
{
"id": "Novelmt.com",
"sourceSite": "https://www.novelmt.com/",
"sourceName": "Novelmt.com"
},
{
"id": "Ltnovel.com",
"sourceSite": "https://www.ltnovel.com/",
"sourceName": "Ltnovel.com"
}
]
{
"id": "Readwn.com",
"sourceSite": "https://www.readwn.com/",
"sourceName": "Readwn.com",
"filters": [
{
"key": "sort",
"label": "Sort By",
"values": [
{
"label": "New",
"value": "newstime"
},
{
"label": "Popular",
"value": "onclick"
},
{
"label": "Updates",
"value": "lastdotime"
}
],
"inputType": "Picker"
},
{
"key": "status",
"label": "Status",
"values": [
{
"label": "All",
"value": "all"
},
{
"label": "Completed",
"value": "Completed"
},
{
"label": "Ongoing",
"value": "Ongoing"
}
],
"inputType": "Picker"
},
{
"key": "genres",
"label": "Genre / Category",
"values": [
{
"label": "All",
"value": "all"
},
{
"label": "Action",
"value": "action"
},
{
"label": "Adventure",
"value": "adventure"
},
{
"label": "Chinese",
"value": "chinese"
},
{
"label": "Comedy",
"value": "comedy"
},
{
"label": "Contemporary Romance",
"value": "contemporary-romance"
},
{
"label": "Drama",
"value": "drama"
},
{
"label": "Eastern Fantasy",
"value": "eastern-fantasy"
},
{
"label": "Ecchi",
"value": "ecchi"
},
{
"label": "Erciyuan",
"value": "erciyuan"
},
{
"label": "Faloo",
"value": "faloo"
},
{
"label": "Fan-Fiction",
"value": "fan-fiction"
},
{
"label": "Fantasy",
"value": "fantasy"
},
{
"label": "Fantasy Romance",
"value": "fantasy-romance"
},
{
"label": "Game",
"value": "game"
},
{
"label": "Gender Bender",
"value": "gender-bender"
},
{
"label": "Harem",
"value": "harem"
},
{
"label": "Hentai",
"value": "hentai"
},
{
"label": "Historical",
"value": "historical"
},
{
"label": "Horror",
"value": "horror"
},
{
"label": "Isekai",
"value": "isekai"
},
{
"label": "Japanese",
"value": "japanese"
},
{
"label": "Josei",
"value": "josei"
},
{
"label": "Korean",
"value": "korean"
},
{
"label": "Lolicon",
"value": "lolicon"
},
{
"label": "Magic",
"value": "magic"
},
{
"label": "Magical Realism",
"value": "magical-realism"
},
{
"label": "Martial Arts",
"value": "martial-arts"
},
{
"label": "Mecha",
"value": "mecha"
},
{
"label": "Military",
"value": "military"
},
{
"label": "Mystery",
"value": "mystery"
},
{
"label": "Official Circles",
"value": "official_circles"
},
{
"label": "Psychological",
"value": "psychological"
},
{
"label": "Romance",
"value": "romance"
},
{
"label": "School Life",
"value": "school-life"
},
{
"label": "Sci-fi",
"value": "sci-fi"
},
{
"label": "Science Fiction",
"value": "science_fiction"
},
{
"label": "Seinen",
"value": "seinen"
},
{
"label": "Shoujo",
"value": "shoujo"
},
{
"label": "Shoujo Ai",
"value": "shoujo-ai"
},
{
"label": "Shounen",
"value": "shounen"
},
{
"label": "Shounen Ai",
"value": "shounen-ai"
},
{
"label": "Slice of Life",
"value": "slice-of-life"
},
{
"label": "Sports",
"value": "sports"
},
{
"label": "Supernatural",
"value": "supernatural"
},
{
"label": "Suspense Thriller",
"value": "suspense_thriller"
},
{
"label": "Tragedy",
"value": "tragedy"
},
{
"label": "Travel Through Time",
"value": "travel_through_time"
},
{
"label": "Two-dimensional",
"value": "two-dimensional"
},
{
"label": "Urban",
"value": "urban"
},
{
"label": "Urban Life",
"value": "urban-life"
},
{
"label": "Video Games",
"value": "video-games"
},
{
"label": "Virtual Reality",
"value": "virtual-reality"
},
{
"label": "Wuxia",
"value": "wuxia"
},
{
"label": "Wuxia Xianxia",
"value": "wuxia_xianxia"
},
{
"label": "Xianxia",
"value": "xianxia"
},
{
"label": "Xuanhuan",
"value": "xuanhuan"
},
{
"label": "Yaoi",
"value": "yaoi"
},
{
"label": "Yuri",
"value": "yuri"
}
],
"inputType": "Picker"
}
]
},
{
"id": "Novelmt.com",
"sourceSite": "https://www.novelmt.com/",
"sourceName": "Novelmt.com",
"filters": [
{
"key": "sort",
"label": "Sort By",
"values": [
{
"label": "New",
"value": "newstime"
},
{
"label": "Popular",
"value": "onclick"
},
{
"label": "Updates",
"value": "lastdotime"
}
],
"inputType": "Picker"
},
{
"key": "status",
"label": "Status",
"values": [
{
"label": "All",
"value": "all"
},
{
"label": "Completed",
"value": "Completed"
},
{
"label": "Ongoing",
"value": "Ongoing"
}
],
"inputType": "Picker"
},
{
"key": "genres",
"label": "Genre / Category",
"values": [
{
"label": "All",
"value": "all"
},
{
"label": "Action",
"value": "action"
},
{
"label": "Adult",
"value": "adult"
},
{
"label": "Adventure",
"value": "adventure"
},
{
"label": "Billionaire",
"value": "billionaire"
},
{
"label": "CEO",
"value": "ceo"
},
{
"label": "Chinese",
"value": "chinese"
},
{
"label": "Comedy",
"value": "comedy"
},
{
"label": "Contemporary Romance",
"value": "contemporary-romance"
},
{
"label": "Drama",
"value": "drama"
},
{
"label": "Eastern Fantasy",
"value": "eastern-fantasy"
},
{
"label": "Ecchi",
"value": "ecchi"
},
{
"label": "Erciyuan",
"value": "erciyuan"
},
{
"label": "Faloo",
"value": "faloo"
},
{
"label": "Fan-Fiction",
"value": "fan-fiction"
},
{
"label": "Fantasy",
"value": "fantasy"
},
{
"label": "Fantasy Romance",
"value": "fantasy-romance"
},
{
"label": "Farming",
"value": "farming"
},
{
"label": "Game",
"value": "game"
},
{
"label": "Games",
"value": "games"
},
{
"label": "Gay Romance",
"value": "gay-romance"
},
{
"label": "Gender Bender",
"value": "gender-bender"
},
{
"label": "Harem",
"value": "harem"
},
{
"label": "Historical",
"value": "historical"
},
{
"label": "Historical Romance",
"value": "historical-romance"
},
{
"label": "Horror",
"value": "horror"
},
{
"label": "Isekai",
"value": "isekai"
},
{
"label": "Japanese",
"value": "japanese"
},
{
"label": "Josei",
"value": "josei"
},
{
"label": "Korean",
"value": "korean"
},
{
"label": "Lolicon",
"value": "lolicon"
},
{
"label": "Magic",
"value": "magic"
},
{
"label": "Magical Realism",
"value": "magical-realism"
},
{
"label": "Martial Arts",
"value": "martial-arts"
},
{
"label": "Mature",
"value": "mature"
},
{
"label": "Mecha",
"value": "mecha"
},
{
"label": "Military",
"value": "military"
},
{
"label": "Modern Life",
"value": "modern-life"
},
{
"label": "Modern Romance",
"value": "modern-romance"
},
{
"label": "Mystery",
"value": "mystery"
},
{
"label": "Psychological",
"value": "psychological"
},
{
"label": "Romance",
"value": "romance"
},
{
"label": "Romantic",
"value": "romantic"
},
{
"label": "School Life",
"value": "school-life"
},
{
"label": "Sci-fi",
"value": "sci-fi"
},
{
"label": "Seinen",
"value": "seinen"
},
{
"label": "Shoujo",
"value": "shoujo"
},
{
"label": "Shoujo Ai",
"value": "shoujo-ai"
},
{
"label": "Shounen",
"value": "shounen"
},
{
"label": "Shounen Ai",
"value": "shounen-ai"
},
{
"label": "Slice of Life",
"value": "slice-of-life"
},
{
"label": "Smut",
"value": "smut"
},
{
"label": "Sports",
"value": "sports"
},
{
"label": "Supernatural",
"value": "supernatural"
},
{
"label": "Tragedy",
"value": "tragedy"
},
{
"label": "Two-dimensional",
"value": "two-dimensional"
},
{
"label": "Urban",
"value": "urban"
},
{
"label": "Urban Life",
"value": "urban-life"
},
{
"label": "Video Games",
"value": "video-games"
},
{
"label": "Virtual Reality",
"value": "virtual-reality"
},
{
"label": "Wuxia",
"value": "wuxia"
},
{
"label": "Xianxia",
"value": "xianxia"
},
{
"label": "Xuanhuan",
"value": "xuanhuan"
},
{
"label": "Yaoi",
"value": "yaoi"
},
{
"label": "Yuri",
"value": "yuri"
}
],
"inputType": "Picker"
}
]
},
{
"id": "Ltnovel.com",
"sourceSite": "https://www.ltnovel.com/",
"sourceName": "Ltnovel.com",
"filters": [
{
"key": "sort",
"label": "Sort By",
"values": [
{
"label": "New",
"value": "newstime"
},
{
"label": "Popular",
"value": "onclick"
},
{
"label": "Updates",
"value": "lastdotime"
}
],
"inputType": "Picker"
},
{
"key": "status",
"label": "Status",
"values": [
{
"label": "All",
"value": "all"
},
{
"label": "Completed",
"value": "Completed"
},
{
"label": "Ongoing",
"value": "Ongoing"
}
],
"inputType": "Picker"
},
{
"key": "genres",
"label": "Genre / Category",
"values": [
{
"label": "All",
"value": "all"
},
{
"label": "Action",
"value": "action"
},
{
"label": "Adult",
"value": "adult"
},
{
"label": "Adventure",
"value": "adventure"
},
{
"label": "Comedy",
"value": "comedy"
},
{
"label": "Contemporary Romance",
"value": "contemporary-romance"
},
{
"label": "Drama",
"value": "drama"
},
{
"label": "Eastern Fantasy",
"value": "eastern-fantasy"
},
{
"label": "Ecchi",
"value": "ecchi"
},
{
"label": "Fantasy",
"value": "fantasy"
},
{
"label": "Fantasy Romance",
"value": "fantasy-romance"
},
{
"label": "Game",
"value": "game"
},
{
"label": "Gender Bender",
"value": "gender-bender"
},
{
"label": "Harem",
"value": "harem"
},
{
"label": "Historical",
"value": "historical"
},
{
"label": "Horror",
"value": "horror"
},
{
"label": "Josei",
"value": "josei"
},
{
"label": "Lolicon",
"value": "lolicon"
},
{
"label": "Magical Realism",
"value": "magical-realism"
},
{
"label": "Martial Arts",
"value": "martial-arts"
},
{
"label": "Mature",
"value": "mature"
},
{
"label": "Mecha",
"value": "mecha"
},
{
"label": "Mystery",
"value": "mystery"
},
{
"label": "Psychological",
"value": "psychological"
},
{
"label": "Romance",
"value": "romance"
},
{
"label": "School Life",
"value": "school-life"
},
{
"label": "Sci-fi",
"value": "sci-fi"
},
{
"label": "Seinen",
"value": "seinen"
},
{
"label": "Shoujo",
"value": "shoujo"
},
{
"label": "Shounen",
"value": "shounen"
},
{
"label": "Shounen Ai",
"value": "shounen-ai"
},
{
"label": "Slice of Life",
"value": "slice-of-life"
},
{
"label": "Smut",
"value": "smut"
},
{
"label": "Sports",
"value": "sports"
},
{
"label": "Supernatural",
"value": "supernatural"
},
{
"label": "Tragedy",
"value": "tragedy"
},
{
"label": "Video Games",
"value": "video-games"
},
{
"label": "Wuxia",
"value": "wuxia"
},
{
"label": "Xianxia",
"value": "xianxia"
},
{
"label": "Xuanhuan",
"value": "xuanhuan"
},
{
"label": "Yaoi",
"value": "yaoi"
}
],
"inputType": "Picker"
}
]
}
]
+233 -275
View File
@@ -11,283 +11,241 @@ export const generateAll: ScrpitGeneratorFunction = function () {
const generator = function generator(sourceJson: sourceData) {
const pluginId = sourceJson.id;
const souceName = sourceJson.sourceName;
const sourceName = sourceJson.sourceName;
const iconFileName = sourceName.split('.')[0].toLowerCase() + '.png';
const site = sourceJson.sourceSite;
const filters = sourceJson.filters;
const filetersString = JSON.stringify(filters).replace(/(\"inputType\":)\s*\"([^\"]+)\"/g, "$1FilterInputs.$2");
const pluginScript = `
import { load as parseHTML } from "cheerio";
// import dayjs from 'dayjs';
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
// import { parseMadaraDate } from "@libs/parseMadaraDate";
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
// import { showToast } from "@libs/showToast";
import { Filter, FilterInputs } from "@libs/filterInputs";
import { NovelStatus } from '@libs/novelStatus';
// import { defaultCover } from "@libs/defaultCover";
export const id = "${pluginId}";
export const name = "${souceName}";
export const icon = "";
export const version = "1.0.0";
export const site = "${site}";
const baseUrl = site;
const customFilters: Filter[] = ${filetersString};
export const filters = [
{
key: 'sort',
label: 'Сортировка',
values: [
{ label: 'По рейтингу', value: '6' },
{ label: 'По степени готовности', value: '0' },
{ label: 'По названию на языке оригинала', value: '1' },
{ label: 'По названию на языке перевода', value: '2' },
{ label: 'По дате создания', value: '3' },
{ label: 'По дате последней активности', value: '4' },
{ label: 'По просмотрам', value: '5' },
{ label: 'По кол-ву переведённых глав', value: '7' },
{ label: 'По кол-ву лайков', value: '8' },
{ label: 'По кол-ву страниц', value: '10' },
{ label: 'По кол-ву бесплатных глав', value: '11' },
{ label: 'По кол-ву рецензий', value: '12' },
{ label: 'По кол-ву в закладках', value: '13' },
{ label: 'По кол-ву в избранном', value: '14' },
],
inputType: FilterInputs.Picker,
},
{
key: 'type',
label: 'Тип',
values: [
{ label: 'Неважно', value: '0' },
{ label: 'Только переводы', value: '1' },
{ label: 'Только авторские', value: '2' },
],
inputType: FilterInputs.Picker,
},
{
key: 'atmosphere',
label: 'Атмосфера',
values: [
{ label: 'Неважно', value: '0' },
{ label: 'Позитивная', value: '1' },
{ label: 'Dark', value: '2' },
],
inputType: FilterInputs.Picker,
},
{
key: 'trash',
label: 'Другое',
values: [
{ label: 'Готовые на 100%', value: 'ready' },
{ label: 'Доступные для перевода', value: 'tr' },
{ label: 'Доступные для скачивания', value: 'gen' },
{ label: 'Завершённые проекты', value: 'wealth' },
{ label: 'Распродажа', value: 'discount' },
{ label: 'Только онгоинги', value: 'ongoings' },
{ label: 'Убрать машинный', value: 'remove_machinelate' },
],
inputType: FilterInputs.Checkbox,
},
...customFilters,
{
key: 'adult',
label: 'Возрастные ограничения',
values: [
{ label: 'Все', value: '0' },
{ label: 'Убрать 18+', value: '1' },
{ label: 'Только 18+', value: '2' },
],
inputType: FilterInputs.Picker,
},
];
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters, showLatestNovels }
) {
let url = baseUrl + '/search?t=&cat=2';
url += '&sort=' + showLatestNovels ? '4' : filters?.sort || '6';
url += '&type=' + filters?.type || '0';
url += '&atmosphere=' + filters?.atmosphere || '0';
url += '&adult=' + filters?.adult || '0';
if (filters?.genres instanceof Array) {
url += filters.genres.map(i => '&genres[]='+i).join('');
}
if (filters?.tags instanceof Array) {
url += filters.tags.map(i => '&tags[]='+i).join('');
}
if (filters?.trash instanceof Array) {
url += filters.trash.map(i => '&' + i + '=1');
}
url += '&Book_page=' + page;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Novel.Item[] = [];
loadedCheerio(
'ul[class="search-results"] > li:not([class="ad_type_catalog"])',
).each(function () {
novels.push({
name: loadedCheerio(this).find('p > a').text(),
cover: baseUrl + loadedCheerio(this).find('img').attr('src'),
url: baseUrl + loadedCheerio(this).find('p > a').attr('href') || '',
});
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const novel: Novel.instance = {
url: novelUrl,
chapters: [],
};
let result = await fetchApi(novelUrl);
if (result.url.includes('mature?path=')) {
const formData = new FormData();
formData.append('path', novelUrl);
formData.append('ok', 'Да');
await fetch(result.url, {
method: 'POST',
body: formData,
});
result = await fetchApi(novelUrl);
}
const body = await result.text();
const loadedCheerio = parseHTML(body);
novel.name = loadedCheerio('div[class="container"] > div > div > h1')
.text()
.trim();
novel.cover =
baseUrl + loadedCheerio('div[class="images"] > div img').attr('src');
novel.summary = loadedCheerio('#Info > div:nth-child(3)').text();
let genres: string[] = [];
loadedCheerio('div[class="span5"] > p').each(function () {
switch (loadedCheerio(this).find('strong').text()) {
case 'Автор:':
novel.author = loadedCheerio(this).find('em > a').text().trim();
break;
case 'Выпуск:':
novel.status =
loadedCheerio(this).find('em').text().trim() === 'продолжается'
? NovelStatus.Ongoing
: NovelStatus.Completed;
break;
case 'Тэги:':
loadedCheerio(this)
.find('em > a')
.each(function () {
genres.push(loadedCheerio(this).text());
});
break;
case 'Жанры:':
loadedCheerio(this)
.find('em > a')
.each(function () {
genres.push(loadedCheerio(this).text());
});
break;
}
});
if (genres.length > 0) {
novel.genres = genres.reverse().join(',');
}
const chapters: Chapter.Item[] = [];
loadedCheerio('table > tbody > tr.chapter_row').each(function () {
const chapterName = loadedCheerio(this)
.find('td[class="t"] > a')
.text()
.trim();
const releaseDate = loadedCheerio(this)
.find('td > span')
.attr('title')
?.trim();
const chapterUrl = baseUrl + loadedCheerio(this)
.find('td[class="t"] > a')
.attr('href');
if (
loadedCheerio(this).find('td > span[class="disabled"]').length < 1 &&
releaseDate
) {
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
}
});
novel.chapters = chapters;
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
let result = await fetchApi(chapterUrl);
if (result.url.includes('mature?path=')) {
const formData = new FormData();
formData.append('ok', 'Да');
await fetch(result.url, {
method: 'POST',
body: formData,
});
result = await fetchApi(chapterUrl);
}
const body = await result.text();
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio('.content-text').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const result = await fetchApi(
baseUrl + '/search/autocomplete?query=' + searchTerm,
);
let json: any = await result.json();
json.forEach((item: any) => {
const novelName = item.title_one + ' / ' + item.title_two;
const novelCover = baseUrl + item.img;
const novelUrl = baseUrl + item.url;
novels.push({ name: novelName, cover: novelCover, url: novelUrl });
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url, {});
};
`
return {
lang: "Russian",
filename: souceName,
pluginScript,
};
import { load as parseHTML } from "cheerio";
// import dayjs from 'dayjs';
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
// import { parseMadaraDate } from "@libs/parseMadaraDate";
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
// import { showToast } from "@libs/showToast";
import { FilterInputs } from "@libs/filterInputs";
import { NovelStatus } from '@libs/novelStatus';
// import { defaultCover } from "@libs/defaultCover";
export const id = "${pluginId}";
export const name = "${sourceName}";
export const icon = "multisrc/rulate/icons/${iconFileName}";
export const version = "1.0.0";
export const site = "${site}";
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters, showLatestNovels }
) {
let url = site + '/search?t=';
url += '&cat=' + (filters?.cat || '0');
url += '&s_lang=' + (filters?.s_lang || '0');
url += '&t_lang=' + (filters?.t_lang || '0');
url += '&type=' + (filters?.type || '0');
url += '&sort=' + (showLatestNovels ? '4' : (filters?.sort || '6'));
url += '&atmosphere=' + (filters?.atmosphere || '0');
url += '&adult=' + (filters?.adult || '0');
if (filters?.genres instanceof Array) {
url += filters.genres.map(i => '&genres[]=' + i).join('');
}
if (filters?.genres_ex instanceof Array) {
url += filters.genres_ex.map(i => '&genres_ex[]=' + i).join('');
}
if (filters?.tags instanceof Array) {
url += filters.tags.map(i => '&tags[]=' + i).join('');
}
if (filters?.tags_ex instanceof Array) {
url += filters.tags_ex.map(i => '&tags_ex[]=' + i).join('');
}
if (filters?.fandoms instanceof Array) {
url += filters.fandoms.map(i => '&fandoms[]=' + i).join('');
}
if (filters?.fandoms_ex instanceof Array) {
url += filters.fandoms_ex.map(i => '&fandoms_ex[]=' + i).join('');
}
if (filters?.trash instanceof Array) {
url += filters.trash.map(i => '&' + i + '=1').join('');
}
url += '&Book_page=' + page;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Novel.Item[] = [];
loadedCheerio(
'ul[class="search-results"] > li:not([class="ad_type_catalog"])',
).each(function () {
novels.push({
name: loadedCheerio(this).find('p > a').text(),
cover: site + loadedCheerio(this).find('img').attr('src'),
url: site + loadedCheerio(this).find('p > a').attr('href') || '',
});
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const novel: Novel.instance = {
url: novelUrl,
chapters: [],
};
let result = await fetchApi(novelUrl);
if (result.url.includes('mature?path=')) {
const formData = new FormData();
formData.append('path', novelUrl);
formData.append('ok', 'Да');
await fetchApi(result.url, {
method: 'POST',
body: formData,
});
result = await fetchApi(novelUrl);
}
const body = await result.text();
const loadedCheerio = parseHTML(body);
novel.name = loadedCheerio('div[class="container"] > div > div > h1, div.span8:nth-child(1) > h1:nth-child(2)')
.text()
.trim();
novel.cover =
site + loadedCheerio('div[class="images"] > div img').attr('src');
novel.summary = loadedCheerio('#Info > div:nth-child(3), .book-description').text();
novel.author = loadedCheerio('.book-stats-icons_author > span:nth-child(2) > a:nth-child(1)').text()
let genres: string[] = [];
loadedCheerio('div.span5 > p, .span5 > div:nth-child(2) > p').each(function () {
switch (loadedCheerio(this).find('strong').text()) {
case 'Автор:':
novel.author = loadedCheerio(this).find('em > a').text().trim();
break;
case 'Выпуск:':
novel.status =
loadedCheerio(this).find('em').text().trim() === 'продолжается'
? NovelStatus.Ongoing
: NovelStatus.Completed;
break;
case 'Тэги:':
loadedCheerio(this)
.find('em > a')
.each(function () {
genres.push(loadedCheerio(this).text());
});
break;
case 'Жанры:':
loadedCheerio(this)
.find('em > a')
.each(function () {
genres.push(loadedCheerio(this).text());
});
break;
}
});
if (genres.length > 0) {
novel.genres = genres.reverse().join(',');
}
const chapters: Chapter.Item[] = [];
loadedCheerio('table > tbody > tr.chapter_row').each(function () {
const chapterName = loadedCheerio(this)
.find('td[class="t"] > a')
.text()
.trim();
const releaseDate = loadedCheerio(this)
.find('td > span')
.attr('title')
?.trim();
const chapterUrl = site + loadedCheerio(this)
.find('td[class="t"] > a')
.attr('href');
if (
loadedCheerio(this).find('td > span[class="disabled"]').length < 1 &&
releaseDate
) {
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
}
});
novel.chapters = chapters;
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
let result = await fetchApi(chapterUrl);
if (result.url.includes('mature?path=')) {
const formData = new FormData();
formData.append('ok', 'Да');
await fetchApi(result.url, {
method: 'POST',
body: formData,
});
result = await fetchApi(chapterUrl);
}
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio('.content-text img').each(function () {
if (!loadedCheerio(this).attr('src')?.startsWith('http')) {
const src = loadedCheerio(this).attr('src');
loadedCheerio(this).attr('src', site + src);
}
});
const chapterText = loadedCheerio('.content-text').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const result = await fetchApi(
site + '/search/autocomplete?query=' + searchTerm,
);
let json = await result.json() as response[];
json.forEach((item) => {
const novelName = item.title_one + ' / ' + item.title_two;
const novelCover = site + item.img;
const novelUrl = site + item.url;
novels.push({ name: novelName, cover: novelCover, url: novelUrl });
});
return novels;
};
interface response {
id: number;
title_one: string;
title_two: string;
url: string;
img: string;
};
export const fetchImage: Plugin.fetchImage = fetchFile;
export const filters = ${filetersString};`
return {
lang: "Russian",
filename: sourceName,
pluginScript,
};
};
File diff suppressed because it is too large Load Diff