Add SkyNovels
This commit is contained in:
@@ -28,6 +28,7 @@ Sources for [LNReader](https://github.com/rajarsheechatterjee/lnreader)
|
|||||||
| 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: |
|
||||||
|
|
||||||
## Setup locally
|
## Setup locally
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,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"));
|
||||||
|
|
||||||
const PORT = process.env.PORT || 5000;
|
const PORT = process.env.PORT || 5000;
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,15 @@ extensions = [
|
|||||||
sourceLanguage: "Spanish",
|
sourceLanguage: "Spanish",
|
||||||
status: 1,
|
status: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
sourceId: 24,
|
||||||
|
sourceUrl: "https://www.skynovels.net/",
|
||||||
|
sourceName: "SkyNovels",
|
||||||
|
sourceCover:
|
||||||
|
"https://github.com/rajarsheechatterjee/lnreader-extensions/blob/main/src/es/skynovels/icon.png?raw=true",
|
||||||
|
sourceLanguage: "Spanish",
|
||||||
|
status: 1,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = extensions;
|
module.exports = extensions;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
const express = require("express");
|
||||||
|
const skynovelsScraper = require("./SkynovelsScraper");
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.get("/novels/", skynovelsScraper.novelsScraper);
|
||||||
|
|
||||||
|
router.get("/novel/:novelId/:novelUrl/", skynovelsScraper.novelScraper);
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
"/novel/:novelId/:novelUrl/:chapterId/:chapterUrl",
|
||||||
|
skynovelsScraper.chapterScraper
|
||||||
|
);
|
||||||
|
|
||||||
|
router.get("/search/", skynovelsScraper.searchScraper);
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
const cheerio = require("cheerio");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
const { htmlToText } = require("html-to-text");
|
||||||
|
const { parseHtml } = require("../../helper");
|
||||||
|
|
||||||
|
const baseUrl = "https://www.skynovels.net/";
|
||||||
|
|
||||||
|
const novelsScraper = async (req, res) => {
|
||||||
|
let url = baseUrl + "novelas";
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
|
let novels = [];
|
||||||
|
|
||||||
|
$(".skn-nvl-card").each(function (result) {
|
||||||
|
const novelName = $(this).find(".skn-nvl-card-title").text();
|
||||||
|
const novelCover = $(this).find("img").attr("src");
|
||||||
|
|
||||||
|
let novelUrl = $(this).attr("href").split("/");
|
||||||
|
novelUrl = novelUrl[2] + "/" + novelUrl[3] + "/";
|
||||||
|
|
||||||
|
const novel = {
|
||||||
|
extensionId: 24,
|
||||||
|
novelName,
|
||||||
|
novelCover,
|
||||||
|
novelUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novels.push(novel);
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json(novels);
|
||||||
|
};
|
||||||
|
|
||||||
|
const novelScraper = async (req, res) => {
|
||||||
|
const novelId = req.params.novelId;
|
||||||
|
const novelUrl = req.params.novelUrl;
|
||||||
|
const url =
|
||||||
|
"https://api.skynovels.net/api/novel/" + novelId + "/reading?&q";
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.json();
|
||||||
|
|
||||||
|
const item = body.novel[0];
|
||||||
|
|
||||||
|
let novel = {};
|
||||||
|
|
||||||
|
novel.extensionId = 24;
|
||||||
|
|
||||||
|
novel.sourceName = "SkyNovels";
|
||||||
|
|
||||||
|
novel.sourceUrl = baseUrl + "novelas/" + novelId + "/" + novelUrl;
|
||||||
|
|
||||||
|
novel.novelUrl = novelId + "/" + novelUrl + "/";
|
||||||
|
|
||||||
|
novel.novelName = item.nvl_title;
|
||||||
|
|
||||||
|
novel.novelCover =
|
||||||
|
"https://api.skynovels.net/api/get-image/" +
|
||||||
|
item.image +
|
||||||
|
"/novels/false";
|
||||||
|
|
||||||
|
let genres = [];
|
||||||
|
item.genres.map((genre) => genres.push(genre.genre_name));
|
||||||
|
novel["Genre(s)"] = genres.join(",");
|
||||||
|
novel["Author(s)"] = item.nvl_writer;
|
||||||
|
novel.novelSummary = 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 = chapter.id + "/" + chapter.chp_name;
|
||||||
|
|
||||||
|
const chap = { chapterName, releaseDate, chapterUrl };
|
||||||
|
|
||||||
|
novelChapters.push(chap);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
novel.novelChapters = novelChapters;
|
||||||
|
|
||||||
|
res.json(novel);
|
||||||
|
};
|
||||||
|
|
||||||
|
const chapterScraper = async (req, res) => {
|
||||||
|
let novelId = req.params.novelId;
|
||||||
|
let novelUrl = req.params.novelUrl;
|
||||||
|
let chapterId = req.params.chapterId;
|
||||||
|
let chapterUrl = req.params.chapterUrl;
|
||||||
|
|
||||||
|
const url = `https://api.skynovels.net/api/novel-chapter/${chapterId}`;
|
||||||
|
|
||||||
|
console.log(url);
|
||||||
|
|
||||||
|
const result = await fetch(url);
|
||||||
|
const body = await result.json();
|
||||||
|
|
||||||
|
const item = body.chapter[0];
|
||||||
|
|
||||||
|
let chapterName = item.chp_index_title;
|
||||||
|
|
||||||
|
let chapterText = item.chp_title + "\n\n" + item.chp_content;
|
||||||
|
|
||||||
|
let nextChapter = null;
|
||||||
|
let prevChapter = null;
|
||||||
|
|
||||||
|
novelUrl = novelId + "/" + novelUrl + "/";
|
||||||
|
chapterUrl = item.id + "/" + item.chp_name;
|
||||||
|
|
||||||
|
const chapter = {
|
||||||
|
extensionId: 24,
|
||||||
|
novelUrl,
|
||||||
|
chapterUrl,
|
||||||
|
chapterName,
|
||||||
|
chapterText,
|
||||||
|
nextChapter,
|
||||||
|
prevChapter,
|
||||||
|
};
|
||||||
|
|
||||||
|
res.json(chapter);
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchScraper = async (req, res) => {
|
||||||
|
const searchTerm = req.query.s;
|
||||||
|
|
||||||
|
const url = "https://api.skynovels.net/api/novels?&q";
|
||||||
|
|
||||||
|
const result = await fetch(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 = res.id + "/" + res.nvl_name + "/";
|
||||||
|
|
||||||
|
const novel = { extensionId: 24, novelName, novelUrl, novelCover };
|
||||||
|
|
||||||
|
novels.push(novel);
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json(novels);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = vipNovelScraper = {
|
||||||
|
novelsScraper,
|
||||||
|
novelScraper,
|
||||||
|
chapterScraper,
|
||||||
|
searchScraper,
|
||||||
|
};
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
Reference in New Issue
Block a user