chore: Add Icons
This commit is contained in:
@@ -48,7 +48,7 @@ app.use("/api/35/", require("./src/en/scribblehub/ScribbleHub"));
|
|||||||
app.use("/api/37/", require("./src/en/lnmtl/LNMTL"));
|
app.use("/api/37/", require("./src/en/lnmtl/LNMTL"));
|
||||||
app.use("/api/48/", require("./src/en/wuxiablog/WuxiaBlog"));
|
app.use("/api/48/", require("./src/en/wuxiablog/WuxiaBlog"));
|
||||||
app.use("/api/49/", require("./src/en/wuxiacity/WuxiaCity"));
|
app.use("/api/49/", require("./src/en/wuxiacity/WuxiaCity"));
|
||||||
app.use("/api/76/", require("./src/en/wnmtl/WNMTL"));
|
app.use("/api/77/", require("./src/en/wnmtl/WNMTL"));
|
||||||
|
|
||||||
// Spanish
|
// Spanish
|
||||||
app.use("/api/23/", require("./src/es/tunovelaligera/Tunovelaligera"));
|
app.use("/api/23/", require("./src/es/tunovelaligera/Tunovelaligera"));
|
||||||
@@ -66,6 +66,9 @@ app.use("/api/36", require("./src/jp/syosetu/Syosetu"));
|
|||||||
// Chinese
|
// Chinese
|
||||||
app.use("/api/50/", require("./src/ch/yushubo/Yushubo"));
|
app.use("/api/50/", require("./src/ch/yushubo/Yushubo"));
|
||||||
|
|
||||||
|
// French
|
||||||
|
app.use("/api/76/", require("./src/fr/noveldeglace/NovelDeGlace"));
|
||||||
|
|
||||||
// MultiSrc
|
// MultiSrc
|
||||||
app.use("/api/", require("./multisrc/madara/MadaraGenerator"));
|
app.use("/api/", require("./multisrc/madara/MadaraGenerator"));
|
||||||
app.use("/api/", require("./multisrc/wpmangastream/WPMangaStreamGenerator"));
|
app.use("/api/", require("./multisrc/wpmangastream/WPMangaStreamGenerator"));
|
||||||
|
|||||||
@@ -3,44 +3,46 @@ const fetch = require("node-fetch");
|
|||||||
const { htmlToText } = require("html-to-text");
|
const { htmlToText } = require("html-to-text");
|
||||||
const { parseHtml } = require("../../helper");
|
const { parseHtml } = require("../../helper");
|
||||||
|
|
||||||
const baseUrl = "https://noveldeglace.com/";
|
const baseUrl = "https://www.wnmtl.org/";
|
||||||
|
|
||||||
const sourceName = "Novel De Glace";
|
const sourceName = "WNMTL";
|
||||||
const sourceId = 76;
|
const sourceId = 77;
|
||||||
|
|
||||||
const novelsScraper = async (req, res) => {
|
const novelsScraper = async (req, res) => {
|
||||||
let url = baseUrl + "roman";
|
let url = baseUrl + "explore";
|
||||||
|
|
||||||
console.log(url);
|
console.log(url);
|
||||||
|
|
||||||
const result = await fetch(url);
|
const result = await fetch(
|
||||||
|
"https://www.wnmtl.org/book/2308-warlock-apprentice"
|
||||||
|
);
|
||||||
const body = await result.text();
|
const body = await result.text();
|
||||||
|
|
||||||
$ = cheerio.load(body);
|
// $ = cheerio.load(body);
|
||||||
|
|
||||||
let novels = [];
|
// let novels = [];
|
||||||
|
|
||||||
$("article").each(function () {
|
// $(".card").each(function () {
|
||||||
const novelName = $(this).find("h2").text().trim();
|
// const novelName = $(this).find(".book-name").text();
|
||||||
const novelCover = $(this).find("img").attr("src");
|
// const novelCover = $(this).find("img").attr("src");
|
||||||
const novelUrl = $(this).find("h2 > a").attr("href");
|
// const novelUrl = $(this).find("a").attr("href");
|
||||||
|
|
||||||
const novel = {
|
// const novel = {
|
||||||
sourceId,
|
// sourceId,
|
||||||
novelName,
|
// novelName,
|
||||||
novelCover,
|
// novelCover,
|
||||||
novelUrl,
|
// novelUrl,
|
||||||
};
|
// };
|
||||||
|
|
||||||
novels.push(novel);
|
// novels.push(novel);
|
||||||
});
|
// });
|
||||||
|
|
||||||
res.json(novels);
|
res.json({ novels: body });
|
||||||
};
|
};
|
||||||
|
|
||||||
const novelScraper = async (req, res) => {
|
const novelScraper = async (req, res) => {
|
||||||
const novelUrl = req.params.novelUrl;
|
const novelUrl = req.params.novelUrl;
|
||||||
const url = baseUrl + "novel/" + novelUrl;
|
const url = novelUrl;
|
||||||
|
|
||||||
const result = await fetch(url);
|
const result = await fetch(url);
|
||||||
const body = await result.text();
|
const body = await result.text();
|
||||||
@@ -49,14 +51,7 @@ const novelScraper = async (req, res) => {
|
|||||||
|
|
||||||
let novel = { sourceId, sourceName, url, novelUrl };
|
let novel = { sourceId, sourceName, url, novelUrl };
|
||||||
|
|
||||||
function getNovelName(y) {
|
novel.novelName = $("#thumbnail > img").text();
|
||||||
return y
|
|
||||||
.replace("-", " ")
|
|
||||||
.replace(/(?:^|\s)\S/g, (a) => a.toUpperCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
novelName = getNovelName(novelUrl);
|
|
||||||
novel.novelName = novelName;
|
|
||||||
|
|
||||||
novel.novelCover = $("#thumbnail > img").attr("src");
|
novel.novelCover = $("#thumbnail > img").attr("src");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
const express = require("express");
|
||||||
|
const NovelDeGlaceScraper = require("./NovelDeGlaceScraper");
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.get("/novels/", NovelDeGlaceScraper.novelsScraper);
|
||||||
|
|
||||||
|
router.get("/novel/:novelUrl", NovelDeGlaceScraper.novelScraper);
|
||||||
|
|
||||||
|
router.get("/novel/:novelUrl/:chapterUrl", NovelDeGlaceScraper.chapterScraper);
|
||||||
|
|
||||||
|
router.get("/search/", NovelDeGlaceScraper.searchScraper);
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
const cheerio = require("cheerio");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
const { htmlToText } = require("html-to-text");
|
||||||
|
const { parseHtml } = require("../../helper");
|
||||||
|
|
||||||
|
const baseUrl = "https://noveldeglace.com/";
|
||||||
|
|
||||||
|
const sourceName = "Novel De Glace";
|
||||||
|
const sourceId = 76;
|
||||||
|
|
||||||
|
const novelsScraper = async (req, res) => {
|
||||||
|
let url = baseUrl + "roman";
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novels = [];
|
||||||
|
|
||||||
|
$("article").each(function () {
|
||||||
|
const novelName = $(this).find("h2").text().trim();
|
||||||
|
const novelCover = $(this).find("img").attr("src");
|
||||||
|
const novelUrl = $(this).find("h2 > a").attr("href").split("/")[4];
|
||||||
|
|
||||||
|
const novel = {
|
||||||
|
sourceId,
|
||||||
|
novelName,
|
||||||
|
novelCover,
|
||||||
|
novelUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novels.push(novel);
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json(novels);
|
||||||
|
};
|
||||||
|
|
||||||
|
const novelScraper = async (req, res) => {
|
||||||
|
const novelUrl = req.params.novelUrl;
|
||||||
|
const url = baseUrl + "roman/" + novelUrl;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novel = { sourceId, sourceName, url, novelUrl };
|
||||||
|
|
||||||
|
novel.novelName = $(
|
||||||
|
"div.entry-content > div > strong"
|
||||||
|
)[0].nextSibling.nodeValue.trim();
|
||||||
|
|
||||||
|
novel.novelCover = $("#thumbnail > img").attr("src");
|
||||||
|
|
||||||
|
novel.novelSummary = $("div[data-title=Synopsis]").text();
|
||||||
|
novel.author = $(
|
||||||
|
"div.romans > div.project-large > div.su-row > div.su-column.su-column-size-3-4 > div > div:nth-child(3) > strong"
|
||||||
|
)[0].nextSibling.nodeValue.trim();
|
||||||
|
|
||||||
|
novel.genre = $(".genre")
|
||||||
|
.text()
|
||||||
|
.replace("Genre : ", "")
|
||||||
|
.replace(/, /g, ",");
|
||||||
|
|
||||||
|
let novelChapters = [];
|
||||||
|
|
||||||
|
$(".chpt").each(function () {
|
||||||
|
const chapterName = $(this).find("a").text().trim();
|
||||||
|
const releaseDate = null;
|
||||||
|
const chapterUrl = $(this).find("a").attr("href").split("/")[4];
|
||||||
|
|
||||||
|
const novel = {
|
||||||
|
sourceId,
|
||||||
|
chapterName,
|
||||||
|
releaseDate,
|
||||||
|
chapterUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novelChapters.push(novel);
|
||||||
|
});
|
||||||
|
|
||||||
|
novel.novelChapters = novelChapters;
|
||||||
|
|
||||||
|
res.json(novel);
|
||||||
|
};
|
||||||
|
|
||||||
|
const chapterScraper = async (req, res) => {
|
||||||
|
let novelUrl = req.params.novelUrl;
|
||||||
|
let chapterUrl = req.params.chapterUrl;
|
||||||
|
|
||||||
|
const url = `${baseUrl}chapitre/${chapterUrl}`;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let chapterName = $("h2.western").text();
|
||||||
|
|
||||||
|
let chapterText = $(".chapter-content").html();
|
||||||
|
chapterText = parseHtml(chapterText);
|
||||||
|
|
||||||
|
let nextChapter = null;
|
||||||
|
|
||||||
|
let prevChapter = null;
|
||||||
|
|
||||||
|
novelUrl = novelUrl + "/";
|
||||||
|
chapterUrl = chapterUrl + "/";
|
||||||
|
|
||||||
|
const chapter = {
|
||||||
|
sourceId,
|
||||||
|
novelUrl,
|
||||||
|
chapterUrl,
|
||||||
|
chapterName,
|
||||||
|
chapterText,
|
||||||
|
nextChapter,
|
||||||
|
prevChapter,
|
||||||
|
};
|
||||||
|
|
||||||
|
res.json(chapter);
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchScraper = async (req, res) => {
|
||||||
|
const searchTerm = req.query.s;
|
||||||
|
|
||||||
|
let url = baseUrl + "roman";
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novels = [];
|
||||||
|
|
||||||
|
$("article").each(function () {
|
||||||
|
const novelName = $(this).find("h2").text().trim();
|
||||||
|
const novelCover = $(this).find("img").attr("src");
|
||||||
|
const novelUrl = $(this).find("h2 > a").attr("href").split("/")[4];
|
||||||
|
|
||||||
|
const novel = {
|
||||||
|
sourceId,
|
||||||
|
novelName,
|
||||||
|
novelCover,
|
||||||
|
novelUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novels.push(novel);
|
||||||
|
});
|
||||||
|
|
||||||
|
novels = novels.filter((novel) =>
|
||||||
|
novel.novelName.toLowerCase().includes(searchTerm)
|
||||||
|
);
|
||||||
|
|
||||||
|
res.json(novels);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = NovelDeGlaceScraper = {
|
||||||
|
novelsScraper,
|
||||||
|
novelScraper,
|
||||||
|
chapterScraper,
|
||||||
|
searchScraper,
|
||||||
|
};
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 366 KiB |
Reference in New Issue
Block a user