updated marketplace and extensions
This commit is contained in:
@@ -3,7 +3,7 @@ class NovelFire {
|
||||
this.baseUrl = "https://novelfire.net";
|
||||
this.type = "book-board";
|
||||
this.mediaType = "ln";
|
||||
this.version = "1.0"
|
||||
this.version = "1.1"
|
||||
}
|
||||
|
||||
async search(queryObj) {
|
||||
@@ -71,18 +71,21 @@ class NovelFire {
|
||||
}
|
||||
|
||||
async findChapters(bookId) {
|
||||
const url = `https://novelfire.net/book/${bookId}/chapters`;
|
||||
const html = await (await fetch(url)).text();
|
||||
|
||||
const chapterUrl = `https://novelfire.net/book/${bookId}/chapter-1`;
|
||||
const html = await (await fetch(chapterUrl)).text();
|
||||
const $ = this.cheerio.load(html);
|
||||
let postId;
|
||||
|
||||
// csrf token
|
||||
const csrf = $('meta[name="csrf-token"]').attr('content');
|
||||
if (!csrf) throw new Error("csrf-token not found");
|
||||
|
||||
// post_id desde script
|
||||
let postId;
|
||||
$("script").each((_, el) => {
|
||||
const txt = $(el).html() || "";
|
||||
const m = txt.match(/listChapterDataAjax\?post_id=(\d+)/);
|
||||
const m = txt.match(/post_id\s*=\s*parseInt\("(\d+)"\)/);
|
||||
if (m) postId = m[1];
|
||||
});
|
||||
|
||||
if (!postId) throw new Error("post_id not found");
|
||||
|
||||
const params = new URLSearchParams({
|
||||
@@ -100,7 +103,13 @@ class NovelFire {
|
||||
|
||||
const res = await fetch(
|
||||
`https://novelfire.net/listChapterDataAjax?${params}`,
|
||||
{ headers: { "x-requested-with": "XMLHttpRequest" } }
|
||||
{
|
||||
headers: {
|
||||
"x-requested-with": "XMLHttpRequest",
|
||||
"x-csrf-token": csrf,
|
||||
"referer": chapterUrl
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const json = await res.json();
|
||||
|
||||
Reference in New Issue
Block a user