mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
fix: 笔趣阁 (#4884)
This commit is contained in:
@@ -1561,13 +1561,23 @@
|
||||
'biquge5200.com': {
|
||||
www: [
|
||||
{
|
||||
title: '当前小说',
|
||||
docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge',
|
||||
title: 'biquge5200.com',
|
||||
docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge-biquge5200-com',
|
||||
source: '/:id',
|
||||
target: '/novel/biquge/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
'biquge.info': {
|
||||
www: [
|
||||
{
|
||||
title: 'biquge.info',
|
||||
docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge-biquge-info',
|
||||
source: '/:id',
|
||||
target: '/novel/biqugeinfo/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
'matters.news': {
|
||||
_name: 'Matters',
|
||||
'.': [
|
||||
|
||||
@@ -56,9 +56,9 @@ pageClass: routes
|
||||
|
||||
## 笔趣阁
|
||||
|
||||
### 小说更新
|
||||
### biquge5200.com
|
||||
|
||||
<Route author="jjeejj" example="/novel/biquge/52_52542" path="/novel/biquge/:id" :paramsDesc="['小说 id, 可在对应小说页 URL 中找到']" anticrawler="1" radar="1">
|
||||
<Route author="jjeejj" example="/novel/biquge/52_52542" path="/novel/biquge/:id" :paramsDesc="['小说 id, 可在对应小说页 URL 中找到']" anticrawler="1" radar="1"></Route>
|
||||
|
||||
::: tip 提示
|
||||
|
||||
@@ -66,7 +66,15 @@ pageClass: routes
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
### biquge.info
|
||||
|
||||
<Route author="machsix" example="/novel/biqugeinfo/81_81797" path="/novel/biqugeinfo/:id" :paramsDesc="['小说 id, 可在对应小说页 URL 中找到']" anticrawler="1" radar="1"></Route>
|
||||
|
||||
::: tip 提示
|
||||
|
||||
由于笔趣阁网站有多个,各站点小说对应的小说 id 不同。此 feed 只对应在[`www.biquge.info`](http://www.biquge.info/)中的小说 id.
|
||||
|
||||
:::
|
||||
|
||||
## 吹牛部落
|
||||
|
||||
@@ -201,7 +209,7 @@ count 的取值范围为 1-12,为防止请求次数过多,推荐设置为 5
|
||||
|
||||
<Route author="xfangbao" example="/biobio/nature/cell-reports" path="/biobio/:column/:id" :paramsDesc="['', '']" />
|
||||
|
||||
具体栏目编号,去网站上看标签
|
||||
具体栏目编号,去网站上看标签
|
||||
|
||||
| 网址 | 对应路由 |
|
||||
| ------------------------------------------------ | ----------------------------------- |
|
||||
|
||||
@@ -528,14 +528,9 @@ router.get('/earthquake/:region?', require('./routes/earthquake'));
|
||||
// 中国地震台网
|
||||
router.get('/earthquake/ceic/:type', require('./routes/earthquake/ceic'));
|
||||
|
||||
// 笔趣阁
|
||||
router.get('/biquge/novel/latestchapter/:id', require('./routes/novel/biquge'));
|
||||
|
||||
// UU看书
|
||||
router.get('/uukanshu/chapter/:uid', require('./routes/novel/uukanshu'));
|
||||
|
||||
// 小说
|
||||
router.get('/novel/biquge/:id', require('./routes/novel/biquge'));
|
||||
router.get('/novel/biqugeinfo/:id/:limit?', require('./routes/novel/biqugeinfo'));
|
||||
router.get('/novel/uukanshu/:uid', require('./routes/novel/uukanshu'));
|
||||
router.get('/novel/wenxuemi/:id1/:id2', require('./routes/novel/wenxuemi'));
|
||||
router.get('/novel/booksky/:id', require('./routes/novel/booksky'));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
const asyncPool = require('tiny-async-pool');
|
||||
|
||||
const baseUrl = 'https://www.biquge5200.com/';
|
||||
// 获取小说的最新章节列表
|
||||
@@ -27,33 +28,31 @@ module.exports = async (ctx) => {
|
||||
}))
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
chapter_item.map(async (item) => {
|
||||
const cache = await ctx.cache.get(item.link);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
const items = await asyncPool(3, chapter_item, async (item) => {
|
||||
const cache = await ctx.cache.get(item.link);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
responseType: 'buffer',
|
||||
});
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const responseHtml = iconv.decode(response.data, 'GBK');
|
||||
const $ = cheerio.load(responseHtml);
|
||||
const responseHtml = iconv.decode(response.data, 'GBK');
|
||||
const $ = cheerio.load(responseHtml);
|
||||
|
||||
const description = $('#content').html();
|
||||
const description = $('#content').html();
|
||||
|
||||
const single = {
|
||||
title: item.title,
|
||||
description,
|
||||
link: item.link,
|
||||
};
|
||||
ctx.cache.set(item.link, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
const single = {
|
||||
title: item.title,
|
||||
description,
|
||||
link: item.link,
|
||||
};
|
||||
ctx.cache.set(item.link, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
});
|
||||
ctx.state.data = {
|
||||
title: `笔趣阁 ${title}`,
|
||||
link: `${baseUrl}${id}/`,
|
||||
|
||||
69
lib/routes/novel/biqugeinfo.js
Normal file
69
lib/routes/novel/biqugeinfo.js
Normal file
@@ -0,0 +1,69 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
const url = require('url');
|
||||
const asyncPool = require('tiny-async-pool');
|
||||
|
||||
const firstDay = new Date('2020-01-01');
|
||||
const baseUrl = 'http://www.biquge.info';
|
||||
// 获取小说的最新章节列表
|
||||
module.exports = async (ctx) => {
|
||||
const { id, limit = 10 } = ctx.params; // 小说id
|
||||
const pageUrl = url.resolve(baseUrl, `/${id}/`);
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: pageUrl,
|
||||
// responseEncoding: 'gbk', //该配置项在 0.18版本中没有打包进去
|
||||
responseType: 'buffer',
|
||||
});
|
||||
const responseHtml = iconv.decode(response.data, 'utf-8');
|
||||
const $ = cheerio.load(responseHtml);
|
||||
const title = $('#info > h1').text();
|
||||
const description = $('#intro>p').eq(0).text();
|
||||
const cover_url = $('#fmimg>img').eq(0).attr('src');
|
||||
const nItems = $('dd', '#list>dl').length;
|
||||
const list = $('dd', '#list>dl').slice(-parseInt(limit));
|
||||
const chapter_item = list
|
||||
.find('a')
|
||||
.map((i, e) => ({
|
||||
title: e.children[0].data,
|
||||
link: url.resolve(pageUrl, e.attribs.href),
|
||||
pubDate: new Date(firstDay.getTime() + (nItems - parseInt(limit) + i) * 1000 * 60 * 60 * 24),
|
||||
}))
|
||||
.get();
|
||||
|
||||
const items = await asyncPool(3, chapter_item, async (item) => {
|
||||
const cache = await ctx.cache.get(item.link);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const responseHtml = iconv.decode(response.data, 'utf-8');
|
||||
const $ = cheerio.load(responseHtml);
|
||||
|
||||
const description = $('#content').text();
|
||||
|
||||
const single = {
|
||||
title: item.title,
|
||||
description,
|
||||
link: item.link,
|
||||
pubDate: item.pubDate,
|
||||
};
|
||||
ctx.cache.set(item.link, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
});
|
||||
ctx.state.data = {
|
||||
title: `笔趣阁 ${title}`,
|
||||
link: pageUrl,
|
||||
image: cover_url,
|
||||
description: description,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -108,6 +108,7 @@
|
||||
"require-all": "3.0.0",
|
||||
"rss-parser": "3.8.0",
|
||||
"socks-proxy-agent": "5.0.0",
|
||||
"tiny-async-pool": "1.1.0",
|
||||
"tough-cookie": "4.0.0",
|
||||
"tunnel": "0.0.6",
|
||||
"twit": "2.2.11",
|
||||
|
||||
13
yarn.lock
13
yarn.lock
@@ -11757,6 +11757,14 @@ timsort@^0.3.0:
|
||||
resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4"
|
||||
integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=
|
||||
|
||||
tiny-async-pool@1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/tiny-async-pool/-/tiny-async-pool-1.1.0.tgz#cd3fdafaae84f2aa2539a07b428b40f801219c5b"
|
||||
integrity sha512-jIglyHF/9QdCC3662m/UMVADE6SlocBDpXdFLMZyiAfrw8MSG1pml7lwRtBMT6L/z4dddAxfzw2lpW2Vm42fyQ==
|
||||
dependencies:
|
||||
semver "^5.5.0"
|
||||
yaassertion "^1.0.0"
|
||||
|
||||
tiny-emitter@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423"
|
||||
@@ -13074,6 +13082,11 @@ xtend@^4.0.1:
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
|
||||
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
|
||||
|
||||
yaassertion@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/yaassertion/-/yaassertion-1.0.2.tgz#f1a90166e1cc4ad44dbb71487009ebca017e9874"
|
||||
integrity sha512-sBoJBg5vTr3lOpRX0yFD+tz7wv/l2UPMFthag4HGTMPrypBRKerjjS8jiEnNMjcAEtPXjbHiKE0UwRR1W1GXBg==
|
||||
|
||||
yallist@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
|
||||
|
||||
Reference in New Issue
Block a user