committed by
GitHub
parent
934184a5d3
commit
752e4d9baa
@@ -4,31 +4,32 @@ Sources for [LNReader](https://github.com/rajarsheechatterjee/lnreader)
|
|||||||
|
|
||||||
## Sources
|
## Sources
|
||||||
|
|
||||||
| Source | Status |
|
| Source | Status |
|
||||||
| ---------------------------- | :----------------: |
|
| ----------------------------- | :----------------: |
|
||||||
| BoxNovel | :heavy_check_mark: |
|
| BoxNovel | :heavy_check_mark: |
|
||||||
| ReadLightNovel | :heavy_check_mark: |
|
| ReadLightNovel | :heavy_check_mark: |
|
||||||
| FastNovel | :x: |
|
| FastNovel | :x: |
|
||||||
| ReadNovelFull | :heavy_check_mark: |
|
| ReadNovelFull | :heavy_check_mark: |
|
||||||
| MTLNovel | :heavy_check_mark: |
|
| MTLNovel | :heavy_check_mark: |
|
||||||
| NovelHall | :heavy_check_mark: |
|
| NovelHall | :heavy_check_mark: |
|
||||||
| WuxiaWorld | :heavy_check_mark: |
|
| WuxiaWorld | :heavy_check_mark: |
|
||||||
| NovelFull | :heavy_check_mark: |
|
| NovelFull | :heavy_check_mark: |
|
||||||
| NovelTrench | :heavy_check_mark: |
|
| NovelTrench | :heavy_check_mark: |
|
||||||
| VipNovel | :heavy_check_mark: |
|
| VipNovel | :heavy_check_mark: |
|
||||||
| KissLightNovels | :heavy_check_mark: |
|
| KissLightNovels | :heavy_check_mark: |
|
||||||
| https://wuxiaworldsite.co/ | :heavy_check_mark: |
|
| https://wuxiaworldsite.co/ | :heavy_check_mark: |
|
||||||
| FreeWebNovel | :heavy_check_mark: |
|
| FreeWebNovel | :heavy_check_mark: |
|
||||||
| JPMTL | :heavy_check_mark: |
|
| JPMTL | :heavy_check_mark: |
|
||||||
| LightNovelPub | :heavy_check_mark: |
|
| LightNovelPub | :heavy_check_mark: |
|
||||||
| https://www.wuxiaworld.co/ | :heavy_check_mark: |
|
| https://www.wuxiaworld.co/ | :heavy_check_mark: |
|
||||||
| TapRead | :heavy_check_mark: |
|
| TapRead | :heavy_check_mark: |
|
||||||
| https://www.novelupdates.cc/ | :heavy_check_mark: |
|
| https://www.novelupdates.cc/ | :heavy_check_mark: |
|
||||||
| https://m.readlightnovel.cc/ | :heavy_check_mark: |
|
| https://m.readlightnovel.cc/ | :heavy_check_mark: |
|
||||||
| http://wuxiaworld.cloud/ | :heavy_check_mark: |
|
| http://wuxiaworld.cloud/ | :heavy_check_mark: |
|
||||||
| https://foxaholic.com/ | :heavy_check_mark: |
|
| https://foxaholic.com/ | :heavy_check_mark: |
|
||||||
| https://tunovelaligera.com/ | :heavy_check_mark: |
|
| https://tunovelaligera.com/ | :heavy_check_mark: |
|
||||||
| https://www.skynovels.net/ | :heavy_check_mark: |
|
| https://www.skynovels.net/ | :heavy_check_mark: |
|
||||||
|
| https://einherjarproject.net/ | :heavy_check_mark: |
|
||||||
|
|
||||||
## Setup locally
|
## Setup locally
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ app.use("/api/22/", require("./src/en/foxaholic/Foxaholic"));
|
|||||||
// Spanish
|
// Spanish
|
||||||
app.use("/api/23/", require("./src/es/tunovelaligera/Tunovelaligera"));
|
app.use("/api/23/", require("./src/es/tunovelaligera/Tunovelaligera"));
|
||||||
app.use("/api/24/", require("./src/es/skynovels/Skynovels"));
|
app.use("/api/24/", require("./src/es/skynovels/Skynovels"));
|
||||||
|
app.use("/api/25/", require("./src/es/einherjarproject/EinherjarProject"));
|
||||||
|
|
||||||
const PORT = process.env.PORT || 5000;
|
const PORT = process.env.PORT || 5000;
|
||||||
|
|
||||||
|
|||||||
@@ -215,6 +215,15 @@ extensions = [
|
|||||||
sourceLanguage: "Spanish",
|
sourceLanguage: "Spanish",
|
||||||
status: 1,
|
status: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
sourceId: 25,
|
||||||
|
sourceUrl: "https://einherjarproject.net/",
|
||||||
|
sourceName: "EinherjarProject",
|
||||||
|
sourceCover:
|
||||||
|
"https://github.com/rajarsheechatterjee/lnreader-extensions/blob/main/src/es/einherjarproject/icon.png?raw=true",
|
||||||
|
sourceLanguage: "Spanish",
|
||||||
|
status: 1,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = extensions;
|
module.exports = extensions;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
const express = require("express");
|
||||||
|
const einherjarProjectScraper = require("./EinherjarProjectScraper");
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.get("/novels/", einherjarProjectScraper.novelsScraper);
|
||||||
|
|
||||||
|
router.get("/novel/:novelUrl", einherjarProjectScraper.novelScraper);
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
"/novel/:novelUrl/:chapterUrl",
|
||||||
|
einherjarProjectScraper.chapterScraper
|
||||||
|
);
|
||||||
|
|
||||||
|
router.get("/search/", einherjarProjectScraper.searchScraper);
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
const cheerio = require("cheerio");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
const { htmlToText } = require("html-to-text");
|
||||||
|
const { parseHtml } = require("../../helper");
|
||||||
|
|
||||||
|
const baseUrl = "https://einherjarproject.net/";
|
||||||
|
|
||||||
|
const novelsScraper = async (req, res) => {
|
||||||
|
let url = baseUrl + "proyectos-activos/";
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novels = [];
|
||||||
|
|
||||||
|
$(".wp-block-media-text").each(function (result) {
|
||||||
|
const novelName = $(this).find("a").text();
|
||||||
|
const novelCover = $(this).find("img").attr("src");
|
||||||
|
|
||||||
|
let novelUrl = $(this)
|
||||||
|
.find(".wp-block-media-text__content")
|
||||||
|
.find("a")
|
||||||
|
.attr("href");
|
||||||
|
novelUrl = novelUrl.replace(baseUrl, "");
|
||||||
|
|
||||||
|
const novel = {
|
||||||
|
extensionId: 25,
|
||||||
|
novelName,
|
||||||
|
novelCover,
|
||||||
|
novelUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novels.push(novel);
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json(novels);
|
||||||
|
};
|
||||||
|
|
||||||
|
const novelScraper = async (req, res) => {
|
||||||
|
const novelUrl = req.params.novelUrl;
|
||||||
|
const url = baseUrl + novelUrl;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novel = {};
|
||||||
|
|
||||||
|
novel.extensionId = 25;
|
||||||
|
|
||||||
|
novel.sourceName = "Einherjar Project";
|
||||||
|
|
||||||
|
novel.sourceUrl = url;
|
||||||
|
|
||||||
|
novel.novelUrl = novelUrl + "/";
|
||||||
|
|
||||||
|
novel.novelName = $("h1").text();
|
||||||
|
|
||||||
|
novel.novelCover = $("img").attr("src");
|
||||||
|
|
||||||
|
$(".wp-block-columns")
|
||||||
|
.find("li")
|
||||||
|
.each(function (result) {
|
||||||
|
if ($(this).text().includes("Autor:")) {
|
||||||
|
novel["Author(s)"] = $(this)
|
||||||
|
.text()
|
||||||
|
.replace("Autor:", "")
|
||||||
|
.slice(0, -1);
|
||||||
|
}
|
||||||
|
if ($(this).text().includes("Ilustrador: ")) {
|
||||||
|
novel["Artist(s)"] = $(this)
|
||||||
|
.text()
|
||||||
|
.replace("Ilustrador: ", "")
|
||||||
|
.slice(0, -1);
|
||||||
|
}
|
||||||
|
if ($(this).text().includes("Estado: ")) {
|
||||||
|
novel.Status = $(this)
|
||||||
|
.text()
|
||||||
|
.replace("Estado: ", "")
|
||||||
|
.slice(0, -1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let novelSummary = $(".post-content > .has-text-align-center").html();
|
||||||
|
|
||||||
|
novel.novelSummary = htmlToText(novelSummary);
|
||||||
|
|
||||||
|
let novelChapters = [];
|
||||||
|
|
||||||
|
$(".wp-block-media-text")
|
||||||
|
.find("p")
|
||||||
|
.each(function (result) {
|
||||||
|
if ($(this).find("a").text()) {
|
||||||
|
const chapterName = $(this).text();
|
||||||
|
const releaseDate = null;
|
||||||
|
const chapterUrl = $(this)
|
||||||
|
.find("a")
|
||||||
|
.attr("href")
|
||||||
|
.replace(baseUrl, "");
|
||||||
|
|
||||||
|
const chapter = { chapterName, releaseDate, chapterUrl };
|
||||||
|
|
||||||
|
novelChapters.push(chapter);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
novel.novelChapters = novelChapters;
|
||||||
|
|
||||||
|
res.json(novel);
|
||||||
|
};
|
||||||
|
|
||||||
|
const chapterScraper = async (req, res) => {
|
||||||
|
let novelUrl = req.params.novelUrl;
|
||||||
|
let chapterUrl = req.params.chapterUrl;
|
||||||
|
|
||||||
|
const url = baseUrl + chapterUrl;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let chapterName = $("h1.post-title").text();
|
||||||
|
|
||||||
|
let chapterText = $(".post-content").html();
|
||||||
|
chapterText = htmlToText(chapterText, { preserveNewlines: true });
|
||||||
|
|
||||||
|
let nextChapter = null;
|
||||||
|
let prevChapter = null;
|
||||||
|
|
||||||
|
novelUrl = novelUrl + "/";
|
||||||
|
chapterUrl = chapterUrl + "/";
|
||||||
|
|
||||||
|
const chapter = {
|
||||||
|
extensionId: 25,
|
||||||
|
novelUrl,
|
||||||
|
chapterUrl,
|
||||||
|
chapterName,
|
||||||
|
chapterText,
|
||||||
|
nextChapter,
|
||||||
|
prevChapter,
|
||||||
|
};
|
||||||
|
|
||||||
|
res.json(chapter);
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchScraper = async (req, res) => {
|
||||||
|
const searchTerm = req.query.s;
|
||||||
|
|
||||||
|
const url = baseUrl + "?s=" + searchTerm;
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novels = [];
|
||||||
|
|
||||||
|
$(".post-container")
|
||||||
|
.find("div.type-page")
|
||||||
|
.each(function (result) {
|
||||||
|
const novelName = $(this)
|
||||||
|
.find(".post-header")
|
||||||
|
.text()
|
||||||
|
.replace(/\n/g, "");
|
||||||
|
if (
|
||||||
|
!novelName.includes("EPUBs") &&
|
||||||
|
!novelName.includes("Proyectos Activos") &&
|
||||||
|
!novelName.includes("Chapter")
|
||||||
|
) {
|
||||||
|
const novelCover = $(this).find("img").attr("src");
|
||||||
|
|
||||||
|
let novelUrl = $(this)
|
||||||
|
.find("a")
|
||||||
|
.attr("href")
|
||||||
|
.replace(baseUrl, "");
|
||||||
|
|
||||||
|
const novel = {
|
||||||
|
extensionId: 25,
|
||||||
|
novelName,
|
||||||
|
novelCover,
|
||||||
|
novelUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novels.push(novel);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json(novels);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = einharjarProjectScraper = {
|
||||||
|
novelsScraper,
|
||||||
|
novelScraper,
|
||||||
|
chapterScraper,
|
||||||
|
searchScraper,
|
||||||
|
};
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
Reference in New Issue
Block a user