mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix(route): 起点 章节 (#10693)
* fix /qidian/chapter * fix /qidian/chapter * delete gitpod.yml * fix: name parsing Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
This commit is contained in:
@@ -5,15 +5,14 @@ const { parseDate } = require('@/utils/parse-date');
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await got(`https://book.qidian.com/info/${id}/#Catalog`);
|
||||
const response = await got(`https://m.qidian.com/book/${id}.html`);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const name = $('.book-info>h1>em').text();
|
||||
const cover_url = 'https:' + $('#bookImg>img').attr('src');
|
||||
const name = $('.book-detail-info .book-title').text();
|
||||
const cover_url = 'https:' + $('.book-detail-info img').attr('src');
|
||||
|
||||
const csrfToken = response.headers['set-cookie'].find((s) => s.startsWith('_csrfToken=')).split(';')[0];
|
||||
|
||||
const chapters_response = await got(`https://book.qidian.com/ajax/book/category?${csrfToken}&bookId=${id}`);
|
||||
const csrfToken = await got(`https://m.qidian.com/book/${id}/catalog/`).then((res) => res.headers['set-cookie'].join('').match(/_csrfToken=(\S*);/)[0]);
|
||||
const chapters_response = await got(`https://m.qidian.com/majax/book/category?${csrfToken}&bookId=${id}`);
|
||||
const chapter_item = [];
|
||||
|
||||
for (let i = 0; i < chapters_response.data.data.vs.length; i++) {
|
||||
@@ -31,7 +30,7 @@ module.exports = async (ctx) => {
|
||||
ctx.state.data = {
|
||||
title: `起点 ${name}`,
|
||||
link: `https://book.qidian.com/info/${id}`,
|
||||
description: $('.book-info>p.intro').text(),
|
||||
description: $('#bookSummary content').text(),
|
||||
image: cover_url,
|
||||
item: chapter_item,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user