Update: pawread domain (#826)

This commit is contained in:
K1ngfish3r
2024-03-14 01:35:12 +08:00
committed by GitHub
parent 05e80588a0
commit 089a3f330e
+23 -21
View File
@@ -6,17 +6,18 @@ import { Filters, FilterTypes } from "@libs/filterInputs";
class PawRead implements Plugin.PluginBase { class PawRead implements Plugin.PluginBase {
id = "pawread"; id = "pawread";
name = "PawRead"; name = "PawRead";
version = "1.0.0"; version = "1.1.0";
icon = "src/en/pawread/icon.png"; icon = "src/en/pawread/icon.png";
site = "https://www.pawread.com/"; site = "https://m.pawread.com/";
parseNovels(loadedCheerio:CheerioAPI){ parseNovels(loadedCheerio:CheerioAPI){
const novels: Plugin.NovelItem[] = []; const novels: Plugin.NovelItem[] = [];
loadedCheerio(".list-comic").each((idx, ele) => { loadedCheerio(".list-comic, .itemBox").each((idx, ele) => {
const novelName = loadedCheerio(ele).find('h3').text(); loadedCheerio(ele).find('.serialise').remove();
const novelName = loadedCheerio(ele).find('a').text();
const novelCover = loadedCheerio(ele).find('img').attr('src'); const novelCover = loadedCheerio(ele).find('img').attr('src');
const novelUrl = loadedCheerio(ele).find('h3 a').attr('href')?.slice(1); const novelUrl = loadedCheerio(ele).find('a').attr('href')?.slice(1);
if (!novelUrl) return; if (!novelUrl) return;
@@ -68,33 +69,32 @@ class PawRead implements Plugin.PluginBase {
const novel: Plugin.SourceNovel = { const novel: Plugin.SourceNovel = {
path: novelPath, path: novelPath,
name: loadedCheerio(".col-md-9 h1").text() || "Untitled", name: loadedCheerio("#Cover img").attr('title') || "Untitled",
summary: loadedCheerio("#simple-des").text().trim(), cover: loadedCheerio("#Cover img").attr('src'),
status: loadedCheerio('h4 span').text(), author: loadedCheerio('.icon01 <').text().trim(),
status: loadedCheerio('.txtItme:first').text().trim(),
chapters: [], chapters: [],
}; };
novel.cover = loadedCheerio('#tab1_board .col-md-3 div') novel.summary = loadedCheerio("#full-des")
.attr('style') .find('br')
?.match(/url\((.*?)\)/i)![1]; .replaceWith('\n')
.end()
novel.author = loadedCheerio('.glyphicon-user:first')
.next()
.text() .text()
.replace("Author: ", ""); .trim();
novel.genres = loadedCheerio('a.btn-default') novel.genres = loadedCheerio('a.btn-default')
.map((i, el) => loadedCheerio(el).text()) .map((i, el) => loadedCheerio(el).text().trim())
.toArray() .toArray()
.join(","); .join(",");
const chapter: Plugin.ChapterItem[] = []; const chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".col-md-10").each((idx, ele) => { loadedCheerio(".item-box").each((idx, ele) => {
const releaseDate = loadedCheerio(ele).find('small').text().trim(); const releaseDate = loadedCheerio(ele).find('span:last').text().trim();
if (releaseDate === "Advanced Chapter") return; if (releaseDate === "Advanced Chapter") return;
const chapterName = loadedCheerio(ele).find("span").text().trim(); const chapterName = loadedCheerio(ele).find("span:first").text().trim();
const chapterUrl = loadedCheerio(ele).parent().attr("onclick")?.match(/\d+/); const chapterUrl = loadedCheerio(ele).attr("onclick")?.match(/\d+/);
if (!chapterUrl) return; if (!chapterUrl) return;
chapter.push({ chapter.push({
@@ -115,7 +115,9 @@ class PawRead implements Plugin.PluginBase {
const loadedCheerio = parseHTML(body); const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio("#chapter_item").html() || ''; const steal = ['bit.ly', 'tinyurl', 'pawread'];
steal.map(tag => loadedCheerio(`p:icontains(${tag})`).remove());
const chapterText = loadedCheerio('.main').html() || "";
return chapterText; return chapterText;
} }