committed by
GitHub
parent
99bfadd60b
commit
7936ac9c44
@@ -27,6 +27,7 @@ app.use("/api/6/", require("./src/en/novelhall/Novelhall"));
|
|||||||
app.use("/api/7/", require("./src/en/wuxiaworld/WuxiaWorld"));
|
app.use("/api/7/", require("./src/en/wuxiaworld/WuxiaWorld"));
|
||||||
app.use("/api/8/", require("./src/en/novelfull/NovelFull"));
|
app.use("/api/8/", require("./src/en/novelfull/NovelFull"));
|
||||||
app.use("/api/9/", require("./src/en/noveltrench/NovelTrench"));
|
app.use("/api/9/", require("./src/en/noveltrench/NovelTrench"));
|
||||||
|
app.use("/api/10/", require("./src/en/vipnovel/VipNovel"));
|
||||||
|
|
||||||
const PORT = process.env.PORT || 5000;
|
const PORT = process.env.PORT || 5000;
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -71,7 +71,6 @@ extensions = [
|
|||||||
sourceLanguage: "English",
|
sourceLanguage: "English",
|
||||||
status: 1,
|
status: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
sourceId: 9,
|
sourceId: 9,
|
||||||
sourceUrl: "https://noveltrench.com/",
|
sourceUrl: "https://noveltrench.com/",
|
||||||
@@ -81,6 +80,16 @@ extensions = [
|
|||||||
sourceLanguage: "English",
|
sourceLanguage: "English",
|
||||||
status: 1,
|
status: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
sourceId: 10,
|
||||||
|
sourceUrl: "https://vipnovel.com/",
|
||||||
|
sourceName: "VipNovel",
|
||||||
|
sourceCover:
|
||||||
|
"https://github.com/rajarsheechatterjee/lnreader-extensions/blob/main/src/en/vipnovel/icon.png?raw=true",
|
||||||
|
sourceLanguage: "English",
|
||||||
|
status: 1,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = extensions;
|
module.exports = extensions;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
const express = require("express");
|
||||||
|
const vipNovelScraper = require("./VipNovelScraper");
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.get("/novels/", vipNovelScraper.novelsScraper);
|
||||||
|
|
||||||
|
router.get("/novel/:novelUrl", vipNovelScraper.novelScraper);
|
||||||
|
|
||||||
|
router.get("/novel/:novelUrl/:chapterUrl", vipNovelScraper.chapterScraper);
|
||||||
|
|
||||||
|
router.get("/search/", vipNovelScraper.searchScraper);
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
const cheerio = require("cheerio");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
const { htmlToText } = require("html-to-text");
|
||||||
|
|
||||||
|
const baseUrl = "https://vipnovel.com/";
|
||||||
|
|
||||||
|
const novelsScraper = async (req, res) => {
|
||||||
|
let url = baseUrl;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novels = [];
|
||||||
|
|
||||||
|
$(".page-item-detail").each(function (result) {
|
||||||
|
const novelName = $(this).find("h5 > a").text();
|
||||||
|
const novelCover = $(this).find("img").attr("src");
|
||||||
|
|
||||||
|
let novelUrl = $(this).find("h5 > a").attr("href");
|
||||||
|
novelUrl = novelUrl.replace(`${baseUrl}vipnovel/`, "");
|
||||||
|
|
||||||
|
const novel = {
|
||||||
|
extensionId: 10,
|
||||||
|
novelName,
|
||||||
|
novelCover,
|
||||||
|
novelUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novels.push(novel);
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json(novels);
|
||||||
|
};
|
||||||
|
|
||||||
|
const novelScraper = async (req, res) => {
|
||||||
|
const novelUrl = req.params.novelUrl;
|
||||||
|
const url = `${baseUrl}vipnovel/${novelUrl}/`;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novel = {};
|
||||||
|
|
||||||
|
novel.extensionId = 10;
|
||||||
|
|
||||||
|
novel.sourceName = "VipNovel";
|
||||||
|
|
||||||
|
novel.sourceUrl = url;
|
||||||
|
|
||||||
|
novel.novelUrl = `${novelUrl}/`;
|
||||||
|
|
||||||
|
novel.novelName = $(".post-title > h3")
|
||||||
|
.text()
|
||||||
|
.replace(/[\t\n]/g, "")
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
novel.novelCover = $(".summary_image > a > img").attr("data-src");
|
||||||
|
|
||||||
|
$(".post-content_item").each(function (result) {
|
||||||
|
detailName = $(this)
|
||||||
|
.find(".summary-heading > h5")
|
||||||
|
.text()
|
||||||
|
.replace(/[\t\n]/g, "")
|
||||||
|
.trim();
|
||||||
|
detail = $(this)
|
||||||
|
.find(".summary-content")
|
||||||
|
.text()
|
||||||
|
.replace(/[\t\n]/g, "")
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
novel[detailName] = detail;
|
||||||
|
});
|
||||||
|
|
||||||
|
// $(".description-summary > div.summary__content").find("em").remove();
|
||||||
|
|
||||||
|
let novelSummary = $(".description-summary > div.summary__content").html();
|
||||||
|
|
||||||
|
novel.novelSummary = htmlToText(novelSummary);
|
||||||
|
|
||||||
|
let novelChapters = [];
|
||||||
|
|
||||||
|
$(".wp-manga-chapter").each(function (result) {
|
||||||
|
const chapterName = $(this)
|
||||||
|
.find("a")
|
||||||
|
.text()
|
||||||
|
.replace(/[\t\n]/g, "")
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
const releaseDate = $(this)
|
||||||
|
.find("span")
|
||||||
|
.text()
|
||||||
|
.replace(/[\t\n]/g, "")
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
const chapterUrl = $(this).find("a").attr("href").replace(url, "");
|
||||||
|
|
||||||
|
const chapter = { chapterName, releaseDate, chapterUrl };
|
||||||
|
|
||||||
|
novelChapters.push(chapter);
|
||||||
|
});
|
||||||
|
|
||||||
|
novel.novelChapters = novelChapters.reverse();
|
||||||
|
|
||||||
|
res.json(novel);
|
||||||
|
};
|
||||||
|
|
||||||
|
const chapterScraper = async (req, res) => {
|
||||||
|
let novelUrl = req.params.novelUrl;
|
||||||
|
let chapterUrl = req.params.chapterUrl;
|
||||||
|
|
||||||
|
const url = `${baseUrl}vipnovel/${novelUrl}/${chapterUrl}`;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let chapterName = $(".text-center").text();
|
||||||
|
|
||||||
|
if (!chapterName) {
|
||||||
|
chapterName = $(".text-left > div> h3").text();
|
||||||
|
}
|
||||||
|
|
||||||
|
let chapterText = $(".text-left").html();
|
||||||
|
chapterText = htmlToText(chapterText);
|
||||||
|
|
||||||
|
let nextChapter = null;
|
||||||
|
|
||||||
|
if ($(".nav-next").length) {
|
||||||
|
nextChapter = $(".nav-next")
|
||||||
|
.find("a")
|
||||||
|
.attr("href")
|
||||||
|
.replace(baseUrl + "vipnovel/" + novelUrl + "/", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
let prevChapter = null;
|
||||||
|
|
||||||
|
if ($(".nav-previous").length) {
|
||||||
|
prevChapter = $(".nav-previous")
|
||||||
|
.find("a")
|
||||||
|
.attr("href")
|
||||||
|
.replace(baseUrl + "vipnovel/" + novelUrl + "/", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
novelUrl = novelUrl + "/";
|
||||||
|
chapterUrl = chapterUrl + "/";
|
||||||
|
|
||||||
|
const chapter = {
|
||||||
|
extensionId: 10,
|
||||||
|
novelUrl,
|
||||||
|
chapterUrl,
|
||||||
|
chapterName,
|
||||||
|
chapterText,
|
||||||
|
nextChapter,
|
||||||
|
prevChapter,
|
||||||
|
};
|
||||||
|
|
||||||
|
res.json(chapter);
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchScraper = async (req, res) => {
|
||||||
|
const searchTerm = req.query.s;
|
||||||
|
|
||||||
|
const url = `${baseUrl}?s=${searchTerm}&post_type=wp-manga`;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novels = [];
|
||||||
|
|
||||||
|
$(".c-tabs-item__content").each(function (result) {
|
||||||
|
const novelName = $(this).find("h4 > a").text();
|
||||||
|
const novelCover = $(this).find("img").attr("src");
|
||||||
|
|
||||||
|
let novelUrl = $(this).find("h4 > a").attr("href");
|
||||||
|
novelUrl = novelUrl.replace(`${baseUrl}vipnovel/`, "");
|
||||||
|
|
||||||
|
const novel = {
|
||||||
|
extensionId: 10,
|
||||||
|
novelName,
|
||||||
|
novelCover,
|
||||||
|
novelUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novels.push(novel);
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json(novels);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = vipNovelScraper = {
|
||||||
|
novelsScraper,
|
||||||
|
novelScraper,
|
||||||
|
chapterScraper,
|
||||||
|
searchScraper,
|
||||||
|
};
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
Reference in New Issue
Block a user