feat: Plugins (#465)
* update * gitignore * base file * template * json generator * remove valid method * Update README.md README * update template * Update README.md * update template * not support async arrow function * remove valid method * basic plugin validation. * Update README.md * update template * Update README.md * add fetchFile lib. empy .language file * comment fetch * update * comment fetch * auto comment, update template, template.min * Update README.md * add option to test * reset version * Update README.md * small fix for LightNovelReader * comment fetch * minor: LL date format * refactor: rename project, remove html2text lib * fix: error if there's no plugin changed * implement cookies bypass * update template.min.js * add syosetu * fix: get last file in case removing. shorter id * shoter native language name * change app project name * testing with UI would be less painful :) * remove console.log * Update README.md for UI testing * fix Syosetu * remove try catch * add ranobehub * add json for ranobehub * wrong icon path :D * fix ranobehub * fix status ranobe * add french * fix css * add chireads * add indonesian * add sakura novel * add sakuranovel json * add spanish * add skynovels * fix skynovels * add agitoon * add turkish * add epiknovel * add portuguese * update template * cheerio_space * add novel Fullme * minor * lol, this source havent been finished before. cant help * cant bypass this * add hasutl * novelasligera not working properly * add novelpub, but no searching * add jaomix * fix jaomix * add ranoberf * add indowebnovel * add novelringan * add noveldeglace * search not work for this * add oasisTL, this should have better popularNovels * add tunovelaligera * this source need to fix search * add bestlightnovel * add comrade mao * minor fix * add divinedaolibrary * add freewebnovel * lol xD * minor * update json * fix icon novelawuxia * update site in for pluginItem * some changes for more convenient * remove try catch * Update README.md * remove * Update README.md * trying to use pre-commit * update README * feat: .env for repo config * add foxaholic (#2) * rebase fox * fox officially 1.0.0 --------- Co-authored-by: K1ngfish3r <trulyihu@gmail.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
GITHUB_USERNAME='nyagami'
|
||||
GITHUB_REPOSITORY='plugins'
|
||||
GITHUB_BRANCH='main'
|
||||
@@ -0,0 +1,2 @@
|
||||
node_modules/**/*
|
||||
.vscode
|
||||
@@ -1,11 +1,58 @@
|
||||
# LNReader Sources
|
||||
|
||||
|
||||
# LNReader Plugins
|
||||
|
||||
<p>
|
||||
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/lnreader/lnreader-sources/Source%20Request?color=success&label=source%20requests">
|
||||
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/lnreader/lnreader-sources/Bug?color=red&label=bugs">
|
||||
</p>
|
||||
|
||||
Repository to host source related issues, and requests for [LNReader](https://github.com/LNReader/lnreader).
|
||||
Repository to host plugins and related issues, and requests for [LNReader](https://github.com/LNReader/lnreader).
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Please use this [template](./template.js) or [template.min](./template.min.js)
|
||||
2. Choose your language in [./plugins](./plugins)
|
||||
+ If your language doenst exist, please request us. We will add it soon.
|
||||
3. Write your scripts
|
||||
+ See example: [Hako](./plugins/vietnamese/LNHako.js)
|
||||
|
||||
## Test your script
|
||||
We use expressjs to make an UI web for testing.
|
||||
1. Installing
|
||||
```
|
||||
npm install
|
||||
```
|
||||
2. Running
|
||||
```
|
||||
nodemon index.js
|
||||
```
|
||||
+ Then open http://localhost:3000
|
||||
3. Testing
|
||||
+ Find you plugin
|
||||
+ Check if all functions of your plugin work properly
|
||||
#### No need to reload webpage after changing your plugin script.
|
||||
- One more thing: you can use [cheerio_space](./cheerio_space) to build functions without requesting to the site.
|
||||
----------
|
||||
|
||||
If you want to test plugin in app side, remember to config these things.
|
||||
|
||||
in [.env](./.env)
|
||||
```
|
||||
GITHUB_USERNAME='nyagami'
|
||||
GITHUB_REPOSITORY='plugins'
|
||||
GITHUB_BRANCH='main'
|
||||
```
|
||||
|
||||
in [pluginManager.ts](https://github.com/nyagami/lnreader/blob/install_sources/src/plugins/pluginManager.ts)
|
||||
```ts
|
||||
const fetchPlugins = async () => {
|
||||
const availablePlugins: Record<Languages, Array<PluginItem>> = await fetch(
|
||||
'https://raw.githubusercontent.com/nyagami/plugins/main/plugins/plugins.min.json',
|
||||
).then(res => res.json());
|
||||
return availablePlugins;
|
||||
};
|
||||
```
|
||||
|
||||
----------
|
||||
The developer of this application does not have any affiliation with the content providers available.
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
const fs = require('fs');
|
||||
const languages = require('@libs/languages');
|
||||
const path = require('path')
|
||||
const root = path.dirname(require.main.filename);
|
||||
|
||||
const githubIconsLink = 'https://raw.githubusercontent.com/nyagami/plugins/main/icons';
|
||||
const githubIconSuffix = '?raw=true';
|
||||
const githubPluginsLink = 'https://raw.githubusercontent.com/nyagami/plugins/main/plugins';
|
||||
const githubPluginSuffix = '?newtest=true';
|
||||
|
||||
const all_plugins = () => {
|
||||
const res = {}
|
||||
for (let language in languages) { //language with English name
|
||||
const langPath = path.join(root, 'plugins', language.toLowerCase());
|
||||
if (!fs.existsSync(langPath)) continue;
|
||||
const plugins = fs.readdirSync(langPath);
|
||||
res[languages[language]] = [];
|
||||
plugins.forEach(plugin => {
|
||||
if(plugin.startsWith('.')) return;
|
||||
const requirePath = `@plugins/${language.toLowerCase()}/${plugin.split('.')[0]}`
|
||||
const instance = require(requirePath);
|
||||
const { id, name, lang, version, icon, description } = instance;
|
||||
const info = { id, name, lang, version, description } // lang: language with native name
|
||||
info.url = `${githubPluginsLink}/${language.toLowerCase()}/${plugin}${githubPluginSuffix}`;
|
||||
info.iconUrl = `${githubIconsLink}/${icon}${githubIconSuffix}`;
|
||||
info.requirePath = requirePath;
|
||||
res[lang].push(info);
|
||||
});
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const popularNovels = async (pluginRequirePath, {showLatestNovels, filters}) => {
|
||||
return await require(pluginRequirePath).popularNovels(1, {showLatestNovels, filters});
|
||||
}
|
||||
|
||||
const searchNovels = async (pluginRequirePath, searchTerm) => {
|
||||
return await require(pluginRequirePath).searchNovels(searchTerm);
|
||||
}
|
||||
|
||||
const parseNovelAndChapters = async(pluginRequirePath, novelUrl) => {
|
||||
return await require(pluginRequirePath).parseNovelAndChapters(novelUrl);
|
||||
}
|
||||
|
||||
const parseChapter = async (pluginRequirePath, chapterUrl) => {
|
||||
return await require(pluginRequirePath).parseChapter(chapterUrl);
|
||||
}
|
||||
|
||||
const fetchImage = async (pluginRequirePath, url) => {
|
||||
return await require(pluginRequirePath).fetchImage(url);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
all_plugins,
|
||||
popularNovels,
|
||||
searchNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
fetchImage
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
Html source to test with cheerio.
|
||||
Do not make too many requests, you could get banned from site.
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const body = fs.readFileSync(path.join(__dirname, 'source.html')).toString();
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
@@ -0,0 +1,47 @@
|
||||
require('module-alias/register');
|
||||
|
||||
const path = require('path');
|
||||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const pluginApi = require('@api/plugins');
|
||||
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
const host = 'localhost';
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use('/static', express.static(path.join(__dirname, 'test_web', 'static')));
|
||||
app.get('/all_plugins', (req, res) => {
|
||||
res.json(pluginApi.all_plugins());
|
||||
});
|
||||
app.post('/popularNovels/', async (req, res) => {
|
||||
const filters = req.body['filters'] || {};
|
||||
const showLatestNovels = req.body['showLatestNovels'] || false
|
||||
const novels = await pluginApi.popularNovels(req.body['pluginRequirePath'], {showLatestNovels, filters});
|
||||
res.json(novels);
|
||||
});
|
||||
app.post('/searchNovels/', async(req, res) => {
|
||||
const novels = await pluginApi.searchNovels(req.body['pluginRequirePath'], req.body['searchTerm']);
|
||||
res.json(novels);
|
||||
})
|
||||
app.post('/parseNovelAndChapters/', async(req, res) => {
|
||||
const sourceNovel = await pluginApi.parseNovelAndChapters(req.body['pluginRequirePath'], req.body['novelUrl']);
|
||||
res.json(sourceNovel);
|
||||
})
|
||||
app.post('/parseChapter/', async(req, res) => {
|
||||
const chapterText = await pluginApi.parseChapter(req.body['pluginRequirePath'], req.body['chapterUrl']);
|
||||
res.json(chapterText);
|
||||
})
|
||||
app.post('/fetchImage/', async(req, res) => {
|
||||
const base64 = await pluginApi.fetchImage(req.body['pluginRequirePath'], req.body['url']);
|
||||
res.json(base64);
|
||||
})
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'test_web', 'index.html'));
|
||||
});
|
||||
|
||||
|
||||
app.listen(port, host, () => {
|
||||
console.log("testing plugins web listening on http://localhost:3000");
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@api/*": [
|
||||
"./api/*",
|
||||
],
|
||||
"@libs/*": [
|
||||
"./libs/*",
|
||||
],
|
||||
"@icons/*": [
|
||||
"./icons/*",
|
||||
],
|
||||
"@plugins/*": [
|
||||
"./plugins/*",
|
||||
],
|
||||
"@scripts/*": [
|
||||
"./scripts/*",
|
||||
]
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||
|
||||
const defaultUserAgentString =
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36';
|
||||
|
||||
async function fetchApi (url, init, pluginId){
|
||||
const headers = {
|
||||
...init?.headers,
|
||||
'User-Agent': defaultUserAgentString,
|
||||
};
|
||||
return await fetch(url, { ...init, headers });
|
||||
}
|
||||
|
||||
module.exports = fetchApi
|
||||
@@ -0,0 +1,15 @@
|
||||
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||
|
||||
async function fetchFile(url, init){
|
||||
if(!init) init = {};
|
||||
try{
|
||||
const res = await fetch(url, init);
|
||||
if(!res.ok) return undefined;
|
||||
const arrayBuffer = await res.arrayBuffer();
|
||||
return Buffer.from(arrayBuffer).toString('base64');
|
||||
}catch(e){
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = fetchFile;
|
||||
@@ -0,0 +1,7 @@
|
||||
const FilterInputs = {
|
||||
TextInput: 0,
|
||||
Picker: 1,
|
||||
Checkbox: 2,
|
||||
}
|
||||
|
||||
module.exports = FilterInputs
|
||||
@@ -0,0 +1,25 @@
|
||||
const isUrlAbsolute = (url) => {
|
||||
if (url) {
|
||||
if (url.indexOf('//') === 0) {
|
||||
return true;
|
||||
} // URL is protocol-relative (= absolute)
|
||||
if (url.indexOf('://') === -1) {
|
||||
return false;
|
||||
} // URL has no protocol (= relative)
|
||||
if (url.indexOf('.') === -1) {
|
||||
return false;
|
||||
} // URL does not contain a dot, i.e. no TLD (= relative, possibly REST)
|
||||
if (url.indexOf('/') === -1) {
|
||||
return false;
|
||||
} // URL does not contain a single slash (= relative)
|
||||
if (url.indexOf(':') > url.indexOf('/')) {
|
||||
return false;
|
||||
} // The first colon comes after the first slash (= relative)
|
||||
if (url.indexOf('://') < url.indexOf('.')) {
|
||||
return true;
|
||||
} // Protocol is defined before first dot (= absolute)
|
||||
}
|
||||
return false; // Anything else must be relative
|
||||
};
|
||||
|
||||
module.exports = isUrlAbsolute;
|
||||
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
Arabic: 'العربية',
|
||||
Chinese: '中文, 汉语, 漢語',
|
||||
English: 'English',
|
||||
French: 'français, française',
|
||||
Indonesian: 'Bahasa Indonesia',
|
||||
Japanese: '日本語',
|
||||
Korean: '한국어, 조선말',
|
||||
Portuguese: 'Português',
|
||||
Russian: 'русский язык',
|
||||
Spanish: 'español, castellano',
|
||||
Turkish: 'Türkçe',
|
||||
Vietnamese: 'Tiếng Việt',
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
module.exports = {
|
||||
Unknown: 'Unknown',
|
||||
Ongoing: 'Ongoing',
|
||||
Completed: 'Completed',
|
||||
Licensed: 'Licensed',
|
||||
PublishingFinished: 'Publishing Finished',
|
||||
Cancelled: 'Cancelled',
|
||||
OnHiatus: 'On Hiatus',
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
const parseMadaraDate = date => {
|
||||
let releaseDate = date;
|
||||
|
||||
if (date.includes('ago')) {
|
||||
let timeAgo = date;
|
||||
releaseDate = new Date();
|
||||
|
||||
timeAgo = timeAgo.match(/\d+/)[0];
|
||||
|
||||
if (timeAgo.includes('hours ago') || timeAgo.includes('hour ago')) {
|
||||
releaseDate.setHours(releaseDate.getHours() - timeAgo);
|
||||
}
|
||||
|
||||
if (timeAgo.includes('days ago') || timeAgo.includes('day ago')) {
|
||||
releaseDate.setDate(releaseDate.getDate() - timeAgo);
|
||||
}
|
||||
|
||||
if (timeAgo.includes('months ago') || timeAgo.includes('month ago')) {
|
||||
releaseDate.setMonth(releaseDate.getMonth() - timeAgo);
|
||||
}
|
||||
|
||||
releaseDate = dayjs(releaseDate).format('LL');
|
||||
}
|
||||
|
||||
return releaseDate;
|
||||
};
|
||||
|
||||
module.exports = parseMadaraDate;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ignore": ["plugins/plugins.json", "plugins/plugins.min.json", "cheerio_space/*"]
|
||||
}
|
||||
Generated
+2897
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "lnreader-plugins",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node ./index.js",
|
||||
"test": "exit 0",
|
||||
"json": "node ./scripts/json_plugins.js && git add ."
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.20.2",
|
||||
"cheerio": "^1.0.0-rc.10",
|
||||
"cli-color": "^2.0.3",
|
||||
"dayjs": "^1.11.4",
|
||||
"dotenv": "^16.0.3",
|
||||
"express": "^4.18.2",
|
||||
"module-alias": "^2.2.2",
|
||||
"node-fetch": "^3.3.1"
|
||||
},
|
||||
"_moduleAliases": {
|
||||
"@api": "./api",
|
||||
"@libs": "./libs",
|
||||
"@icons": "./icons",
|
||||
"@plugins": "./plugins",
|
||||
"@scripts": "./scripts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.22",
|
||||
"pre-commit": "^1.2.2"
|
||||
},
|
||||
"pre-commit": [
|
||||
"json"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
const cheerio = require('cheerio');
|
||||
const languages = require('@libs/languages');
|
||||
const isUrlAbsolute = require('@libs/isAbsoluteUrl');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
|
||||
const pluginId = 'LNR.org';
|
||||
const baseUrl = 'https://lightnovelreader.org';
|
||||
|
||||
async function popularNovels(page) {
|
||||
const url = baseUrl + '/ranking/top-rated/' + page;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novels = [];
|
||||
|
||||
loadedCheerio('.category-items.ranking-category.cm-list > ul > li').each(
|
||||
function () {
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
if (novelUrl && !isUrlAbsolute(novelUrl)) {
|
||||
novelUrl = baseUrl + novelUrl;
|
||||
}
|
||||
|
||||
if (novelUrl) {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find('.category-name a')
|
||||
.text()
|
||||
.trim();
|
||||
let novelCover = loadedCheerio(this)
|
||||
.find('.category-img img')
|
||||
.attr('src');
|
||||
|
||||
if (novelCover && !isUrlAbsolute(novelCover)) {
|
||||
novelCover = baseUrl + novelCover;
|
||||
}
|
||||
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.section-header-title > h2').text();
|
||||
|
||||
let novelCover = loadedCheerio('.novels-detail img').attr('src');
|
||||
|
||||
novel.cover = novelCover
|
||||
? isUrlAbsolute(novelCover)
|
||||
? novelCover
|
||||
: baseUrl + novelCover
|
||||
: undefined;
|
||||
|
||||
novel.summary = loadedCheerio(
|
||||
'div.container > div > div.col-12.col-xl-9 > div > div:nth-child(5) > div',
|
||||
)
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.author = loadedCheerio(
|
||||
'div.novels-detail-right > ul > li:nth-child(6) > .novels-detail-right-in-right > a',
|
||||
)
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.genres = loadedCheerio(
|
||||
'body > section:nth-child(4) > div > div > div.col-12.col-xl-9 > div > div:nth-child(2) > div > div.novels-detail-right > ul > li:nth-child(3) > div.novels-detail-right-in-right',
|
||||
)
|
||||
.text()
|
||||
.trim()
|
||||
|
||||
novel.status = loadedCheerio(
|
||||
'div.novels-detail-right > ul > li:nth-child(2) > .novels-detail-right-in-right',
|
||||
)
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
loadedCheerio('.cm-tabs-content > ul > li').each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
if (chapterUrl && !isUrlAbsolute(chapterUrl)) {
|
||||
chapterUrl = baseUrl + chapterUrl;
|
||||
}
|
||||
|
||||
if (chapterUrl) {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
const releaseDate = null;
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novel.chapters.push(chapter);
|
||||
}
|
||||
});
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter(chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const chapterText = loadedCheerio('#chapterText').html() || '';
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = baseUrl + `/search/autocomplete?dataType=json&query=${searchTerm}`;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json();
|
||||
const data = body.results || [];
|
||||
|
||||
const novels = [];
|
||||
|
||||
data.forEach(item => {
|
||||
let novelUrl = item.link;
|
||||
let novelName = item.original_title
|
||||
let novelCover = item.image;
|
||||
|
||||
novels.push({
|
||||
url: novelUrl,
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
});
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function fetchImage (url) {
|
||||
return await fetchFile(url, {});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: 'LightNovelReader',
|
||||
icon: 'src/en/lightnovelreader/icon.png',
|
||||
version: '1.0.0',
|
||||
site: baseUrl,
|
||||
lang: languages.English,
|
||||
description: 'This is description for plugin',
|
||||
protected: false,
|
||||
fetchImage,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
|
||||
const pluginId = 'NF.me';
|
||||
const sourceName = 'NovelFull.me';
|
||||
|
||||
const baseUrl = 'https://novelfull.me/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const url = `${baseUrl}popular?page=${page}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.book-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.title').text();
|
||||
const novelCover =
|
||||
'https:' + loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelUrl =
|
||||
baseUrl + loadedCheerio(this).find('.title a').attr('href').substring(1);
|
||||
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
url,
|
||||
name: '',
|
||||
cover: '',
|
||||
author: '',
|
||||
status: '',
|
||||
genres: '',
|
||||
summary: '',
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.name h1').text().trim();
|
||||
|
||||
novel.cover =
|
||||
'https:' + loadedCheerio('.img-cover img').attr('data-src');
|
||||
|
||||
novel.summary = loadedCheerio(
|
||||
'body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.mt-1 > div.section.box.mt-1.summary > div.section-body > p.content',
|
||||
)
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.author = 'Unknown';
|
||||
|
||||
novel.status = loadedCheerio(
|
||||
'body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.book-info > div.detail > div.meta.box.mt-1.p-10 > p:nth-child(1) > a > span',
|
||||
)
|
||||
.text()
|
||||
?.trim();
|
||||
|
||||
novel.genres = loadedCheerio(
|
||||
'body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.book-info > div.detail > div.meta.box.mt-1.p-10 > p:nth-child(2)',
|
||||
)
|
||||
.text()
|
||||
?.replace('Genres :', '')
|
||||
.replace(/[\s\n]+/g, ' ')
|
||||
.trim();
|
||||
|
||||
let chapters = [];
|
||||
|
||||
const chaptersUrl =
|
||||
novelUrl.replace(baseUrl, 'https://novelfull.me/api/novels/') +
|
||||
'/chapters?source=detail';
|
||||
|
||||
const chaptersRequest = await fetchApi(chaptersUrl);
|
||||
const chaptersHtml = await chaptersRequest.text();
|
||||
|
||||
loadedCheerio = cheerio.load(chaptersHtml);
|
||||
|
||||
loadedCheerio('li').each(function () {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find('.chapter-title')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find('.chapter-update')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
|
||||
novel.chapters = chapters.reverse();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
loadedCheerio('#listen-chapter').remove();
|
||||
loadedCheerio('#google_translate_element').remove();
|
||||
|
||||
const chapterText = loadedCheerio('.chapter__content').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}search?status=all&sort=views&q=${searchTerm}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.book-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.title').text();
|
||||
const novelCover =
|
||||
'https:' + loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelUrl =
|
||||
baseUrl + loadedCheerio(this).find('.title a').attr('href').substring(1);
|
||||
|
||||
const novel = {name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
lang: languages.English,
|
||||
version: '1.0.0',
|
||||
icon: 'src/en/novelfullme/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,120 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const pluginId = 'NO.net';
|
||||
const sourceName = 'novelsOnline';
|
||||
|
||||
const baseUrl = 'https://novelsonline.net';
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const result = await fetchApi(
|
||||
'https://novelsonline.net/sResults.php',
|
||||
{
|
||||
headers: {
|
||||
'Accept': '*/*',
|
||||
'Accept-Language': 'pl,en-US;q=0.7,en;q=0.3',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
},
|
||||
method: 'POST',
|
||||
body: 'q=' + encodeURIComponent(searchTerm),
|
||||
},
|
||||
pluginId
|
||||
).then(res => res.text());
|
||||
let $ = cheerio.load(result);
|
||||
|
||||
const headers = $('li');
|
||||
return headers
|
||||
.map((i, h) => {
|
||||
const novelName = $(h).text();
|
||||
const novelUrl = $(h).find('a').attr('href');
|
||||
const novelCover = $(h).find('img').attr('src');
|
||||
|
||||
if (!novelUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
})
|
||||
.get()
|
||||
.filter(sr => sr !== null);
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl){
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
const result = await fetchApi(novelUrl).then(res => res.text());
|
||||
let $ = cheerio.load(result);
|
||||
|
||||
novel.name = $('h1').text();
|
||||
novel.cover = $('.novel-cover').find('a > img').attr('src');
|
||||
novel.author = $(
|
||||
'div.novel-details > div:nth-child(5) > div.novel-detail-body',
|
||||
)
|
||||
.find('li')
|
||||
.map((_, el) => $(el).text())
|
||||
.get()
|
||||
.join(', ');
|
||||
|
||||
novel.genres = $(
|
||||
'div.novel-details > div:nth-child(2) > div.novel-detail-body',
|
||||
)
|
||||
.find('li')
|
||||
.map((_, el) => $(el).text())
|
||||
.get()
|
||||
.join(',');
|
||||
|
||||
novel.summary = $(
|
||||
'div.novel-right > div > div:nth-child(1) > div.novel-detail-body',
|
||||
).text();
|
||||
|
||||
novel.chapters = $('ul.chapter-chs > li > a')
|
||||
.map((_, el) => {
|
||||
const chapterUrl = $(el).attr('href');
|
||||
const chapterName = $(el).text();
|
||||
|
||||
return {
|
||||
name: chapterName,
|
||||
releaseTime: '',
|
||||
url: chapterUrl,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function popularNovels (page) {
|
||||
return { novels: [] }; /** TO DO */
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const result = await fetchApi(chapterUrl).then(res => res.text());
|
||||
let loadedCheerio = cheerio.load(result);
|
||||
|
||||
const chapterText = loadedCheerio('#contentall').html() || '';
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
lang: languages.English,
|
||||
icon: 'src/coverNotAvailable.jpg',
|
||||
version: '1.0.0',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,171 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const pluginId = 'ANF.com';
|
||||
const sourceName = 'AllNovelFull';
|
||||
const baseUrl = 'https://allnovelfull.com';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const url = `${baseUrl}/most-popular?page=${page}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
console.log(result.ok);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novels = [];
|
||||
loadedCheerio('.col-truyen-main .list-truyen .row').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h3.truyen-title > a').text();
|
||||
const novelCover =
|
||||
baseUrl + loadedCheerio(this).find('img.cover').attr('src');
|
||||
const novelUrl =
|
||||
baseUrl + loadedCheerio(this).find('h3.truyen-title > a').attr('href');
|
||||
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
};
|
||||
console.log(novel);
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('div.book > img').attr('alt');
|
||||
|
||||
novel.cover = baseUrl + loadedCheerio('div.book > img').attr('src');
|
||||
|
||||
novel.summary = loadedCheerio('div.desc-text').text().trim();
|
||||
|
||||
novel.author = loadedCheerio('div.info > div > h3')
|
||||
.filter(function () {
|
||||
return loadedCheerio(this).text().trim() === 'Author:';
|
||||
})
|
||||
.siblings()
|
||||
.text();
|
||||
|
||||
novel.genres = loadedCheerio('div.info > div')
|
||||
.filter(function () {
|
||||
return loadedCheerio(this).find('h3').text().trim() === 'Genre:';
|
||||
})
|
||||
.text()
|
||||
.replace('Genre:', '');
|
||||
|
||||
novel.status = loadedCheerio('div.info > div > h3')
|
||||
.filter(function () {
|
||||
return loadedCheerio(this).text().trim() === 'Status:';
|
||||
})
|
||||
.next()
|
||||
.text();
|
||||
|
||||
const novelId = loadedCheerio('#rating').attr('data-novel-id');
|
||||
|
||||
async function getChapters (id) {
|
||||
const chapterListUrl = baseUrl + '/ajax/chapter-option?novelId=' + id;
|
||||
|
||||
const data = await fetchApi(chapterListUrl);
|
||||
const chapters = await data.text();
|
||||
|
||||
loadedCheerio = cheerio.load(chapters);
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('select > option').each(function () {
|
||||
let chapterName = loadedCheerio(this).text();
|
||||
let releaseDate = null;
|
||||
let chapterUrl = loadedCheerio(this)
|
||||
.attr('value')
|
||||
?.replace(`/${novelUrl}`, '');
|
||||
|
||||
if (chapterUrl) {
|
||||
novelChapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return novelChapters;
|
||||
};
|
||||
|
||||
if (novelId) {
|
||||
novel.chapters = await getChapters(novelId);
|
||||
}
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = baseUrl + chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const chapterText = loadedCheerio('#chapter-content').html() || '';
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm){
|
||||
const url = `${baseUrl}/search?keyword=${searchTerm}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('div.col-truyen-main > div.list-truyen > .row').each(
|
||||
function () {
|
||||
const novelUrl =
|
||||
baseUrl + loadedCheerio(this).find('h3.truyen-title > a').attr('href');
|
||||
|
||||
const novelName = loadedCheerio(this).find('h3.truyen-title > a').text();
|
||||
const novelCover = baseUrl + loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
if (novelUrl) {
|
||||
novels.push({
|
||||
url: novelUrl,
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.English,
|
||||
icon: 'src/en/allnovelfull/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,143 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
const Status = require('@libs/novelStatus');
|
||||
|
||||
const pluginId = "BLN.com";
|
||||
const sourceName = 'BestLightNovel';
|
||||
|
||||
const baseUrl = 'https://bestlightnovel.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const url =
|
||||
baseUrl + 'novel_list?type=topview&category=all&state=all&page=1' + page;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.update_item.list_category').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h3 > a').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
|
||||
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
url,
|
||||
name: '',
|
||||
cover: '',
|
||||
author: '',
|
||||
status: Status.Unknown,
|
||||
genres: '',
|
||||
summary: '',
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.truyen_info_right h1').text().trim();
|
||||
novel.cover = loadedCheerio('.info_image img').attr('src');
|
||||
novel.summary = loadedCheerio('#noidungm').text()?.trim();
|
||||
novel.author = loadedCheerio(
|
||||
'#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(2) > a',
|
||||
)
|
||||
.text()
|
||||
?.trim();
|
||||
|
||||
let status = loadedCheerio(
|
||||
'#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(4) > a',
|
||||
)
|
||||
.text()
|
||||
?.trim();
|
||||
|
||||
novel.status =
|
||||
status === 'ONGOING'
|
||||
? Status.Ongoing
|
||||
: status === 'COMPLETED'
|
||||
? Status.Completed
|
||||
: Status.Unknown;
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('.chapter-list div.row').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find('span:nth-child(2)')
|
||||
.text()
|
||||
.trim();
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
novelChapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters.reverse();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter ( chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
const chapterText = loadedCheerio('#vung_doc').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}search_novels/${searchTerm}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.update_item.list_category').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h3 > a').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
|
||||
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.English,
|
||||
icon: 'src/en/bestlightnovel/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,149 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
const pluginId = 'comrademao';
|
||||
|
||||
const sourceName = 'Comrade Mao';
|
||||
|
||||
const baseUrl = 'https://comrademao.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'page/' + page + '/?post_type=novel';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.listupd')
|
||||
.find('div.bs')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).find('.tt').text().trim();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = { url };
|
||||
|
||||
novel.name = loadedCheerio('.entry-title').text().trim();
|
||||
|
||||
novel.cover = loadedCheerio('div.thumbook > div > img').attr('src');
|
||||
|
||||
novel.summary = loadedCheerio('div.infox > div:nth-child(6) > span > p')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.genres = loadedCheerio('div.infox > div:nth-child(4) > span')
|
||||
.text()
|
||||
.replace(/\s/g, '');
|
||||
|
||||
novel.status = loadedCheerio('div.infox > div:nth-child(3) > span')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.author = loadedCheerio('div.infox > div:nth-child(2) > span')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('#chapterlist')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
const releaseDate = dayjs(
|
||||
loadedCheerio(this).find('.chapterdate').text(),
|
||||
).format('LL');
|
||||
const chapterName = loadedCheerio(this).find('.chapternum').text();
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
novelChapters.push({
|
||||
name: chapterName,
|
||||
url: chapterUrl,
|
||||
releaseTime: releaseDate,
|
||||
});
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters.reverse();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterText = loadedCheerio('#chaptercontent').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = baseUrl + '?s=' + searchTerm + '&post_type=novel';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.listupd')
|
||||
.find('div.bs')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).find('.tt').text().trim();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.English,
|
||||
icon: 'src/en/comrademao/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,155 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const defaultCoverUri =
|
||||
'https://github.com/LNReader/lnreader-sources/blob/main/icons/src/coverNotAvailable.jpg?raw=true';
|
||||
|
||||
const pluginId = 'DDL.com';
|
||||
|
||||
const sourceName = 'Divine Dao Library';
|
||||
|
||||
const baseUrl = 'https://www.divinedaolibrary.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'novels';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('#main')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).find('a').text();
|
||||
const novelCover = defaultCoverUri;
|
||||
const novelUrl = loadedCheerio(this).find(' a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {url };
|
||||
|
||||
novel.name = loadedCheerio('h1.entry-title').text().trim();
|
||||
|
||||
novel.cover =
|
||||
loadedCheerio('.entry-content').find('img').attr('data-ezsrc') || defaultCoverUri;
|
||||
|
||||
novel.summary = loadedCheerio('#main > article > div > p:nth-child(6)')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.genres = null;
|
||||
|
||||
novel.status = null;
|
||||
|
||||
novel.author = loadedCheerio('#main > article > div > h3:nth-child(2)')
|
||||
.text()
|
||||
.replace(/Author:/g, '')
|
||||
.trim();
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('#main')
|
||||
.find('li > span > a')
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text().trim();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).attr('href');
|
||||
|
||||
novelChapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterName = loadedCheerio('.entry-title').text().trim();
|
||||
|
||||
let chapterText = loadedCheerio('.entry-content').html();
|
||||
|
||||
if (!chapterText) {
|
||||
chapterText = loadedCheerio('.page-header').html();
|
||||
}
|
||||
|
||||
chapterText = `<p><h1>${chapterName}</h1></p>` + chapterText;
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
let url = baseUrl + 'novels';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('#main')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).find('a').text();
|
||||
const novelCover = defaultCoverUri;
|
||||
const novelUrl = loadedCheerio(this).find(' a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
novels = novels.filter(novel =>
|
||||
novel.name.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||
);
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.English,
|
||||
icon: 'src/en/divinedaolibrary/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,162 @@
|
||||
const cheerio = require('cheerio');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
|
||||
const pluginId = 'foxaholic';
|
||||
const baseUrl = 'https://www.foxaholic.com/';
|
||||
|
||||
async function popularNovels (page){
|
||||
const link = `${baseUrl}novel/page/${page}/?m_orderby=rating`;
|
||||
|
||||
const result = await fetchApi(link, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novels = [];
|
||||
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const name = loadedCheerio(this).find('.h5 > a').text();
|
||||
const cover = loadedCheerio(this).find('img').attr('data-src');
|
||||
const url = loadedCheerio(this).find('.h5 > a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name,
|
||||
url,
|
||||
cover,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl){
|
||||
const url = novelUrl;
|
||||
const result = await fetchApi(url, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.post-title > h1')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
|
||||
novel.cover = loadedCheerio('.summary_image > a > img').attr('data-src');
|
||||
|
||||
loadedCheerio('.post-content_item').each(function () {
|
||||
const detailName = loadedCheerio(this)
|
||||
.find('.summary-heading > h5')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
const detail = loadedCheerio(this)
|
||||
.find('.summary-content')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
|
||||
switch (detailName) {
|
||||
case 'Genre':
|
||||
novel.genre = detail.trim().replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author':
|
||||
novel.author = detail.trim();
|
||||
break;
|
||||
case 'Novel':
|
||||
novel.status = detail.trim();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
loadedCheerio('.description-summary > div.summary__content')
|
||||
.find('em')
|
||||
.remove();
|
||||
|
||||
novel.summary = loadedCheerio('.description-summary > div.summary__content')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
let chapter = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const name = loadedCheerio(this)
|
||||
.find('a')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
const releaseTime = loadedCheerio(this).find('span').text().trim();
|
||||
const url = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
chapter.push({ name, releaseTime, url });
|
||||
});
|
||||
|
||||
novel.chapters = chapter.reverse();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl){
|
||||
const result = await fetchApi(chapterUrl, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterText = loadedCheerio('.reading-content').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}?s=${searchTerm}&post_type=wp-manga`;
|
||||
const result = await fetchApi(url, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novels = [];
|
||||
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.h4 > a').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelUrl = loadedCheerio(this).find('.h4 > a').attr('href');
|
||||
|
||||
novels.push({
|
||||
name: novelName,
|
||||
url: novelUrl,
|
||||
cover: novelCover,
|
||||
});
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function fetchImage (url){
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
}
|
||||
return await fetchFile(url, {headers: headers});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: 'Foxaholic',
|
||||
version: '1.0.0',
|
||||
icon: 'src/en/foxaholic/icon.png',
|
||||
site: baseUrl,
|
||||
lang: languages.English,
|
||||
description: 'Digging Pits',
|
||||
protected: false,
|
||||
fetchImage,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
};
|
||||
@@ -0,0 +1,173 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const pluginId = 'FWN.com';
|
||||
const sourceName = "Web NOVEL";
|
||||
const baseUrl = 'https://freewebnovel.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'completed-novel/' + page;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.li-row').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.tit').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = 'https://freewebnovel.com' + loadedCheerio(this)
|
||||
.find('h3 > a')
|
||||
.attr('href')
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {};
|
||||
|
||||
novel.url = url;
|
||||
|
||||
novel.name = loadedCheerio('h1.tit').text();
|
||||
|
||||
novel.cover = loadedCheerio('.pic > img').attr('src');
|
||||
|
||||
novel.genres = loadedCheerio('[title=Genre]')
|
||||
.next()
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '');
|
||||
|
||||
novel.author = loadedCheerio('[title=Author]')
|
||||
.next()
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '');
|
||||
|
||||
novel.artist = null;
|
||||
|
||||
novel.status = loadedCheerio('[title=Status]')
|
||||
.next()
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '');
|
||||
|
||||
let novelSummary = loadedCheerio('.inner').text().trim();
|
||||
novel.summary = novelSummary;
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
let latestChapter;
|
||||
|
||||
loadedCheerio('h3.tit').each(function (res) {
|
||||
if (loadedCheerio(this).find('a').text() === novel.name) {
|
||||
latestChapter = loadedCheerio(this)
|
||||
.next()
|
||||
.find('span.s3')
|
||||
.text()
|
||||
.match(/\d+/);
|
||||
}
|
||||
});
|
||||
|
||||
latestChapter = latestChapter[0];
|
||||
let prefixUrl = novelUrl.replace('.html', '/');
|
||||
|
||||
for (let i = 1; i <= parseInt(latestChapter, 10); i++) {
|
||||
const chapterName = 'Chapter ' + i;
|
||||
|
||||
const releaseDate = null;
|
||||
|
||||
let chapterUrl = 'chapter-' + i;
|
||||
chapterUrl = `${prefixUrl}${chapterUrl}.html`
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterText = loadedCheerio('div.txt').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = baseUrl + 'search/';
|
||||
|
||||
const formData = {
|
||||
searchkey: searchTerm,
|
||||
};
|
||||
|
||||
const result = await fetchApi(url, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.li-row > .li > .con').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.tit').text();
|
||||
const novelCover = loadedCheerio(this)
|
||||
.find('.pic > a > img')
|
||||
.attr('data-cfsrc');
|
||||
|
||||
let novelUrl = "https://freewebnovel.com" + loadedCheerio(this)
|
||||
.find('h3 > a')
|
||||
.attr('href')
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.English,
|
||||
icon: 'src/en/freewebnovel/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,182 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const baseUrl = 'https://www.novelpub.com/';
|
||||
|
||||
const sourceName = 'NovelPub';
|
||||
const pluginId = 'novelpub.com';
|
||||
|
||||
const headers = {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
|
||||
};
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'browse/all/popular/all/' + page;
|
||||
|
||||
const result = await fetchApi(url, { method: 'GET', headers });
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.novel-item.ads').remove();
|
||||
|
||||
loadedCheerio('.novel-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.novel-title').text().trim();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelUrl =
|
||||
baseUrl +
|
||||
loadedCheerio(this).find('.novel-title > a').attr('href').substring(1);
|
||||
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url, { method: 'GET', headers });
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = { url, genres: '' };
|
||||
|
||||
novel.name = loadedCheerio('h1.novel-title').text().trim();
|
||||
|
||||
novel.cover = loadedCheerio('figure.cover > img').attr('data-src');
|
||||
|
||||
loadedCheerio('div.categories > ul > li').each(function () {
|
||||
novel.genres +=
|
||||
loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '') + ',';
|
||||
});
|
||||
|
||||
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('.author > a > span').text();
|
||||
|
||||
novel.summary = loadedCheerio('.summary > .content').text().trim();
|
||||
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
|
||||
let lastPage = 1;
|
||||
|
||||
lastPage = loadedCheerio(
|
||||
'#novel > header > div.header-body.container > div.novel-info > div.header-stats > span:nth-child(1) > strong',
|
||||
)
|
||||
.text()
|
||||
?.trim();
|
||||
|
||||
lastPage = Math.ceil(lastPage / 100);
|
||||
|
||||
const getChapters = async () => {
|
||||
let novelChapters = [];
|
||||
|
||||
for (let i = 1; i <= lastPage; i++) {
|
||||
const chaptersUrl = `${novelUrl}/chapters/page-${i}`;
|
||||
|
||||
const chaptersRequest = await fetchApi(chaptersUrl, { headers });
|
||||
const chaptersHtml = await chaptersRequest.text();
|
||||
|
||||
loadedCheerio = cheerio.load(chaptersHtml);
|
||||
|
||||
loadedCheerio('.chapter-list li').each(function () {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find('.chapter-title')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find('.chapter-update')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
const chapterUrl =
|
||||
baseUrl + loadedCheerio(this).find('a').attr('href').substring(1);
|
||||
|
||||
novelChapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
|
||||
await delay(1000);
|
||||
}
|
||||
|
||||
return novelChapters;
|
||||
};
|
||||
|
||||
novel.chapters = await getChapters();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url, { method: 'GET', headers });
|
||||
|
||||
const body = await result.text();
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const chapterText = loadedCheerio('#chapter-container').html();
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
// They have API to search, pls update it, im quite lazy xD
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}lnwsearchlive?inputContent=${searchTerm}`;
|
||||
|
||||
const result = await fetchApi(url, { method: 'GET', headers });
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
// let results = JSON.parse(loadedCheerio('body').text());
|
||||
|
||||
// loadedCheerio = cheerio.load(results.resultview);
|
||||
|
||||
// loadedCheerio('.novel-item').each(function () {
|
||||
// const novelName = loadedCheerio(this).find('.novel-title').text().trim();
|
||||
// const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
// const novelUrl =
|
||||
// baseUrl + loadedCheerio(this).find('a').attr('href').substring(1);
|
||||
|
||||
// const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
// novels.push(novel);
|
||||
// });
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.English,
|
||||
icon: 'src/en/novelpub/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,126 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const pluginId = 'chireads.com';
|
||||
const sourceName = 'Chireads';
|
||||
|
||||
const baseUrl = 'https://chireads.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const url = `${baseUrl}category/translatedtales/page/${page}/`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('#content li').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.news-list-tit h5').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find('.news-list-tit h5 a')
|
||||
.attr('href');
|
||||
|
||||
const novel = { name: novelName, cover: novelCover, url :novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
url,
|
||||
name: '',
|
||||
cover: '',
|
||||
author: '',
|
||||
artist: '',
|
||||
status: '',
|
||||
genres: '',
|
||||
summary: '',
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.inform-title').text().trim();
|
||||
|
||||
novel.cover = loadedCheerio('.inform-product img').attr('src');
|
||||
|
||||
novel.summary = loadedCheerio('.inform-inform-txt').text().trim();
|
||||
|
||||
let chapters = [];
|
||||
|
||||
loadedCheerio('.chapitre-table a').each(function () {
|
||||
const chapterName = loadedCheerio(this).text().trim();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).attr('href');
|
||||
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
|
||||
novel.chapters = chapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
const chapterText = loadedCheerio('#content').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}search?x=0&y=0&name=${searchTerm}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('#content li').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.news-list-tit h5').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find('.news-list-tit h5 a')
|
||||
.attr('href');
|
||||
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/fr/chireads/icon.png',
|
||||
lang: languages.French,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,147 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const sourceName = 'NovelDeGlace';
|
||||
const pluginId = 'NDG.com';
|
||||
|
||||
const baseUrl = 'https://noveldeglace.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'roman';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('article').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h2').text().trim();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find('h2 > a')
|
||||
.attr('href')
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {url};
|
||||
|
||||
novel.name = loadedCheerio(
|
||||
'div.entry-content > div > strong',
|
||||
)[0].nextSibling.nodeValue.trim();
|
||||
|
||||
novel.cover = loadedCheerio('.su-row > div > div > img').attr('src');
|
||||
|
||||
novel.summary = loadedCheerio('div[data-title=Synopsis]').text();
|
||||
|
||||
const author = loadedCheerio(
|
||||
'div.romans > div.project-large > div.su-row > div.su-column.su-column-size-3-4 > div > div:nth-child(3) > strong',
|
||||
)[0];
|
||||
|
||||
novel.author = author ? author.nextSibling.nodeValue.trim() : null;
|
||||
|
||||
novel.genres = loadedCheerio('.genre')
|
||||
.text()
|
||||
.replace('Genre : ', '')
|
||||
.replace(/, /g, ',');
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('.chpt').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter ( chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterText = loadedCheerio('.chapter-content').html();
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
let url = baseUrl + 'roman';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('article').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h2').text().trim();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find('h2 > a')
|
||||
.attr('href')
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
novels = novels.filter(novel =>
|
||||
novel.name.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||
);
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/fr/noveldeglace/icon.png',
|
||||
lang: languages.French,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,142 @@
|
||||
const cheerio = require('cheerio')
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const pluginId = "IDWN.id";
|
||||
const sourceName = 'IndoWebNovel';
|
||||
|
||||
const baseUrl = 'https://indowebnovel.id/id/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const url = `${baseUrl}daftar-novel/`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.novellist-blc li').each(function () {
|
||||
const novelName = loadedCheerio(this).find('a').text();
|
||||
const novelCover = null;
|
||||
const novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
url,
|
||||
name: '',
|
||||
cover: '',
|
||||
author: '',
|
||||
status: '',
|
||||
genres: '',
|
||||
summary: '',
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.series-title').text().trim();
|
||||
|
||||
novel.cover = loadedCheerio('.series-thumb > img').attr('src');
|
||||
|
||||
novel.summary = loadedCheerio('.series-synops').text().trim();
|
||||
|
||||
novel.status = loadedCheerio('.status').text().trim();
|
||||
|
||||
novel.genres = [];
|
||||
|
||||
loadedCheerio('.series-genres').each(function () {
|
||||
novel.genres.push(loadedCheerio(this).find('a').text().trim());
|
||||
});
|
||||
|
||||
novel.genres = novel.genres.toString();
|
||||
|
||||
let chapters = [];
|
||||
|
||||
loadedCheerio('.series-chapterlist li').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
|
||||
novel.chapters = chapters.reverse();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter ( chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
const chapterText = loadedCheerio('.reader').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}daftar-novel/`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.novellist-blc li').each(function () {
|
||||
const novelName = loadedCheerio(this).find('a').text();
|
||||
const novelCover = null;
|
||||
const novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
if (novelName.toLowerCase().includes(searchTerm.toLowerCase())) {
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
icon: 'src/id/indowebnovel/icon.png',
|
||||
version: '1.0.0',
|
||||
lang: languages.Indonesian,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,162 @@
|
||||
const cheerio = require('cheerio')
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
const Status = require('@libs/novelStatus');
|
||||
|
||||
const pluginId = "novelringan.com";
|
||||
|
||||
const sourceName = 'NovelRingan';
|
||||
|
||||
const baseUrl = 'https://novelringan.com/';
|
||||
const coverUriPrefix = 'https://i0.wp.com/novelringan.com/wp-content/uploads/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const url = `${baseUrl}/top-novel/page/${page}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novels = [];
|
||||
|
||||
loadedCheerio('article.post').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.entry-title').text()?.trim();
|
||||
const novelCover =
|
||||
coverUriPrefix + loadedCheerio(this).find('img').attr('data-sxrx');
|
||||
const novelUrl = loadedCheerio(this).find('h2 > a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels ;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
url,
|
||||
name: '',
|
||||
cover: '',
|
||||
genres: '',
|
||||
author: '',
|
||||
status: Status.Unknown,
|
||||
artist: '',
|
||||
summary: '',
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.entry-title').text()?.trim();
|
||||
novel.cover =
|
||||
coverUriPrefix + loadedCheerio('img.ts-post-image').attr('data-sxrx');
|
||||
novel.summary = loadedCheerio(
|
||||
'body > div.site-container > div > main > article > div > div.maininfo > span > p',
|
||||
).text();
|
||||
|
||||
let genreSelector = loadedCheerio(
|
||||
'body > div.site-container > div > main > article > div > div.maininfo > span > ul > li:nth-child(4)',
|
||||
).text();
|
||||
|
||||
novel.genres = genreSelector.includes('Genre')
|
||||
? genreSelector.replace('Genre:', '').trim()
|
||||
: '';
|
||||
|
||||
let statusSelector = loadedCheerio(
|
||||
'body > div.site-container > div > main > article > div > div.maininfo > span > ul > li:nth-child(3)',
|
||||
).text();
|
||||
|
||||
novel.status = statusSelector.includes('Status')
|
||||
? statusSelector.replace('Status:', '').trim()
|
||||
: Status.Unknown;
|
||||
|
||||
let chapters = [];
|
||||
|
||||
loadedCheerio('.bxcl > ul > li').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
chapters.push(chapter);
|
||||
});
|
||||
|
||||
novel.chapters = chapters.reverse();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter ( chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
loadedCheerio('.entry-content div[style="display:none"]').remove();
|
||||
|
||||
const chapterText = loadedCheerio('.entry-content').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = baseUrl + '?s=' + searchTerm;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('article.post').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.entry-title').text();
|
||||
const novelCover =
|
||||
coverUriPrefix + loadedCheerio(this).find('img').attr('data-sxrx');
|
||||
|
||||
const novelUrl = loadedCheerio(this).find('h2 > a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
icon: 'src/id/novelringan/icon.png',
|
||||
version: '1.0.0',
|
||||
lang: languages.Indonesian,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,151 @@
|
||||
const cheerio = require('cheerio')
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const pluginId = "sakura.id";
|
||||
const sourceName = 'SakuraNovel';
|
||||
|
||||
const baseUrl = 'https://sakuranovel.id/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const url = `${baseUrl}advanced-search/page/${page}/?title&author&yearx&status&type&order=rating&country%5B0%5D=china&country%5B1%5D=jepang&country%5B2%5D=unknown`;
|
||||
|
||||
const result = await fetchApi(url, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.flexbox2-item').each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find('.flexbox2-title span')
|
||||
.first()
|
||||
.text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find('.flexbox2-content > a')
|
||||
.attr('href');
|
||||
|
||||
const novel = {name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const result = await fetchApi(novelUrl, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
name: sourceName,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.series-title h2').text().trim();
|
||||
|
||||
novel.cover = loadedCheerio('.series-thumb img').attr('src');
|
||||
|
||||
loadedCheerio('.series-infolist > li').each(function () {
|
||||
const detailName = loadedCheerio(this).find('b').text().trim();
|
||||
const detail = loadedCheerio(this).find('b').next().text().trim();
|
||||
|
||||
switch (detailName) {
|
||||
case 'Author':
|
||||
novel.author = detail;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
novel.status = loadedCheerio('.status').text().trim();
|
||||
|
||||
novel.genres = loadedCheerio('.series-genres')
|
||||
.prop('innerHTML')
|
||||
.replace(/<.*?>(.*?)<.*?>/g, '$1,')
|
||||
.slice(0, -1);
|
||||
|
||||
novel.summary = loadedCheerio('.series-synops').text().trim();
|
||||
|
||||
let chapters = [];
|
||||
|
||||
loadedCheerio('.series-chapterlist li').each(function () {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find('a span')
|
||||
.first()
|
||||
.text()
|
||||
.replace(`${novel.novelName} – `, '')
|
||||
.replace('Bahasa Indonesia', '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find('a span')
|
||||
.first()
|
||||
.next()
|
||||
.text();
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
|
||||
novel.chapters = chapters.reverse();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const result = await fetchApi( chapterUrl, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
const chapterText = loadedCheerio('.reader').html();
|
||||
|
||||
return chapterText
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}?s=${searchTerm}`;
|
||||
const result = await fetchApi(url, {}, pluginId);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.flexbox2-item').each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find('.flexbox2-title span')
|
||||
.first()
|
||||
.text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find('.flexbox2-content > a')
|
||||
.attr('href');
|
||||
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
icon: 'src/id/sakuranovel/icon.png',
|
||||
version: '1.0.0',
|
||||
lang: languages.Indonesian,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,205 @@
|
||||
const cheerio = require('cheerio');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
// const novelStatus = require('@libs/novelStatus');
|
||||
// const isUrlAbsolute = require('@libs/isAbsoluteUrl');
|
||||
// const parseDate = require('@libs/parseDate');
|
||||
|
||||
const pluginId = 'yomou.syosetu';
|
||||
|
||||
const defaultCoverUri =
|
||||
'https://github.com/LNReader/lnreader-sources/blob/main/icons/src/coverNotAvailable.jpg?raw=true';
|
||||
|
||||
const searchUrl = (pagenum, order) => {
|
||||
return `https://yomou.syosetu.com/search.php?order=${order || 'hyoka'}${!isNaN((pagenum = parseInt(pagenum, 10))) // check if pagenum is a number
|
||||
? `&p=${pagenum <= 1 || pagenum > 100 ? '1' : pagenum}` // check if pagenum is between 1 and 100
|
||||
: '' // if isn't don't set ?p
|
||||
}`;
|
||||
};
|
||||
|
||||
const novelCover = defaultCoverUri;
|
||||
|
||||
async function popularNovels(pageNo) {
|
||||
let novels = [];
|
||||
|
||||
async function getNovelsFromPage(pagenumber) {
|
||||
// load page
|
||||
const result = await fetchApi(searchUrl(pagenumber || null));
|
||||
const body = await result.text();
|
||||
// Cheerio it!
|
||||
const cheerioQuery = cheerio.load(body, { decodeEntities: false });
|
||||
let pageNovels = [];
|
||||
// find class=searchkekka_box
|
||||
cheerioQuery('.searchkekka_box').each(function (i, e) {
|
||||
// get div with link and name
|
||||
const novelDIV = cheerioQuery(this).find('.novel_h');
|
||||
// get link element
|
||||
const novelA = novelDIV.children()[0];
|
||||
// add new novel to array
|
||||
pageNovels.push({
|
||||
name: novelDIV.text(), // get the name
|
||||
url: novelA.attribs.href, // get last part of the link
|
||||
cover: novelCover, // TODO: IDK what to do about covers... On Syo they don't have them
|
||||
});
|
||||
});
|
||||
// return all novels from this page
|
||||
return pageNovels;
|
||||
};
|
||||
|
||||
novels = await getNovelsFromPage(pageNo);
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters(novelUrl) {
|
||||
let chapters = [];
|
||||
const result = await fetchApi(novelUrl);
|
||||
const body = await result.text();
|
||||
const cheerioQuery = cheerio.load(body, { decodeEntities: false });
|
||||
|
||||
// create novel object
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
name: cheerioQuery('.novel_title').text(),
|
||||
author: cheerioQuery('.novel_writername').text().replace('作者:', ''),
|
||||
cover: novelCover,
|
||||
};
|
||||
|
||||
// Get all the chapters
|
||||
const cqGetChapters = cheerioQuery('.novel_sublist2');
|
||||
if (cqGetChapters.length !== 0) {
|
||||
// has more than 1 chapter
|
||||
novel.summary = cheerioQuery('#novel_ex')
|
||||
.text()
|
||||
.replace(/<\s*br.*?>/g, '\n');
|
||||
cqGetChapters.each(function (i, e) {
|
||||
const chapterA = cheerioQuery(this).find('a');
|
||||
const [chapterName, releaseDate, chapterUrl] = [
|
||||
// set the variables
|
||||
chapterA.text(),
|
||||
cheerioQuery(this)
|
||||
.find('dt') // get title
|
||||
.text() // get text
|
||||
.replace(/(.)/g, '') // remove "(edited)" mark
|
||||
.trim(), // trim spaces
|
||||
'https://ncode.syosetu.com' + chapterA.attr('href'),
|
||||
];
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
} else {
|
||||
/**
|
||||
* Because there are oneshots on the site, they have to be treated with special care
|
||||
* that's what pisses me off in Shosetsu app. They have this extension,
|
||||
* but every oneshot is set as "there are no chapters" and all contents are thrown into the description!!
|
||||
*/
|
||||
// get summary for oneshot chapter
|
||||
|
||||
const nameResult = await fetchApi(searchUrl() + `&word=${novel.name}`);
|
||||
const nameBody = await nameResult.text();
|
||||
const summaryQuery = cheerio.load(nameBody, { decodeEntities: false });
|
||||
const foundText = summaryQuery('.searchkekka_box')
|
||||
.first()
|
||||
.find('.ex')
|
||||
.text()
|
||||
.replace(/\s{2,}/g, '\n');
|
||||
novel.summary = foundText;
|
||||
|
||||
// add single chapter
|
||||
chapters.push({
|
||||
name: 'Oneshot',
|
||||
releaseTime: cheerioQuery('head')
|
||||
.find("meta[name='WWWC']")
|
||||
.attr('content'), // get date from metadata
|
||||
url: novelUrl, // set chapterUrl to oneshot so that chapterScraper knows it's a one-shot
|
||||
});
|
||||
}
|
||||
novel.chapters = chapters;
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter(chapterUrl) {
|
||||
const result = await fetchApi(chapterUrl);
|
||||
const body = await result.text();
|
||||
|
||||
// create cheerioQuery
|
||||
const cheerioQuery = cheerio.load(body, {
|
||||
decodeEntities: false,
|
||||
});
|
||||
|
||||
let chapterText = cheerioQuery('#novel_honbun') // get chapter text
|
||||
.html();
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
|
||||
async function searchNovels(searchTerm, pageNo) {
|
||||
let novels = [];
|
||||
|
||||
// returns list of novels from given page
|
||||
async function getNovelsFromPage (pagenumber) {
|
||||
// load page
|
||||
const result = await fetchApi(
|
||||
searchUrl(pagenumber || null, null) + `&word=${searchTerm}`
|
||||
);
|
||||
const body = await result.text();
|
||||
// Cheerio it!
|
||||
const cheerioQuery = cheerio.load(body, { decodeEntities: false });
|
||||
|
||||
let pageNovels = [];
|
||||
// find class=searchkekka_box
|
||||
cheerioQuery('.searchkekka_box').each(function (i, e) {
|
||||
// get div with link and name
|
||||
const novelDIV = cheerioQuery(this).find('.novel_h');
|
||||
// get link element
|
||||
const novelA = novelDIV.children()[0];
|
||||
// add new novel to array
|
||||
pageNovels.push({
|
||||
name: novelDIV.text(), // get the name
|
||||
url: novelA.attribs.href, // get last part of the link
|
||||
cover: novelCover, // TODO: IDK what to do about covers... On Syo they don't have them
|
||||
});
|
||||
});
|
||||
// return all novels from this page
|
||||
return pageNovels;
|
||||
};
|
||||
|
||||
// counter of loaded pages
|
||||
// let pagesLoaded = 0;
|
||||
// do {
|
||||
// // always load first one
|
||||
// novels.push(...(await getNovelsFromPage(pagesLoaded + 1)));
|
||||
// pagesLoaded++;
|
||||
// } while (pagesLoaded < maxPageLoad && isNext); // check if we should load more
|
||||
|
||||
novels = await getNovelsFromPage(1);
|
||||
|
||||
/** Use
|
||||
* novels.push(...(await getNovelsFromPage(pageNumber)))
|
||||
* if you want to load more
|
||||
*/
|
||||
|
||||
// respond with novels!
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function fetchImage(url) {
|
||||
|
||||
return await fetchFile(url);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: 'Syosetu',
|
||||
icon: 'src/jp/syosetu/icon.png',
|
||||
version: '1.0.0',
|
||||
site: 'https://yomou.syosetu.com/',
|
||||
lang: languages.Japanese,
|
||||
description: '小説を読もう!は「小説家になろう」に投稿された',
|
||||
protected: false,
|
||||
fetchImage,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const pluginId = 'agit.xyz';
|
||||
const sourceName = 'Agitoon';
|
||||
const baseUrl = 'https://agit501.xyz/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const list_limit = 20 * (page - 1);
|
||||
const day = new Date().getDay();
|
||||
|
||||
const res = await fetchApi(baseUrl + 'novel/index.update.php', {
|
||||
headers: {
|
||||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
},
|
||||
body: `mode=get_data_novel_list_p&novel_menu=3&np_day=${day}&np_rank=1&np_distributor=0&np_genre=00&np_order=1&np_genre_ex_1=00&np_genre_ex_2=00&list_limit=${list_limit}&is_query_first=true`,
|
||||
method: 'POST',
|
||||
});
|
||||
|
||||
const resJson = await res.json();
|
||||
|
||||
const novels = resJson.list.map(novel => {
|
||||
return {
|
||||
url: baseUrl + 'novel/list/' + novel.wr_id,
|
||||
name: novel.wr_subject,
|
||||
cover: baseUrl + novel.np_dir + '/thumbnail/' + novel.np_thumbnail,
|
||||
};
|
||||
});
|
||||
|
||||
return novels ;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const novelId = novelUrl.split('/').reverse()[0];
|
||||
|
||||
// cheerio
|
||||
const result = await fetchApi(novelUrl);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body, { decodeEntities: false });
|
||||
const name = loadedCheerio('h5.pt-2').text();
|
||||
const summary = loadedCheerio('.pt-1.mt-1.pb-1.mb-1').text();
|
||||
const author = loadedCheerio('.post-item-list-cate-v')
|
||||
.first()
|
||||
.text()
|
||||
.split(' : ')
|
||||
.reverse()[0];
|
||||
const cover =
|
||||
baseUrl.slice(0, baseUrl.length - 1) +
|
||||
loadedCheerio('div.col-5.pr-0.pl-0 img').attr('src');
|
||||
const genresTag = loadedCheerio('.col-7 > .post-item-list-cate > span');
|
||||
let genres = '';
|
||||
|
||||
genresTag.each((_, element) => {
|
||||
genres += loadedCheerio(element).text();
|
||||
genres += ', ';
|
||||
});
|
||||
genres = genres.slice(0, genres.length - 2);
|
||||
|
||||
// normal REST HTTP requests
|
||||
let chapters = [];
|
||||
|
||||
const res = await fetchApi(baseUrl + 'novel/list.update.php', {
|
||||
headers: {
|
||||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
},
|
||||
body: `mode=get_data_novel_list_c&wr_id_p=${novelId}&page_no=1&cnt_list=10000&order_type=Asc`,
|
||||
method: 'POST',
|
||||
});
|
||||
|
||||
const resJson = await res.json();
|
||||
|
||||
chapters = resJson.list.map(chapter => {
|
||||
return {
|
||||
name: chapter.wr_subject,
|
||||
url: baseUrl + `novel/view/${chapter.wr_id}/2`,
|
||||
releaseTime: chapter.wr_datetime,
|
||||
};
|
||||
});
|
||||
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name,
|
||||
cover,
|
||||
summary,
|
||||
author,
|
||||
status: '',
|
||||
genres: genres,
|
||||
chapters,
|
||||
};
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const result = await fetchApi(chapterUrl);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const contentTag = loadedCheerio('#id_wr_content > p');
|
||||
|
||||
let content = '';
|
||||
contentTag.each((_, element) => {
|
||||
content += loadedCheerio(element).text();
|
||||
content += '<br />';
|
||||
});
|
||||
|
||||
// gets rid of the popup thingy
|
||||
content = content.replace(
|
||||
'팝업메뉴는 빈공간을 더치하거나 스크룰시 사라집니다',
|
||||
'',
|
||||
);
|
||||
|
||||
return content;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const rawResults = await fetchApi('https://agit501.xyz/novel/search.php', {
|
||||
headers: {
|
||||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
},
|
||||
body: `mode=get_data_novel_list_p_sch&search_novel=${searchTerm}&list_limit=0`,
|
||||
method: 'POST',
|
||||
});
|
||||
|
||||
const results = await rawResults.json();
|
||||
if (results.list_count === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const novels = results.list.map(result => {
|
||||
return {
|
||||
url: baseUrl + 'novel/list/' + result.wr_id,
|
||||
name: result.wr_subject,
|
||||
cover: baseUrl + result.np_dir + '/thumbnail/' + result.np_thumbnail,
|
||||
};
|
||||
});
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/kr/agitoon/agit.png',
|
||||
lang: languages.Korean,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,287 @@
|
||||
{
|
||||
"中文, 汉语, 漢語": [],
|
||||
"English": [
|
||||
{
|
||||
"id": "LNR.org",
|
||||
"name": "LightNovelReader",
|
||||
"site": "https://lightnovelreader.org",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"description": "This is description for plugin",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/LightNovelReader.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/lightnovelreader/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "NF.me",
|
||||
"name": "NovelFull.me",
|
||||
"site": "https://novelfull.me/",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/NovelFullMe.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/novelfullme/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "NO.net",
|
||||
"name": "novelsOnline",
|
||||
"site": "https://novelsonline.net",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/NovelOnline.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/coverNotAvailable.jpg"
|
||||
},
|
||||
{
|
||||
"id": "ANF.com",
|
||||
"name": "AllNovelFull",
|
||||
"site": "https://allnovelfull.com",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/allnovelfull.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/allnovelfull/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "BLN.com",
|
||||
"name": "BestLightNovel",
|
||||
"site": "https://bestlightnovel.com/",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/bestlightnovel.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/bestlightnovel/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "comrademao",
|
||||
"name": "Comrade Mao",
|
||||
"site": "https://comrademao.com/",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/comrademao.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/comrademao/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "DDL.com",
|
||||
"name": "Divine Dao Library",
|
||||
"site": "https://www.divinedaolibrary.com/",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/divinedaolibrary.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/divinedaolibrary/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "foxaholic",
|
||||
"name": "Foxaholic",
|
||||
"site": "https://www.foxaholic.com/",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"description": "Digging Pits",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/foxaholic.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/foxaholic/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "FWN.com",
|
||||
"name": "Web NOVEL",
|
||||
"site": "https://freewebnovel.com/",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/freewebnovel.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/freewebnovel/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "novelpub.com",
|
||||
"name": "NovelPub",
|
||||
"site": "https://www.novelpub.com/",
|
||||
"lang": "English",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/english/novelpub.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/en/novelpub/icon.png"
|
||||
}
|
||||
],
|
||||
"français, française": [
|
||||
{
|
||||
"id": "chireads.com",
|
||||
"name": "Chireads",
|
||||
"site": "https://chireads.com/",
|
||||
"lang": "français, française",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/french/chireads.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/fr/chireads/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "NDG.com",
|
||||
"name": "NovelDeGlace",
|
||||
"site": "https://noveldeglace.com/",
|
||||
"lang": "français, française",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/french/noveldeglace.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/fr/noveldeglace/icon.png"
|
||||
}
|
||||
],
|
||||
"Bahasa Indonesia": [
|
||||
{
|
||||
"id": "IDWN.id",
|
||||
"name": "IndoWebNovel",
|
||||
"site": "https://indowebnovel.id/id/",
|
||||
"lang": "Bahasa Indonesia",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/indonesian/indowebnovel.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/id/indowebnovel/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "novelringan.com",
|
||||
"name": "NovelRingan",
|
||||
"site": "https://novelringan.com/",
|
||||
"lang": "Bahasa Indonesia",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/indonesian/novelringan.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/id/novelringan/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "sakura.id",
|
||||
"name": "SakuraNovel",
|
||||
"site": "https://sakuranovel.id/",
|
||||
"lang": "Bahasa Indonesia",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/indonesian/sakuranovel.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/id/sakuranovel/icon.png"
|
||||
}
|
||||
],
|
||||
"日本語": [
|
||||
{
|
||||
"id": "yomou.syosetu",
|
||||
"name": "Syosetu",
|
||||
"site": "https://yomou.syosetu.com/",
|
||||
"lang": "日本語",
|
||||
"version": "1.0.0",
|
||||
"description": "小説を読もう!は「小説家になろう」に投稿された",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/japanese/Syosetu.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/jp/syosetu/icon.png"
|
||||
}
|
||||
],
|
||||
"한국어, 조선말": [
|
||||
{
|
||||
"id": "agit.xyz",
|
||||
"name": "Agitoon",
|
||||
"site": "https://agit501.xyz/",
|
||||
"lang": "한국어, 조선말",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/korean/Agitoon.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/kr/agitoon/agit.png"
|
||||
}
|
||||
],
|
||||
"Português": [],
|
||||
"русский язык": [
|
||||
{
|
||||
"id": "jaomix.ru",
|
||||
"name": "Jaomix",
|
||||
"site": "https://jaomix.ru",
|
||||
"lang": "русский язык",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/russian/jaomix.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/ru/jaomix/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "RNBH.org",
|
||||
"name": "RanobeHub",
|
||||
"site": "https://ranobehub.org/",
|
||||
"lang": "русский язык",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/russian/ranobehub.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/ru/ranobehub/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "RNRF",
|
||||
"name": "РанобэРФ",
|
||||
"site": "https://ранобэ.рф",
|
||||
"lang": "русский язык",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/russian/ranoberf.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/ru/ranoberf/icon.png"
|
||||
}
|
||||
],
|
||||
"español, castellano": [
|
||||
{
|
||||
"id": "HasuTL",
|
||||
"name": "Hasu Translations",
|
||||
"site": "https://hasutl.wordpress.com/",
|
||||
"lang": "español, castellano",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/spanish/hasutl.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/es/hasutl/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "ligera.com",
|
||||
"name": "Novelas Ligera",
|
||||
"site": "https://novelasligera.com/",
|
||||
"lang": "español, castellano",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/spanish/novelasligera.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/es/novelasligera/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "awuxia.com",
|
||||
"name": "ReinoWuxia",
|
||||
"site": "http://www.reinowuxia.com/",
|
||||
"lang": "español, castellano",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/spanish/novelawuxia.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/es/novelawuxia/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "oasisTL.wp",
|
||||
"name": "Oasis Translations",
|
||||
"site": "https://oasistranslations.wordpress.com/",
|
||||
"lang": "español, castellano",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/spanish/oasistranslations.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/es/oasistranslations/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "skynovels.net",
|
||||
"name": "SkyNovels",
|
||||
"site": "https://www.skynovels.net/",
|
||||
"lang": "español, castellano",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/spanish/skynovels.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/es/skynovels/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "TNL.com",
|
||||
"name": "TuNovelaLigera",
|
||||
"site": "https://tunovelaligera.com/",
|
||||
"lang": "español, castellano",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/spanish/tunovelaligera.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/es/tunovelaligera/icon.png"
|
||||
},
|
||||
{
|
||||
"id": "yuukitls.com",
|
||||
"name": "Yuuki Tls",
|
||||
"site": "https://yuukitls.com/",
|
||||
"lang": "español, castellano",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/spanish/yukitls.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/es/yuukitls/icon.png"
|
||||
}
|
||||
],
|
||||
"Türkçe": [
|
||||
{
|
||||
"id": "epiknovel.com",
|
||||
"name": "EpikNovel",
|
||||
"site": "https://www.epiknovel.com/",
|
||||
"lang": "Türkçe",
|
||||
"version": "1.0.0",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/turkish/epiknovel.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/tr/epiknovel/icon.png"
|
||||
}
|
||||
],
|
||||
"Tiếng Việt": [
|
||||
{
|
||||
"id": "ln.hako",
|
||||
"name": "Hako",
|
||||
"site": "https://ln.hako.vn",
|
||||
"lang": "Tiếng Việt",
|
||||
"version": "1.0.0",
|
||||
"description": "Cổng LightNovel",
|
||||
"url": "https://raw.githubusercontent.com/nyagami/plugins/main/plugins/vietnamese/LNHako.js",
|
||||
"iconUrl": "https://raw.githubusercontent.com/nyagami/plugins/main/icons/src/vi/hakolightnovel/icon.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,217 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
const Status = require('@libs/novelStatus');
|
||||
const FilterInputs = require('@libs/filterInputs');
|
||||
|
||||
const pluginId = 'jaomix.ru';
|
||||
const sourceName = 'Jaomix';
|
||||
|
||||
const baseUrl = 'https://jaomix.ru';
|
||||
|
||||
async function popularNovels (page, { showLatestNovels, filters }) {
|
||||
let url = baseUrl + '/?searchrn&sortby=';
|
||||
url += filters?.sort ? filters?.sort : (showLatestNovels ? 'upd' : 'count');
|
||||
|
||||
if (filters?.type?.length) {
|
||||
url += filters.type.map(i => `&lang[]=${i}`).join('');
|
||||
}
|
||||
|
||||
if (filters?.genres?.length) {
|
||||
url += filters.genres.map(i => `&genre[]=${i}`).join('');
|
||||
}
|
||||
url += `&page=${page}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
let body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('div[class="block-home"] > div[class="one"]').each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a')
|
||||
.attr('title');
|
||||
const novelCover = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a > img')
|
||||
.attr('src')
|
||||
.replace('-150x150', '');
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a')
|
||||
.attr('href');
|
||||
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const result = await fetchApi(novelUrl);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('div[class="desc-book"] > h1').text().trim();
|
||||
novel.cover = loadedCheerio('div[class="img-book"] > img').attr('src');
|
||||
novel.summary = loadedCheerio('div[id="desc-tab"]').text().trim();
|
||||
|
||||
loadedCheerio('#info-book > p').each(function () {
|
||||
let text = loadedCheerio(this).text().replace(/,/g, '').split(' ');
|
||||
if (text[0] === 'Автор:') {
|
||||
novel.author = text.splice(1).join(' ');
|
||||
} else if (text[0] === 'Жанры:') {
|
||||
novel.genres = text.splice(1).join(',');
|
||||
} else if (text[0] === 'Статус:') {
|
||||
novel.status = text.includes('продолжается')
|
||||
? Status.Ongoing
|
||||
: Status.Completed;
|
||||
}
|
||||
});
|
||||
|
||||
const chapters = [];
|
||||
|
||||
loadedCheerio('.download-chapter div.title').each(function () {
|
||||
chapters.push({
|
||||
name: loadedCheerio(this).find('a').attr('title'),
|
||||
releaseTime: loadedCheerio(this).find('time').text(),
|
||||
url: loadedCheerio(this).find('a').attr('href'),
|
||||
});
|
||||
});
|
||||
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const result = await fetchApi(chapterUrl);
|
||||
const body = await result.text();
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
loadedCheerio('div[class="adblock-service"]').remove();
|
||||
const chapterText = loadedCheerio('div[class="entry-content"]').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}/?searchrn=${searchTerm}&but=Поиск по названию&sortby=upd`;
|
||||
const result = await fetchApi(url);
|
||||
let body = await result.text();
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
loadedCheerio('div[class="block-home"] > div[class="one"]').each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a')
|
||||
.attr('title');
|
||||
const novelCover = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a > img')
|
||||
.attr('src')
|
||||
.replace('-150x150', '');
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a')
|
||||
.attr('href');
|
||||
|
||||
const novel = {name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
const filters = [
|
||||
{
|
||||
key: 'sort',
|
||||
label: 'Сортировка',
|
||||
values: [
|
||||
{ label: 'Имя', value: 'alphabet' },
|
||||
{ label: 'Просмотры', value: 'count' },
|
||||
{ label: 'Дате добавления', value: 'new' },
|
||||
{ label: 'Дате обновления', value: 'upd' },
|
||||
],
|
||||
inputType: FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: 'type',
|
||||
label: 'Тип',
|
||||
values: [
|
||||
{ label: 'Английский', value: 'Английский' },
|
||||
{ label: 'Китайский', value: 'Китайский' },
|
||||
{ label: 'Корейский', value: 'Корейский' },
|
||||
{ label: 'Японский', value: 'Японский' },
|
||||
],
|
||||
inputType: FilterInputs.Checkbox,
|
||||
},
|
||||
{
|
||||
key: 'genres',
|
||||
label: 'Жанры',
|
||||
values: [
|
||||
{ label: 'Adult', value: 'Adult' },
|
||||
{ label: 'Ecchi', value: 'Ecchi' },
|
||||
{ label: 'Josei', value: 'Josei' },
|
||||
{ label: 'Lolicon', value: 'Lolicon' },
|
||||
{ label: 'Mature', value: 'Mature' },
|
||||
{ label: 'Sci-fi', value: 'Sci-fi' },
|
||||
{ label: 'Shoujo', value: 'Shoujo' },
|
||||
{ label: 'Wuxia', value: 'Wuxia' },
|
||||
{ label: 'Xianxia', value: 'Xianxia' },
|
||||
{ label: 'Xuanhuan', value: 'Xuanhuan' },
|
||||
{ label: 'Yaoi', value: 'Yaoi' },
|
||||
{ label: 'Боевые Искусства', value: 'Боевые Искусства' },
|
||||
{ label: 'Виртуальный Мир', value: 'Виртуальный Мир' },
|
||||
{ label: 'Гарем', value: 'Гарем' },
|
||||
{ label: 'Детектив', value: 'Детектив' },
|
||||
{ label: 'Драма', value: 'Драма' },
|
||||
{ label: 'Игра', value: 'Игра' },
|
||||
{ label: 'Истории из жизни', value: 'Истории из жизни' },
|
||||
{ label: 'Исторический', value: 'Исторический' },
|
||||
{ label: 'История', value: 'История' },
|
||||
{ label: 'Комедия', value: 'Комедия' },
|
||||
{ label: 'Меха', value: 'Меха' },
|
||||
{ label: 'Мистика', value: 'Мистика' },
|
||||
{ label: 'Научная Фантастика', value: 'Научная Фантастика' },
|
||||
{ label: 'Повседневность', value: 'Повседневность' },
|
||||
{ label: 'Постапокалипсис', value: 'Постапокалипсис' },
|
||||
{ label: 'Приключения', value: 'Приключения' },
|
||||
{ label: 'Психология', value: 'Психология' },
|
||||
{ label: 'Романтика', value: 'Романтика' },
|
||||
{ label: 'Сёнэн', value: 'Сёнэн' },
|
||||
{ label: 'Сёнэн-ай', value: 'Сёнэн-ай' },
|
||||
{ label: 'Сверхъестественное', value: 'Сверхъестественное' },
|
||||
{ label: 'Спорт', value: 'Спорт' },
|
||||
{ label: 'Сэйнэн', value: 'Сэйнэн' },
|
||||
{ label: 'Сюаньхуа', value: 'Сюаньхуа' },
|
||||
{ label: 'Трагедия', value: 'Трагедия' },
|
||||
{ label: 'Триллер', value: 'Триллер' },
|
||||
{ label: 'Фантастика', value: 'Фантастика' },
|
||||
{ label: 'Фэнтези', value: 'Фэнтези' },
|
||||
{ label: 'Хоррор', value: 'Хоррор' },
|
||||
{ label: 'Школьная жизнь', value: 'Школьная жизнь' },
|
||||
{ label: 'Шоунен', value: 'Шоунен' },
|
||||
{ label: 'Экшн', value: 'Экшн' },
|
||||
{ label: 'Этти', value: 'Этти' },
|
||||
],
|
||||
inputType: FilterInputs.Checkbox,
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.Russian,
|
||||
icon: 'src/ru/jaomix/icon.png',
|
||||
filters,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
const cheerio = require('cheerio');
|
||||
const dayjs = require('dayjs');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
const Status = require('@libs/novelStatus');
|
||||
const FilterInputs = require('@libs/filterInputs');
|
||||
const defaultCoverUri =
|
||||
'https://github.com/LNReader/lnreader-sources/blob/main/icons/src/coverNotAvailable.jpg?raw=true';
|
||||
|
||||
|
||||
const pluginId = "RNRF";
|
||||
const sourceName = 'РанобэРФ';
|
||||
|
||||
const baseUrl = 'https://ранобэ.рф';
|
||||
|
||||
async function popularNovels (page, { showLatestNovels, filters }) {
|
||||
let url = baseUrl + '/books?order=';
|
||||
url += filters?.sort ? filters?.sort : (showLatestNovels ? 'lastPublishedChapter' : 'popular');
|
||||
url += '&page=' + page;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
let json = loadedCheerio('#__NEXT_DATA__').html();
|
||||
json = JSON.parse(json);
|
||||
let novels = [];
|
||||
|
||||
json.props.pageProps.totalData.items.forEach(item => {
|
||||
const novelName = item.title;
|
||||
const novelUrl = baseUrl + '/' + item.slug;
|
||||
const novelCover = item?.verticalImage?.url
|
||||
? baseUrl + item.verticalImage.url
|
||||
: defaultCoverUri;
|
||||
novels.push({ name: novelName, cover: novelCover, url: novelUrl });
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const result = await fetchApi(novelUrl);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
let json = loadedCheerio('#__NEXT_DATA__').html();
|
||||
json = JSON.parse(json);
|
||||
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
name: json.props.pageProps.book.title,
|
||||
cover: json.props.pageProps.book?.verticalImage?.url
|
||||
? baseUrl + json.props.pageProps.book.verticalImage.url
|
||||
: defaultCoverUri,
|
||||
summary: json.props.pageProps.book.description,
|
||||
author: json.props.pageProps.book?.author || '',
|
||||
genres: json.props.pageProps.book.genres.map(item => item.title).join(','),
|
||||
status: json.props.pageProps.book.additionalInfo.includes('Активен')
|
||||
? Status.Ongoing
|
||||
: Status.Completed,
|
||||
};
|
||||
|
||||
let chapters = [];
|
||||
|
||||
json.props.pageProps.book.chapters.forEach(item => {
|
||||
const chapterName = item.title;
|
||||
const releaseDate = dayjs(item.publishedAt).format('LLL');
|
||||
const chapterUrl = baseUrl + item.url;
|
||||
|
||||
if (!item.isDonate || item.isUserPaid) {
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
}
|
||||
});
|
||||
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const result = await fetchApi(chapterUrl);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
let json = loadedCheerio('#__NEXT_DATA__').html();
|
||||
json = JSON.parse(json);
|
||||
|
||||
let temp = cheerio.load(json.props.pageProps.chapter.content.text);
|
||||
|
||||
temp('img').each(function () {
|
||||
if (!loadedCheerio(this).attr('src')?.startsWith('http')) {
|
||||
let src = loadedCheerio(this).attr('src');
|
||||
loadedCheerio(this).attr('src', baseUrl + src);
|
||||
}
|
||||
});
|
||||
|
||||
const chapterText = temp.html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}/v3/books?filter[or][0][title][like]=${searchTerm}&filter[or][1][titleEn][like]=${searchTerm}&filter[or][2][fullTitle][like]=${searchTerm}&filter[status][]=active&filter[status][]=abandoned&filter[status][]=completed&expand=verticalImage`;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json();
|
||||
let novels = [];
|
||||
|
||||
body.items.forEach(item => {
|
||||
const novelName = item.title;
|
||||
const novelUrl = baseUrl + '/' + item.slug;
|
||||
const novelCover = item?.verticalImage?.url
|
||||
? baseUrl + item.verticalImage.url
|
||||
: defaultCoverUri;
|
||||
novels.push({ name: novelName, cover: novelCover, url: novelUrl });
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
const filters = [
|
||||
{
|
||||
key: 'sort',
|
||||
label: 'Сортировка',
|
||||
values: [
|
||||
{ label: 'Рейтинг', value: 'popular' },
|
||||
{ label: 'Дате добавления', value: 'new' },
|
||||
{ label: 'Дате обновления', value: 'lastPublishedChapter' },
|
||||
{ label: 'Законченные', value: 'completed' },
|
||||
],
|
||||
inputType: FilterInputs.Picker,
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.Russian,
|
||||
icon: 'src/ru/ranoberf/icon.png',
|
||||
filters,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,139 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const baseUrl = 'https://hasutl.wordpress.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'light-novels-activas/';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('div.wp-block-columns').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.wp-block-button').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.wp-block-button > a')
|
||||
.attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {};
|
||||
|
||||
novel.url = url;
|
||||
|
||||
novel.url = novelUrl;
|
||||
|
||||
novel.name = loadedCheerio('.post-header').text();
|
||||
|
||||
novel.cover = loadedCheerio('.featured-media > img').attr('src');
|
||||
|
||||
let novelSummary = loadedCheerio('.post-content').find('p').html();
|
||||
novel.summary = novelSummary;
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('.wp-block-media-text__content')
|
||||
.find('a')
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text().trim();
|
||||
|
||||
const releaseDate = null;
|
||||
|
||||
let chapterUrl = loadedCheerio(this).attr('href');
|
||||
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterText = loadedCheerio('.post-content').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}?s=${searchTerm}&post_type=wp-manga`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.post-container ').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-header').text();
|
||||
if (
|
||||
!novelName.includes('Cap') &&
|
||||
!novelName.includes('Vol') &&
|
||||
!novelName.includes('Light Novels')
|
||||
) {
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: "HasuTL",
|
||||
name: 'Hasu Translations',
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.Spanish,
|
||||
icon: 'src/es/hasutl/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,177 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const baseUrl = 'https://novelasligera.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.elementor-column').each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find('.widget-image-caption.wp-caption-text')
|
||||
.text();
|
||||
if (novelName) {
|
||||
const novelCover = loadedCheerio(this).find('a > img').attr('data-lazy-src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters ( novelUrl) {
|
||||
const url = baseUrl + 'novela/' + novelUrl;
|
||||
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {};
|
||||
|
||||
novel.url = url;
|
||||
|
||||
novel.name = loadedCheerio('h1').text();
|
||||
|
||||
novel.cover = loadedCheerio('.elementor-widget-container')
|
||||
.find('img')
|
||||
.attr('src');
|
||||
|
||||
loadedCheerio('.elementor-row')
|
||||
.find('p')
|
||||
.each(function () {
|
||||
if (loadedCheerio(this).text().includes('Autor:')) {
|
||||
novel.author = loadedCheerio(this).text().replace('Autor:', '').trim();
|
||||
}
|
||||
if (loadedCheerio(this).text().includes('Estado:')) {
|
||||
novel.status = loadedCheerio(this)
|
||||
.text()
|
||||
.replace('Estado: ', '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
if (loadedCheerio(this).text().includes('Género:')) {
|
||||
loadedCheerio(this).find('span').remove();
|
||||
novel.genres = loadedCheerio(this).text().replace(/,\s/g, ',');
|
||||
}
|
||||
});
|
||||
|
||||
novel.artist = null;
|
||||
|
||||
novel.summary = loadedCheerio(
|
||||
'.elementor-text-editor.elementor-clearfix',
|
||||
).text();
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('.elementor-accordion-item').remove();
|
||||
|
||||
loadedCheerio('.elementor-tab-content')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this)
|
||||
.find('a')
|
||||
.attr('href')
|
||||
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
loadedCheerio('.osny-nightmode.osny-nightmode--left').remove();
|
||||
loadedCheerio('.code-block.code-block-1').remove();
|
||||
loadedCheerio('.adsb30').remove();
|
||||
loadedCheerio('.saboxplugin-wrap').remove();
|
||||
loadedCheerio('.wp-post-navigation').remove();
|
||||
|
||||
let chapterText = loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = baseUrl + '?s=' + searchTerm + '&post_type=wp-manga';
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.inside-article').each(function () {
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
let novelName;
|
||||
|
||||
if (novelUrl) {
|
||||
novelName = novelUrl.replace(/-/g, ' ').replace(/^./, function (x) {
|
||||
return x.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
novelUrl += '/';
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
novels = [{ ...novels[1] }];
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: "ligera.com",
|
||||
name: "Novelas Ligera",
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
lang: languages.Spanish,
|
||||
icon: 'src/es/novelasligera/icon.png',
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,205 @@
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const pluginId = "awuxia.com"
|
||||
const baseUrl = 'http://www.reinowuxia.com/';
|
||||
|
||||
function getNovelName(y) {
|
||||
return y.replace(/-/g, ' ').replace(/(?:^|\s)\S/g, a => a.toUpperCase());
|
||||
}
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'p/todas-las-novelas.html';
|
||||
|
||||
let headers ={
|
||||
'User-Agent':
|
||||
"'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36",
|
||||
};
|
||||
|
||||
const result = await fetchApi(url, {
|
||||
method: 'GET',
|
||||
headers: headers,
|
||||
});
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.post-body.entry-content')
|
||||
.find('a')
|
||||
.each(function () {
|
||||
let novelName = loadedCheerio(this)
|
||||
.attr('href')
|
||||
.split('/')
|
||||
.pop()
|
||||
.replace('.html', '');
|
||||
novelName = getNovelName(novelName);
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {};
|
||||
|
||||
novel.url = url;
|
||||
|
||||
novel.name = loadedCheerio('h1.post-title').text().trim();
|
||||
|
||||
novel.cover = loadedCheerio('div.separator').find('a').attr('href');
|
||||
|
||||
novel.artist = '';
|
||||
novel.status = '';
|
||||
|
||||
loadedCheerio('div > b').each(function () {
|
||||
const detailName = loadedCheerio(this).text();
|
||||
let detail = loadedCheerio(this)[0].nextSibling;
|
||||
|
||||
if (detailName && detail) {
|
||||
detail = detail.nodeValue;
|
||||
|
||||
if (detailName.includes('Autor')) {
|
||||
novel.author = detail.replace('Autor:', '');
|
||||
}
|
||||
|
||||
if (detailName.includes('Estatus')) {
|
||||
novel.status = detail.replace('Estatus: ', '');
|
||||
}
|
||||
if (detailName.includes('Géneros:')) {
|
||||
novel.genres = detail.replace('Géneros: ', '').replace(/,\s/g, ',');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('div').each(function () {
|
||||
const detailName = loadedCheerio(this).text();
|
||||
if (detailName.includes('Sinopsis')) {
|
||||
novel.summary =
|
||||
loadedCheerio(this).next().text() !== ''
|
||||
? loadedCheerio(this).next().text().replace('Sinopsis', '').trim()
|
||||
: loadedCheerio(this)
|
||||
.next()
|
||||
.next()
|
||||
.text()
|
||||
.replace('Sinopsis', '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
if (detailName.includes('Lista de Capítulos')) {
|
||||
loadedCheerio(this)
|
||||
.find('a')
|
||||
.each(function (res) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
let chapterUrl = loadedCheerio(this).attr('href');
|
||||
const releaseDate = null;
|
||||
|
||||
if (
|
||||
chapterName &&
|
||||
chapterUrl &&
|
||||
!novelChapters.some(chap => chap.name === chapterName)
|
||||
) {
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterText = loadedCheerio('.post-body.entry-content').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
const searchNovels = async searchTerm => {
|
||||
const url = `${baseUrl}search?q=${searchTerm}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.date-outer').each(function () {
|
||||
let novelName = loadedCheerio(this)
|
||||
.find('a')
|
||||
.attr('href')
|
||||
.split('/')
|
||||
.pop()
|
||||
.replace(/-capitulo(.*?).html/, '');
|
||||
|
||||
const novelUrl = novelName + '.html/';
|
||||
|
||||
novelName = getNovelName(novelName);
|
||||
|
||||
const exists = novels.some(novel => novel.novelName === novelName);
|
||||
|
||||
if (!exists) {
|
||||
const novelCover = null;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: "ReinoWuxia",
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/es/novelawuxia/icon.png',
|
||||
lang: languages.Spanish,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,167 @@
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const pluginId = 'oasisTL.wp';
|
||||
const sourceName = 'Oasis Translations';
|
||||
const baseUrl = 'https://oasistranslations.wordpress.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.menu-item-1819')
|
||||
.find('.sub-menu > li')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) {
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {};
|
||||
|
||||
novel.url = url;
|
||||
|
||||
novel.name = loadedCheerio('h1.entry-title')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
|
||||
novel.cover = loadedCheerio('img[loading="lazy"]').attr('src');
|
||||
|
||||
loadedCheerio('.entry-content > p').each(function (res) {
|
||||
if (loadedCheerio(this).text().includes('Autor')) {
|
||||
let details = loadedCheerio(this).html();
|
||||
details = details.match(/<\/strong>(.|\n)*?<br>/g);
|
||||
details = details.map(detail =>
|
||||
detail.replace(/<strong>|<\/strong>|<br>|:\s/g, ''),
|
||||
);
|
||||
|
||||
novel.genres = '';
|
||||
|
||||
novel.author = details[2];
|
||||
novel.genres = details[4].replace(/\s| /g, '');
|
||||
novel.artist = details[3];
|
||||
}
|
||||
});
|
||||
|
||||
// let novelSummary = $(this).next().html();
|
||||
novel.summary = '';
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
// if ($(".entry-content").find("li").length) {
|
||||
loadedCheerio('.entry-content')
|
||||
.find('a')
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).attr('href');
|
||||
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
loadedCheerio('div#jp-post-flair').remove();
|
||||
|
||||
let chapterText = loadedCheerio('.entry-content').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
loadedCheerio('.menu-item-1819')
|
||||
.find('.sub-menu > li')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) {
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
novels = novels.filter(novel =>
|
||||
novel.name.toLowerCase().includes(searchTerm),
|
||||
);
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/es/oasistranslations/icon.png',
|
||||
lang: languages.Spanish,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,126 @@
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
|
||||
const baseUrl = 'https://www.skynovels.net/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const url = 'https://api.skynovels.net/api/novels?&q';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json();
|
||||
|
||||
const novels = [];
|
||||
|
||||
body.novels.map(res => {
|
||||
const novelName = res.nvl_title;
|
||||
const novelCover =
|
||||
'https://api.skynovels.net/api/get-image/' + res.image + '/novels/false';
|
||||
const novelUrl = baseUrl + 'novelas/' + res.id + '/' + res.nvl_name + '/';
|
||||
|
||||
const novel = { name: novelName, url: novelUrl, cover: novelCover };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels ;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novUrl) {
|
||||
let novelId = novUrl.substring().split('/')[4];
|
||||
const url = 'https://api.skynovels.net/api/novel/' + novelId + '/reading?&q';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json();
|
||||
|
||||
const item = body.novel[0];
|
||||
|
||||
let novel = {};
|
||||
|
||||
novel.url = novUrl;
|
||||
|
||||
novel.name = item.nvl_title;
|
||||
|
||||
novel.cover =
|
||||
'https://api.skynovels.net/api/get-image/' + item.image + '/novels/false';
|
||||
|
||||
let genres = [];
|
||||
item.genres.map(genre => genres.push(genre.genre_name));
|
||||
novel.genres = genres.join(',');
|
||||
novel.author = item.nvl_writer;
|
||||
novel.summary = item.nvl_content;
|
||||
novel.status = item.nvl_status;
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
item.volumes.map(volume => {
|
||||
volume.chapters.map(chapter => {
|
||||
const chapterName = chapter.chp_index_title;
|
||||
const releaseDate = new Date(chapter.createdAt).toDateString();
|
||||
const chapterUrl = novUrl + chapter.id + '/' + chapter.chp_name;
|
||||
|
||||
const chap = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
|
||||
novelChapters.push(chap);
|
||||
});
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapUrl) {
|
||||
let chapterId = chapUrl.split('/')[6];
|
||||
const url = `https://api.skynovels.net/api/novel-chapter/${chapterId}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json();
|
||||
|
||||
const item = body.chapter[0];
|
||||
|
||||
let chapterText = item.chp_content;
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
const url = 'https://api.skynovels.net/api/novels?&q';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json();
|
||||
|
||||
let results = body.novels.filter(novel =>
|
||||
novel.nvl_title.toLowerCase().includes(searchTerm),
|
||||
);
|
||||
|
||||
const novels = [];
|
||||
|
||||
results.map(res => {
|
||||
const novelName = res.nvl_title;
|
||||
const novelCover =
|
||||
'https://api.skynovels.net/api/get-image/' + res.image + '/novels/false';
|
||||
const novelUrl = baseUrl + 'novelas/' + res.id + '/' + res.nvl_name + '/';
|
||||
|
||||
const novel = { name: novelName, url: novelUrl, cover: novelCover };
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: 'skynovels.net',
|
||||
name: "SkyNovels",
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/es/skynovels/icon.png',
|
||||
lang: languages.Spanish,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,164 @@
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const cheerio = require('cheerio');
|
||||
const Status = require('@libs/novelStatus');
|
||||
const defaultCoverUri =
|
||||
'https://github.com/LNReader/lnreader-sources/blob/main/icons/src/coverNotAvailable.jpg?raw=true';
|
||||
|
||||
const pluginId = "TNL.com";
|
||||
const sourceName = 'TuNovelaLigera';
|
||||
|
||||
const baseUrl = 'https://tunovelaligera.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'novelas/page/' + page + '/?m_orderby=rating';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.h5 > a').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.h5 > a')
|
||||
.attr('href')
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
url,
|
||||
};
|
||||
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
|
||||
novel.name = loadedCheerio('.post-title > h1').text().trim();
|
||||
|
||||
let novelCover = loadedCheerio('.summary_image > a > img');
|
||||
|
||||
novel.cover =
|
||||
novelCover.attr('data-src') || novelCover.attr('src') || defaultCoverUri;
|
||||
|
||||
loadedCheerio('.post-content_item').each(function () {
|
||||
const detailName = loadedCheerio(this)
|
||||
.find('.summary-heading > h5')
|
||||
.text()
|
||||
.trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
|
||||
switch (detailName) {
|
||||
case 'Generos':
|
||||
novel.genres = detail.replace(/, /g, ',');
|
||||
break;
|
||||
case 'Autores':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Estado':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('Updating')
|
||||
? Status.Ongoing
|
||||
: Status.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
novel.summary = loadedCheerio('div.summary__content > p').text().trim();
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('.lcp_catlist li').each(function () {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find('a')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
|
||||
const releaseDate = loadedCheerio(this).find('span').text().trim();
|
||||
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
novelChapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters.reverse();
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterText = loadedCheerio('#hola_siguiente').next().text();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = `${baseUrl}?s=${searchTerm}&post_type=wp-manga`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.h4 > a').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('.h4 > a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/es/tunovelaligera/icon.png',
|
||||
lang: languages.Spanish,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,183 @@
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const pluginId = "yuukitls.com";
|
||||
const baseUrl = 'https://yuukitls.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.quadmenu-navbar-collapse ul li:nth-child(2)')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text().replace(/[\s\n]+/g,' ');
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels ;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {};
|
||||
|
||||
novel.url = url;
|
||||
|
||||
novel.name = loadedCheerio('h1.entry-title')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
|
||||
novel.cover = loadedCheerio('img[loading="lazy"]').attr('src');
|
||||
|
||||
loadedCheerio('.entry-content')
|
||||
.find('div')
|
||||
.each(function () {
|
||||
if (loadedCheerio(this).text().includes('Escritor:')) {
|
||||
novel.author = loadedCheerio(this)
|
||||
.text()
|
||||
.replace('Escritor: ', '')
|
||||
.trim();
|
||||
}
|
||||
if (loadedCheerio(this).text().includes('Ilustrador:')) {
|
||||
novel.artist = loadedCheerio(this)
|
||||
.text()
|
||||
.replace('Ilustrador: ', '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
if (loadedCheerio(this).text().includes('Género:')) {
|
||||
novel.genres = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/Género: |\s/g, '');
|
||||
}
|
||||
|
||||
if (loadedCheerio(this).text().includes('Sinopsis:')) {
|
||||
novel.summary = loadedCheerio(this).next().text();
|
||||
}
|
||||
});
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
if (loadedCheerio('.entry-content').find('li').length) {
|
||||
loadedCheerio('.entry-content')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
loadedCheerio('.entry-content')
|
||||
.find('p')
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
let chapterText = loadedCheerio('.entry-content').html();
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('.menu-item-2869')
|
||||
.find('.menu-item.menu-item-type-post_type.menu-item-object-post')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
novels = novels.filter(novel =>
|
||||
novel.novelName.toLowerCase().includes(searchTerm),
|
||||
);
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: "Yuuki Tls",
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/es/yuukitls/icon.png',
|
||||
lang: languages.Spanish,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,167 @@
|
||||
const cheerio = require('cheerio');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
const languages = require('@libs/languages');
|
||||
|
||||
const pluginId = 'epiknovel.com';
|
||||
|
||||
const sourceName = 'EpikNovel';
|
||||
|
||||
const baseUrl = 'https://www.epiknovel.com/';
|
||||
|
||||
async function popularNovels (page) {
|
||||
let url = baseUrl + 'seri-listesi?Sayfa=' + page;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('div.col-lg-12.col-md-12').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h3').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
// console.log(novels);
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const url = novelUrl;
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {url};
|
||||
|
||||
novel.name = loadedCheerio('h1#tables').text().trim();
|
||||
|
||||
novel.cover = loadedCheerio('img.manga-cover').attr('src');
|
||||
|
||||
novel.summary = loadedCheerio(
|
||||
'#wrapper > div.row > div.col-md-9 > div:nth-child(6) > p:nth-child(3)',
|
||||
)
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.status = loadedCheerio(
|
||||
'#wrapper > div.row > div.col-md-9 > div.row > div.col-md-9 > h4:nth-child(3) > a',
|
||||
)
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.author = loadedCheerio('#NovelInfo > p:nth-child(4)')
|
||||
.text()
|
||||
.replace(/Publisher:|\s/g, '')
|
||||
.trim();
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
loadedCheerio('table').find('tr').first().remove();
|
||||
|
||||
loadedCheerio('table')
|
||||
.find('tr')
|
||||
.each(function () {
|
||||
const releaseDate = loadedCheerio(this).find('td:nth-child(3)').text();
|
||||
|
||||
let chapterName = loadedCheerio(this).find('td:nth-child(1) > a').text();
|
||||
|
||||
if (loadedCheerio(this).find('td:nth-child(1) > span').length > 0) {
|
||||
chapterName = '🔒 ' + chapterName;
|
||||
}
|
||||
|
||||
const chapterUrl = loadedCheerio(this)
|
||||
.find(' td:nth-child(1) > a')
|
||||
.attr('href');
|
||||
|
||||
novelChapters.push({
|
||||
name: chapterName,
|
||||
url: chapterUrl,
|
||||
releaseTime: releaseDate,
|
||||
});
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
// console.log(novel);
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const url = chapterUrl;
|
||||
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let chapterName, chapterText;
|
||||
|
||||
if (result.url === 'https://www.epiknovel.com/login') {
|
||||
chapterName = '';
|
||||
chapterText = 'Premium Chapter';
|
||||
} else {
|
||||
chapterName = loadedCheerio('#icerik > center > h4 > b').text();
|
||||
chapterText = loadedCheerio('div#icerik').html();
|
||||
}
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = baseUrl + 'seri-listesi?q=' + searchTerm;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
loadedCheerio('div.col-lg-12.col-md-12').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h3').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: sourceName,
|
||||
site: baseUrl,
|
||||
version: '1.0.0',
|
||||
icon: 'src/tr/epiknovel/icon.png',
|
||||
lang: languages.Turkish,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
fetchImage: fetchFile,
|
||||
};
|
||||
@@ -0,0 +1,199 @@
|
||||
const cheerio = require('cheerio');
|
||||
const isUrlAbsolute = require('@libs/isAbsoluteUrl');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
|
||||
const pluginId = 'ln.hako';
|
||||
const baseUrl = 'https://ln.hako.vn';
|
||||
|
||||
async function popularNovels (page) {
|
||||
const link = baseUrl + '/danh-sach?truyendich=1&sapxep=topthang&page=' + page;
|
||||
const result = await fetchApi(link);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novels = [];
|
||||
|
||||
loadedCheerio('main.row > .thumb-item-flow').each(function () {
|
||||
let url = loadedCheerio(this)
|
||||
.find('div.thumb_attr.series-title > a')
|
||||
.attr('href');
|
||||
|
||||
if (url && !isUrlAbsolute(url)) {
|
||||
url = baseUrl + url;
|
||||
}
|
||||
|
||||
if (url) {
|
||||
const name = loadedCheerio(this).find('.series-title').text().trim();
|
||||
let cover = loadedCheerio(this)
|
||||
.find('.img-in-ratio')
|
||||
.attr('data-bg');
|
||||
|
||||
if (cover && !isUrlAbsolute(cover)) {
|
||||
cover = baseUrl + cover;
|
||||
}
|
||||
|
||||
const novel = {
|
||||
name,
|
||||
url,
|
||||
cover,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl){
|
||||
const url = novelUrl;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('.series-name').text();
|
||||
|
||||
const background = loadedCheerio('.series-cover > .a6-ratio > div').attr(
|
||||
'style',
|
||||
);
|
||||
const novelCover = background.substring(
|
||||
background.indexOf('http'),
|
||||
background.length - 2,
|
||||
);
|
||||
|
||||
novel.cover = novelCover
|
||||
? isUrlAbsolute(novelCover)
|
||||
? novelCover
|
||||
: baseUrl + novelCover
|
||||
: '';
|
||||
|
||||
novel.summary = loadedCheerio('.summary-content').text().trim();
|
||||
|
||||
novel.author = loadedCheerio(
|
||||
'#mainpart > div:nth-child(2) > div > div:nth-child(1) > section > main > div.top-part > div > div.col-12.col-md-9 > div.series-information > div:nth-child(2) > span.info-value > a',
|
||||
)
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
novel.genres = loadedCheerio('.series-gernes')
|
||||
.text()
|
||||
.trim()
|
||||
.replaceAll(/ +/g," ")
|
||||
.split('\n')
|
||||
.filter(e => e.trim())
|
||||
.join(', ');
|
||||
|
||||
novel.status = loadedCheerio(
|
||||
'#mainpart > div:nth-child(2) > div > div:nth-child(1) > section > main > div.top-part > div > div.col-12.col-md-9 > div.series-information > div:nth-child(4) > span.info-value > a',
|
||||
)
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
loadedCheerio('.list-chapters li').each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
if (chapterUrl && !isUrlAbsolute(chapterUrl)) {
|
||||
chapterUrl = baseUrl + chapterUrl;
|
||||
}
|
||||
|
||||
if (chapterUrl) {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find('.chapter-name')
|
||||
.text()
|
||||
.trim();
|
||||
const releaseTime = loadedCheerio(this).find('.chapter-time').text();
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseTime,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novel.chapters.push(chapter);
|
||||
}
|
||||
});
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl){
|
||||
const result = await fetchApi(chapterUrl);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const chapterText = loadedCheerio('#chapter-content').html() || '';
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async function searchNovels (searchTerm) {
|
||||
const url = baseUrl + '/tim-kiem?keywords=' + searchTerm;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
const novels = [];
|
||||
|
||||
loadedCheerio('div.row > .thumb-item-flow').each(function () {
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('div.thumb_attr.series-title > a')
|
||||
.attr('href');
|
||||
|
||||
if (novelUrl && !isUrlAbsolute(novelUrl)) {
|
||||
novelUrl = baseUrl + novelUrl;
|
||||
}
|
||||
|
||||
if (novelUrl) {
|
||||
const novelName = loadedCheerio(this).find('.series-title').text();
|
||||
let novelCover = loadedCheerio(this)
|
||||
.find('.img-in-ratio')
|
||||
.attr('data-bg');
|
||||
|
||||
if (novelCover && !isUrlAbsolute(novelCover)) {
|
||||
novelCover = baseUrl + novelCover;
|
||||
}
|
||||
|
||||
novels.push({
|
||||
name: novelName,
|
||||
url: novelUrl,
|
||||
cover: novelCover,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function fetchImage (url){
|
||||
const headers = {
|
||||
Referer: 'https://ln.hako.vn',
|
||||
}
|
||||
return await fetchFile(url, {headers: headers});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id: pluginId,
|
||||
name: 'Hako',
|
||||
version: '1.0.0',
|
||||
icon: 'src/vi/hakolightnovel/icon.png',
|
||||
site: baseUrl,
|
||||
lang: languages.Vietnamese,
|
||||
description: 'Cổng LightNovel',
|
||||
protected: true,
|
||||
fetchImage,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
require('module-alias/register');
|
||||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const languages = require('@libs/languages');
|
||||
const path = require('path')
|
||||
const root = path.dirname(__dirname);
|
||||
const username = process.env.GITHUB_USERNAME;
|
||||
const repo = process.env.GITHUB_REPOSITORY;
|
||||
const branch = process.env.GITHUB_BRANCH;
|
||||
|
||||
const githubIconsLink = `https://raw.githubusercontent.com/${username}/${repo}/${branch}/icons`;
|
||||
const githubPluginsLink = `https://raw.githubusercontent.com/${username}/${repo}/${branch}/plugins`;
|
||||
|
||||
const json = {};
|
||||
const jsonPath = path.join(root, 'plugins', 'plugins.json');
|
||||
const jsonMinPath = path.join(root, 'plugins', 'plugins.min.json');
|
||||
|
||||
for (let language in languages) { // language with English name
|
||||
const langPath = path.join(root, 'plugins', language.toLowerCase());
|
||||
if (!fs.existsSync(langPath)) continue;
|
||||
const plugins = fs.readdirSync(langPath);
|
||||
json[languages[language]] = [];
|
||||
plugins.forEach(plugin => {
|
||||
if(plugin.startsWith('.')) return;
|
||||
const instance = require(`@plugins/${language.toLowerCase()}/${plugin.split('.')[0]}`);
|
||||
|
||||
const { id, name, site, lang, version, icon, description } = instance;
|
||||
// lang: language with native name
|
||||
const info = { id, name, site, lang, version, description }
|
||||
info.url = `${githubPluginsLink}/${language.toLowerCase()}/${plugin}`;
|
||||
info.iconUrl = `${githubIconsLink}/${icon}`;
|
||||
|
||||
json[lang].push(info);
|
||||
|
||||
console.log('Collected', name);
|
||||
});
|
||||
}
|
||||
fs.writeFileSync(jsonMinPath, JSON.stringify(json));
|
||||
fs.writeFileSync(jsonPath, JSON.stringify(json, null, '\t'));
|
||||
console.log('Done ✅');
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
const cheerio = require('cheerio');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
// const dayjs = require('dayjs');
|
||||
// const FilterInputs = require('@libs/filterInputs');
|
||||
// const novelStatus = require('@libs/novelStatus');
|
||||
// const isUrlAbsolute = require('@libs/isAbsoluteUrl');
|
||||
// const parseDate = require('@libs/parseDate');
|
||||
|
||||
|
||||
async function popularNovels (pageNo) {
|
||||
const novels = [];
|
||||
/*
|
||||
Do something....
|
||||
novel = {
|
||||
name: '',
|
||||
url: '', must be absolute
|
||||
cover: '',
|
||||
}
|
||||
novels.push(novel);
|
||||
*/
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
/**
|
||||
* novel.name = '';
|
||||
* novel.cover = '';
|
||||
* novel.summary = '';
|
||||
* novel.author = '';
|
||||
* novel.artist = '';
|
||||
* novel.status = '';
|
||||
* novel.genres = ''; join by commas. For example: 'romcom, action, school'
|
||||
*/
|
||||
|
||||
/*
|
||||
Do something....
|
||||
chapter = {
|
||||
name: '',
|
||||
url: '', must be absoulute
|
||||
releaseTime: '',
|
||||
}
|
||||
novel.chapters.push(chapter);
|
||||
*/
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
// Do something...
|
||||
const chapterText = '';
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
|
||||
async function searchNovels (searchTerm, pageNo) {
|
||||
const novels = [];
|
||||
/*
|
||||
Do something....
|
||||
novel = {
|
||||
name: '',
|
||||
url: '', must be absolute
|
||||
cover: '',
|
||||
}
|
||||
novels.push(novel);
|
||||
*/
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function fetchImage (url) {
|
||||
// Some site cant fetch images normally (maybe need some headers)
|
||||
// Must return base64 of image
|
||||
return await fetchFile(url, {});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id, // string and must be unique
|
||||
name: 'Source name',
|
||||
icon, /** The relative path to the icon without @icons . For example: 'src/vi/hakolightnovel/icon.png' */
|
||||
version, // xx.xx.xx
|
||||
site,
|
||||
lang: languages.English, // must be included in languages
|
||||
description: 'This is descriptions',
|
||||
protected: false, // true if this site protect its resources (images) and you have to define headers or smt to bypass
|
||||
filters, // optional
|
||||
fetchImage,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
}
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
const cheerio = require('cheerio');
|
||||
const languages = require('@libs/languages');
|
||||
const fetchApi = require('@libs/fetchApi');
|
||||
const fetchFile = require('@libs/fetchFile');
|
||||
// const dayjs = require('dayjs');
|
||||
// const FilterInputs = require('@libs/filterInputs');
|
||||
// const novelStatus = require('@libs/novelStatus');
|
||||
// const isUrlAbsolute = require('@libs/isAbsoluteUrl');
|
||||
// const parseDate = require('@libs/parseDate');
|
||||
|
||||
|
||||
async function popularNovels (pageNo) {
|
||||
const novels = [];
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function parseNovelAndChapters (novelUrl) {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
chapters: [],
|
||||
};
|
||||
|
||||
return novel;
|
||||
};
|
||||
|
||||
async function parseChapter (chapterUrl) {
|
||||
const chapterText = '';
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
|
||||
async function searchNovels (searchTerm, pageNo) {
|
||||
const novels = [];
|
||||
|
||||
return novels;
|
||||
};
|
||||
|
||||
async function fetchImage (url) {
|
||||
|
||||
return await fetchFile(url, {});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
id,
|
||||
name,
|
||||
icon,
|
||||
version,
|
||||
site,
|
||||
lang: languages.English,
|
||||
// description,
|
||||
// protected,
|
||||
// filters,
|
||||
fetchImage,
|
||||
popularNovels,
|
||||
parseNovelAndChapters,
|
||||
parseChapter,
|
||||
searchNovels,
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="shortcut icon" sizes="128x128" type="image/png" href="/static/ico.png" defer />
|
||||
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/index.css">
|
||||
<title>Testing plugin</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="navbar navbar-light bg-light">
|
||||
<form class="form-inline">
|
||||
<input id="plugin" class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="button" id="clear-search">Clear</button>
|
||||
<div id="search-results">
|
||||
</div>
|
||||
</form>
|
||||
<div class="input-group">
|
||||
<select class="custom-select" id="language">
|
||||
<option value=""></option>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<label class="input-group-text" for="language">Language</label>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="test-container">
|
||||
<div class="test-wrapper" id="popularNovels">
|
||||
<div class="title">
|
||||
popularNovels
|
||||
<button type="button" class="btn btn-primary" onclick="popularNovels()">fetch</button>
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="novel-list">
|
||||
</div>
|
||||
</div>
|
||||
<div class="test-wrapper" id="searchNovels">
|
||||
<div class="title">
|
||||
searchNovels
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="searchTerm">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button" onclick="searchNovels()">search</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="novel-list">
|
||||
</div>
|
||||
</div>
|
||||
<div class="test-wrapper" id="parseNovelAndChapters">
|
||||
<div class="title">
|
||||
parseNovelAndChapters
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="novel url">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button" onclick="parseNovelAndChapters()">fetch</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="novel-list">
|
||||
<div class="novel-item">
|
||||
</div>
|
||||
<div class="chapter-list">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="test-wrapper" id="parseChapter">
|
||||
<div class="title">
|
||||
parseChapter
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="chapter url">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button" onclick="parseChapter()">fetch</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="10">
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="test-wrapper" id="fetchImage">
|
||||
<div class="title">
|
||||
fetchImage
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="image url (shoule be in chapterText)">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button" onclick="fetchImage()">fetch</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<img src="" style="min-height: 300px; max-width: 450px;" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="/static/js/jquery-3.6.4.min.js"></script>
|
||||
<script src="/static/js/index.js"></script>
|
||||
|
||||
</html>
|
||||
+7
File diff suppressed because one or more lines are too long
@@ -0,0 +1,120 @@
|
||||
.navbar{
|
||||
width: 1080px;
|
||||
align-items: center;
|
||||
padding-left: 5%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.input-group{
|
||||
width: 20rem;
|
||||
}
|
||||
|
||||
#search-results{
|
||||
position: absolute;
|
||||
top: calc(100% - 0.5rem);
|
||||
width: 15rem;
|
||||
padding: 0.375rem 0;
|
||||
border-radius: 5px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.btn.disabled, .btn:disabled{
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#test-container{
|
||||
align-items: center;
|
||||
height: max-content;
|
||||
margin-bottom: 100px;
|
||||
}
|
||||
|
||||
|
||||
.test-wrapper{
|
||||
margin: 1rem;
|
||||
padding: 0.5rem;
|
||||
background-color: aliceblue;
|
||||
}
|
||||
|
||||
#popularNovels, #searchNovels{
|
||||
height: 350px;
|
||||
min-width: 95%;
|
||||
max-width: 95%;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
#parseNovelAndChapters{
|
||||
height: 380px;
|
||||
min-width: 95%;
|
||||
max-width: 95%;
|
||||
}
|
||||
|
||||
.title{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.spinner-border {
|
||||
display: none;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
vertical-align: text-bottom;
|
||||
border: 0.25em solid currentColor;
|
||||
border-right-color: transparent;
|
||||
border-radius: 50%;
|
||||
-webkit-animation: spinner-border .75s linear infinite;
|
||||
animation: spinner-border .75s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spinner-border{
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.novel-list{
|
||||
display: flex;
|
||||
margin-top: 0.5rem;
|
||||
height: 300px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.novel-item{
|
||||
display: flex;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.novel-item img {
|
||||
max-height: 90%;
|
||||
}
|
||||
|
||||
.novel-info{
|
||||
width: 16rem;
|
||||
}
|
||||
|
||||
.info-item{
|
||||
display: flex;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.info-value{
|
||||
width: 10rem;
|
||||
padding-left: 0.25rem;
|
||||
font-size: 0.65rem;
|
||||
word-wrap:break-word;
|
||||
}
|
||||
|
||||
.btn{
|
||||
font-size: 0.75rem;
|
||||
padding: 0.25rem 0.25rem;
|
||||
}
|
||||
|
||||
.chapter-list{
|
||||
position: relative;
|
||||
display: grid;
|
||||
min-width: 50%;
|
||||
overflow-y: scroll;
|
||||
overflow-x: scroll;
|
||||
grid-template-columns: 15rem 15rem 15rem 15rem;
|
||||
grid-gap: 0, 0;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,263 @@
|
||||
var all_plugins = undefined;
|
||||
var plugin_arr = [];
|
||||
var current_array = [];
|
||||
var current_plugin_requirePath = undefined;
|
||||
|
||||
const language_selection = $('#language');
|
||||
const plugin_search = $('#plugin');
|
||||
const search_results = $('#search-results');
|
||||
|
||||
fetch('/all_plugins').then(res => res.json()).then(all => {
|
||||
all_plugins = all;
|
||||
for(let lang in all){
|
||||
language_selection.append(`<option>${lang}</option>`);
|
||||
plugin_arr = plugin_arr.concat(all[lang]);
|
||||
}
|
||||
});
|
||||
|
||||
const display_search = (arr) => {
|
||||
search_results.hide();
|
||||
search_results.html('');
|
||||
arr.slice(0, 15).forEach(plugin => {
|
||||
search_results.append(`
|
||||
<div>
|
||||
<button data-require="${plugin.requirePath}" onclick="test_plugin(this)" type="button" class="search-item btn btn-light btn-outline-primary btn-md btn-block">${plugin.lang}/${plugin.name}</button>
|
||||
</div>
|
||||
`)
|
||||
});
|
||||
search_results.show();
|
||||
}
|
||||
|
||||
plugin_search.focus(e => {
|
||||
if(!all_plugins) return;
|
||||
if(language_selection.val()){
|
||||
current_array = all_plugins[language_selection.val()];
|
||||
}else{
|
||||
current_array = plugin_arr;
|
||||
}
|
||||
display_search(current_array);
|
||||
});
|
||||
|
||||
plugin_search.keyup(e => {
|
||||
display_search(current_array.filter(plg => plg.name.toLowerCase().includes(plugin_search.val())));
|
||||
});
|
||||
|
||||
$('#clear-search').click(e => {
|
||||
search_results.hide();
|
||||
plugin_search.val('');
|
||||
plugin_search.attr('data-require', '');
|
||||
})
|
||||
|
||||
const test_plugin = (btn) => {
|
||||
const ele = $(btn);
|
||||
current_plugin_requirePath = ele.attr('data-require');
|
||||
plugin_search.attr('data-require', current_plugin_requirePath);
|
||||
plugin_search.val(ele.text().split('/')[1]);
|
||||
search_results.hide();
|
||||
}
|
||||
|
||||
const popularNovels = () => {
|
||||
if(!current_plugin_requirePath) return;
|
||||
$('#popularNovels .spinner-border').show();
|
||||
fetch(`/popularNovels/`,{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({"pluginRequirePath": current_plugin_requirePath}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(novels => {
|
||||
const novel_list = $('#popularNovels .novel-list');
|
||||
novel_list.html('');
|
||||
if(novels.error){
|
||||
novel_list.html(novels.error);
|
||||
}else{
|
||||
novels.forEach(novel => {
|
||||
novel_list.append(`
|
||||
<div class="novel-item">
|
||||
<img src="${novel.cover}" alt="No cover found">
|
||||
<div class="novel-info">
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">name</div>
|
||||
<samp class="info-value btn-light">${novel.name?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${novel.name}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">url</div>
|
||||
<samp class="info-value btn-light">${novel.url?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${novel.url}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">cover</div>
|
||||
<samp class="info-value btn-light">${novel.cover?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${novel.cover}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
})
|
||||
}
|
||||
$('#popularNovels .spinner-border').hide();
|
||||
});
|
||||
}
|
||||
|
||||
const searchNovels = () => {
|
||||
const searchTerm = $('#searchNovels input').val();
|
||||
if(!current_plugin_requirePath || !searchTerm) return;
|
||||
$('#searchNovels .spinner-border').show();
|
||||
fetch(`/searchNovels/`,{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({"pluginRequirePath": current_plugin_requirePath, "searchTerm": searchTerm}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(novels => {
|
||||
const novel_list = $('#searchNovels .novel-list');
|
||||
novel_list.html('');
|
||||
if(novels.error){
|
||||
novel_list.html(novels.error);
|
||||
}else{
|
||||
novels.forEach(novel => {
|
||||
novel_list.append(`
|
||||
<div class="novel-item">
|
||||
<img src="${novel.cover}" alt="No cover found">
|
||||
<div class="novel-info">
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">name</div>
|
||||
<samp class="info-value btn-light">${novel.name?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${novel.name}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">url</div>
|
||||
<samp class="info-value btn-light">${novel.url?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${novel.url}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">cover</div>
|
||||
<samp class="info-value btn-light">${novel.cover?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${novel.cover}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
})
|
||||
}
|
||||
$('#searchNovels .spinner-border').hide();
|
||||
});
|
||||
}
|
||||
|
||||
const parseNovelAndChapters = () => {
|
||||
const novelUrl = $('#parseNovelAndChapters input').val();
|
||||
if(!current_plugin_requirePath || !novelUrl) return;
|
||||
$('#parseNovelAndChapters .spinner-border').show();
|
||||
fetch(`/parseNovelAndChapters/`,{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({"pluginRequirePath": current_plugin_requirePath, "novelUrl": novelUrl}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(sourceNovel => {
|
||||
const novel_item = $('#parseNovelAndChapters .novel-list .novel-item');
|
||||
novel_item.html(`
|
||||
<img src="${sourceNovel.cover}" alt="No cover found">
|
||||
<div class="novel-info">
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">name</div>
|
||||
<samp class="info-value btn-light">${sourceNovel.name?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${sourceNovel.name}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">url</div>
|
||||
<samp class="info-value btn-light">${sourceNovel.url?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${sourceNovel.url}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">cover</div>
|
||||
<samp class="info-value btn-light">${sourceNovel.cover?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${sourceNovel.cover}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">summary</div>
|
||||
<samp class="info-value btn-light">${sourceNovel.summary?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${sourceNovel.summary}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">author</div>
|
||||
<samp class="info-value btn-light">${sourceNovel.author}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${sourceNovel.author}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">artist</div>
|
||||
<samp class="info-value btn-light">${sourceNovel.artist}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${sourceNovel.artist}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">status</div>
|
||||
<samp class="info-value btn-light">${sourceNovel.status}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${sourceNovel.status}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-name btn btn-info disabled">genres</div>
|
||||
<samp class="info-value btn-light">${sourceNovel.genres?.slice(0, 50)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${sourceNovel.genres}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy</div>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
if(sourceNovel.error){
|
||||
novel_item.html(sourceNovel.error);
|
||||
}else{
|
||||
const chapter_list = $('#parseNovelAndChapters .chapter-list');
|
||||
chapter_list.html('');
|
||||
sourceNovel.chapters.forEach(chapter => {
|
||||
chapter_list.append(`
|
||||
<div class="chapter-item">
|
||||
<samp class="info-value btn-light">${chapter.name?.slice(0, 26)}</samp>
|
||||
<div class="info-copy btn btn-primary" data="${chapter.url}" onclick="navigator.clipboard.writeText(this.getAttribute('data'))">Copy url</div>
|
||||
</div>
|
||||
`);
|
||||
})
|
||||
}
|
||||
$('#parseNovelAndChapters .spinner-border').hide();
|
||||
});
|
||||
}
|
||||
|
||||
const parseChapter = () => {
|
||||
const chapterUrl = $('#parseChapter input').val();
|
||||
if(!current_plugin_requirePath || !chapterUrl) return;
|
||||
$('#parseChapter .spinner-border').show();
|
||||
fetch(`/parseChapter/`,{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({"pluginRequirePath": current_plugin_requirePath, "chapterUrl": chapterUrl}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(chapterText => {
|
||||
$('#parseChapter textarea').text(chapterText);
|
||||
$('#parseChapter .spinner-border').hide();
|
||||
})
|
||||
}
|
||||
|
||||
const fetchImage = () => {
|
||||
const url = $('#fetchImage input').val();
|
||||
if(!current_plugin_requirePath || !url) return;
|
||||
$('#fetchImage .spinner-border').show();
|
||||
fetch(`/fetchImage/`,{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({"pluginRequirePath": current_plugin_requirePath, "url": url}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(base64 => {
|
||||
$('#fetchImage img').attr("src", `data:image/jpg;base64,${base64}`);
|
||||
$('#fetchImage .spinner-border').hide();
|
||||
})
|
||||
}
|
||||
+2
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user