TapRead: fix chapterUrl
This commit is contained in:
@@ -15,7 +15,7 @@ const novelsScraper = async (req, res) => {
|
|||||||
|
|
||||||
$(".section-item").each(function (result) {
|
$(".section-item").each(function (result) {
|
||||||
const novelName = $(this).find(".book-name").text();
|
const novelName = $(this).find(".book-name").text();
|
||||||
const novelCover = $(this).find("img").attr("src");
|
const novelCover = "http:" + $(this).find("img").attr("src");
|
||||||
let novelUrl = $(this).attr("data-id");
|
let novelUrl = $(this).attr("data-id");
|
||||||
novelUrl += "/";
|
novelUrl += "/";
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ const novelScraper = async (req, res) => {
|
|||||||
|
|
||||||
novel.novelName = $(".book-name").text();
|
novel.novelName = $(".book-name").text();
|
||||||
|
|
||||||
novel.novelCover = $("div.book-img > img").attr("src");
|
novel.novelCover = "http:" + $("div.book-img > img").attr("src");
|
||||||
|
|
||||||
novel["Genre(s)"] = $("div.book-catalog > span.txt").text();
|
novel["Genre(s)"] = $("div.book-catalog > span.txt").text();
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ const novelScraper = async (req, res) => {
|
|||||||
chapters.result.chapterList.map((chapter) => {
|
chapters.result.chapterList.map((chapter) => {
|
||||||
let chapterName = chapter.chapterName;
|
let chapterName = chapter.chapterName;
|
||||||
const releaseDate = chapter.pubTime;
|
const releaseDate = chapter.pubTime;
|
||||||
const chapterUrl = chapter.chapterId;
|
const chapterUrl = chapter.chapterId.toString();
|
||||||
|
|
||||||
if (chapter.lock) {
|
if (chapter.lock) {
|
||||||
chapterName = "🔒 " + chapterName;
|
chapterName = "🔒 " + chapterName;
|
||||||
@@ -121,8 +121,11 @@ const chapterScraper = async (req, res) => {
|
|||||||
|
|
||||||
const chapterName = body.result.chapterName;
|
const chapterName = body.result.chapterName;
|
||||||
const chapterText = htmlToText(body.result.content);
|
const chapterText = htmlToText(body.result.content);
|
||||||
const nextChapter = body.result.nextChapterId;
|
const nextChapter =
|
||||||
const prevChapter = body.result.preChapterId;
|
body.result.nextChapterId === 0
|
||||||
|
? null
|
||||||
|
: body.result.nextChapterId.toString();
|
||||||
|
const prevChapter = body.result.preChapterId.toString();
|
||||||
novelUrl += "/";
|
novelUrl += "/";
|
||||||
|
|
||||||
const chapter = {
|
const chapter = {
|
||||||
@@ -155,8 +158,6 @@ const searchScraper = async (req, res) => {
|
|||||||
|
|
||||||
const body = await data.json();
|
const body = await data.json();
|
||||||
|
|
||||||
console.log(body.result.storyList);
|
|
||||||
|
|
||||||
const novels = [];
|
const novels = [];
|
||||||
|
|
||||||
body.result.storyList.map((novel) => {
|
body.result.storyList.map((novel) => {
|
||||||
@@ -165,7 +166,7 @@ const searchScraper = async (req, res) => {
|
|||||||
""
|
""
|
||||||
);
|
);
|
||||||
const novelUrl = novel.storyId + "/";
|
const novelUrl = novel.storyId + "/";
|
||||||
const novelCover = novel.coverUrl;
|
const novelCover = "http://static.tapread.com" + novel.coverUrl;
|
||||||
|
|
||||||
novels.push({ extensionId: 17, novelName, novelCover, novelUrl });
|
novels.push({ extensionId: 17, novelName, novelCover, novelUrl });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user