ReadNovelFull: add source
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const express = require("express");
|
||||
|
||||
const extensions = require("./src/extensions");
|
||||
|
||||
const app = express();
|
||||
@@ -19,15 +18,10 @@ app.get("/", (req, res) =>
|
||||
);
|
||||
|
||||
app.get("/api/", (req, res) => res.json(extensions));
|
||||
|
||||
// Box Novel
|
||||
app.use("/api/1/", require("./src/en/boxnovel/boxnovel"));
|
||||
|
||||
// ReadLightNovel
|
||||
app.use("/api/2/", require("./src/en/readlightnovel/readlightnovel"));
|
||||
|
||||
// WuxiaWorld
|
||||
app.use("/api/3/", require("./src/en/fastnovel/fastnovel"));
|
||||
app.use("/api/4/", require("./src/en/readnovelfull/readnovelfull"));
|
||||
|
||||
const PORT = process.env.PORT || 5000;
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
@@ -0,0 +1,192 @@
|
||||
const express = require("express");
|
||||
const cheerio = require("cheerio");
|
||||
const request = require("request");
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
const baseUrl = "https://readnovelfull.com";
|
||||
|
||||
// Top novels
|
||||
|
||||
router.get("/novels/", (req, res) => {
|
||||
url = `${baseUrl}/most-popular-novel`;
|
||||
|
||||
request(url, (err, response, body) => {
|
||||
if (err) throw err;
|
||||
|
||||
let novels = [];
|
||||
|
||||
$ = cheerio.load(body);
|
||||
|
||||
$("div.col-novel-main > div.list-novel > .row").each(function (result) {
|
||||
let novelUrl = $(this)
|
||||
.find("h3.novel-title > a")
|
||||
.attr("href")
|
||||
.substring(1);
|
||||
novelUrl = `${novelUrl}/`;
|
||||
let novelName = $(this).find("h3.novel-title > a").text();
|
||||
let novelCover = $(this).find("img").attr("src");
|
||||
|
||||
novel = {
|
||||
extensionId: 4,
|
||||
novelUrl,
|
||||
novelName,
|
||||
novelCover,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
res.json(novels);
|
||||
});
|
||||
});
|
||||
|
||||
router.get("/novel/:novelUrl", (req, res) => {
|
||||
let novelUrl = req.params.novelUrl;
|
||||
url = `${baseUrl}/${novelUrl}`;
|
||||
|
||||
request(url, (err, response, body) => {
|
||||
$ = cheerio.load(body);
|
||||
|
||||
let novel = {};
|
||||
|
||||
novel.extensionId = 4;
|
||||
|
||||
novel.sourceName = "ReadNovelFull";
|
||||
|
||||
novel.sourceUrl = url;
|
||||
|
||||
novel.novelUrl = `${novelUrl}/`;
|
||||
|
||||
novel.novelName = $("h3.title").text();
|
||||
|
||||
novel.novelCover = $("img").attr("src");
|
||||
|
||||
novel.novelSummary = $("div.desc-text").text();
|
||||
|
||||
novel["Author(s)"] = $("li > h3")
|
||||
.filter(function () {
|
||||
return $(this).text().trim() === "Author:";
|
||||
})
|
||||
.siblings()
|
||||
.text();
|
||||
|
||||
novel["Genre(s)"] = $("li > h3")
|
||||
.filter(function () {
|
||||
return $(this).text().trim() === "Genre:";
|
||||
})
|
||||
.siblings()
|
||||
.text();
|
||||
|
||||
novel["Artist(s)"] = null;
|
||||
|
||||
novel.Status = $("li > h3")
|
||||
.filter(function () {
|
||||
return $(this).text().trim() === "Status:";
|
||||
})
|
||||
.siblings()
|
||||
.text();
|
||||
|
||||
let novelChapters = [];
|
||||
|
||||
$(".panel-body")
|
||||
.find("li")
|
||||
.each(function (result) {
|
||||
chapterName = $(this).find("a").attr("title");
|
||||
|
||||
releaseDate = null;
|
||||
|
||||
chapterUrl = $(this).find("a").attr("href");
|
||||
|
||||
novelChapters.push({
|
||||
chapterName,
|
||||
releaseDate,
|
||||
chapterUrl: chapterUrl.replace(`/${novelUrl}/`, ""),
|
||||
});
|
||||
});
|
||||
|
||||
novel.novelChapters = novelChapters;
|
||||
|
||||
res.json({ novel });
|
||||
});
|
||||
});
|
||||
|
||||
router.get("/novel/:novelUrl/:chapterUrl", (req, res) => {
|
||||
let novelUrl = req.params.novelUrl.replace(".html/", "");
|
||||
url = `${baseUrl}/${novelUrl}/${req.params.chapterUrl}`;
|
||||
|
||||
request(url, (err, response, body) => {
|
||||
if (err) throw err;
|
||||
|
||||
$ = cheerio.load(body);
|
||||
|
||||
let chapterName = $(".chr-title").attr("title");
|
||||
|
||||
chapterText = $("#chr-content").text();
|
||||
|
||||
let nextChapter = null;
|
||||
if ($("a#next_chap").attr("href")) {
|
||||
nextChapter = $("a#next_chap")
|
||||
.attr("href")
|
||||
.replace(`/${novelUrl}/`, "");
|
||||
}
|
||||
|
||||
let prevChapter = null;
|
||||
if ($("a#prev_chap").attr("href")) {
|
||||
prevChapter = $("a#prev_chap")
|
||||
.attr("href")
|
||||
.replace(`/${novelUrl}/`, "");
|
||||
}
|
||||
|
||||
chapter = {
|
||||
extensionId: 4,
|
||||
novelUrl: `${req.params.novelUrl}`,
|
||||
chapterUrl: `${req.params.chapterUrl}`,
|
||||
chapterName,
|
||||
chapterText,
|
||||
nextChapter,
|
||||
prevChapter,
|
||||
};
|
||||
|
||||
res.json(chapter);
|
||||
});
|
||||
});
|
||||
|
||||
router.get("/search/", (req, res) => {
|
||||
let searchTerm = req.query.s;
|
||||
console.log(searchTerm);
|
||||
searchUrl = `https://readnovelfull.com/search?keyword=`;
|
||||
|
||||
url = `${searchUrl}${searchTerm}`;
|
||||
|
||||
request(url, (err, response, body) => {
|
||||
if (err) throw err;
|
||||
|
||||
$ = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
|
||||
$("div.col-novel-main > div.list-novel > .row").each(function (result) {
|
||||
let novelUrl = $(this)
|
||||
.find("h3.novel-title > a")
|
||||
.attr("href")
|
||||
.substring(1);
|
||||
novelUrl = `${novelUrl}/`;
|
||||
let novelName = $(this).find("h3.novel-title > a").text();
|
||||
let novelCover = $(this).find("img").attr("src");
|
||||
|
||||
novel = {
|
||||
extensionId: 4,
|
||||
novelUrl,
|
||||
novelName,
|
||||
novelCover,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
res.json(novels);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
@@ -19,6 +19,13 @@ extensions = [
|
||||
"https://github.com/rajarsheechatterjee/lnreader-extensions/blob/main/src/en/fastnovel/icon.png?raw=true",
|
||||
sourceLanguage: "English",
|
||||
},
|
||||
{
|
||||
sourceId: 4,
|
||||
sourceName: "ReadNovelFull",
|
||||
sourceCover:
|
||||
"https://github.com/rajarsheechatterjee/lnreader-extensions/blob/main/src/en/readnovelfull/icon.png?raw=true",
|
||||
sourceLanguage: "English",
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = extensions;
|
||||
|
||||
Reference in New Issue
Block a user