mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
fix(route): qidian chapter (#12850)
* fix(route): qidian chapter * fix: chapter and forum author refs: https://github.com/DIYgod/RSSHub/pull/414 https://github.com/DIYgod/RSSHub/pull/501 https://github.com/DIYgod/RSSHub/pull/732
This commit is contained in:
+2
-2
@@ -444,11 +444,11 @@ count 的取值范围为 1-12,为防止请求次数过多,推荐设置为 5
|
||||
|
||||
### 章节
|
||||
|
||||
<Route author="Chingyat" example="/qidian/chapter/1010400217" path="/qidian/chapter/:id" :paramsDesc="['小说 id, 可在对应小说页 URL 中找到']"/>
|
||||
<Route author="fuzy112" example="/qidian/chapter/1010400217" path="/qidian/chapter/:id" :paramsDesc="['小说 id, 可在对应小说页 URL 中找到']"/>
|
||||
|
||||
### 讨论区
|
||||
|
||||
<Route author="Chingyat" example="/qidian/forum/1010400217" path="/qidian/forum/:id" :paramsDesc="['小说 id, 可在对应小说页 URL 中找到']"/>
|
||||
<Route author="fuzy112" example="/qidian/forum/1010400217" path="/qidian/forum/:id" :paramsDesc="['小说 id, 可在对应小说页 URL 中找到']"/>
|
||||
|
||||
### 限时免费
|
||||
|
||||
|
||||
+3
-3
@@ -1071,9 +1071,9 @@ pageClass: routes
|
||||
|
||||
### 研究生招生网通知公告
|
||||
|
||||
<Route author="Chingyat" example="/seu/yzb/1" path="/seu/yzb/:type" :paramsDesc="['1 为硕士招生,2 为博士招生,3 为港澳台及中外合作办学']"/>
|
||||
<Route author="fuzy112" example="/seu/yzb/1" path="/seu/yzb/:type" :paramsDesc="['1 为硕士招生,2 为博士招生,3 为港澳台及中外合作办学']"/>
|
||||
|
||||
### 东南大学计算机技术与工程学院
|
||||
### 计算机技术与工程学院
|
||||
|
||||
<Route author="LogicJake" example="/seu/cse/xyxw" path="/seu/cse/:type?" :paramsDesc="['分类名(默认为xyxw)']">
|
||||
|
||||
@@ -1738,7 +1738,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
||||
|
||||
### 教务处通知
|
||||
|
||||
<Route author="Chingyat" example="/ju/jwc/all" path="/ju/jwc/:type?" :paramsDesc="['默认为 `all`']">
|
||||
<Route author="fuzy112" example="/ju/jwc/all" path="/ju/jwc/:type?" :paramsDesc="['默认为 `all`']">
|
||||
|
||||
| all | tzgg | ksap | wjgg | tmgz | djks | xjgl | bysj | syjs |
|
||||
| ---- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
||||
+14
-18
@@ -8,30 +8,26 @@ module.exports = async (ctx) => {
|
||||
const response = await got(`https://m.qidian.com/book/${id}.html`);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const name = $('.book-detail-info .book-title').text();
|
||||
const cover_url = 'https:' + $('.book-detail-info img').attr('src');
|
||||
const name = $('meta[property="og:title"]').attr('content');
|
||||
const coverUrl = `https:${$('.detail__header-cover__img').attr('src')}`;
|
||||
|
||||
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 = [];
|
||||
const { data: catalog } = await got(`https://m.qidian.com/book/${id}/catalog/`);
|
||||
const $c = cheerio.load(catalog);
|
||||
const { pageContext } = JSON.parse($c('#vite-plugin-ssr_pageContext').text());
|
||||
|
||||
for (let i = 0; i < chapters_response.data.data.vs.length; i++) {
|
||||
const chapters = chapters_response.data.data.vs[i].cs;
|
||||
for (let j = 0; j < chapters.length; j++) {
|
||||
const chapter = chapters[j];
|
||||
chapter_item.push({
|
||||
title: chapter.cN,
|
||||
pubDate: parseDate(chapter.uT),
|
||||
link: `https://vipreader.qidian.com/chapter/${id}/${chapter.id}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
const chapterItem = pageContext.pageProps.pageData.vs
|
||||
.flatMap((v) => v.cs)
|
||||
.map((c) => ({
|
||||
title: c.cN,
|
||||
pubDate: parseDate(c.uT),
|
||||
link: `https://vipreader.qidian.com/chapter/${id}/${c.id}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `起点 ${name}`,
|
||||
link: `https://book.qidian.com/info/${id}`,
|
||||
description: $('#bookSummary content').text(),
|
||||
image: cover_url,
|
||||
item: chapter_item,
|
||||
image: coverUrl,
|
||||
item: chapterItem,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
'/author/:id': ['miles170'],
|
||||
'/chapter/:id': ['Chingyat'],
|
||||
'/forum/:id': ['Chingyat'],
|
||||
'/chapter/:id': ['fuzy112'],
|
||||
'/forum/:id': ['fuzy112'],
|
||||
'/free/:type?': ['LogicJake'],
|
||||
'/free-next/:type?': ['LogicJake'],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user