feat: t66y现在支持按分区子类型进行过滤 (#1123)
This commit is contained in:
parent
45f95c99b6
commit
b5d8c4c779
|
|
@ -835,7 +835,9 @@ GitHub 官方也提供了一些 RSS:
|
|||
|
||||
### 草榴社区
|
||||
|
||||
<route name="分区帖子" author="zhboner" example="/t66y/7" path="/t66y/:id" :paramsDesc="['分区 id, 可在分区页 URL 中找到']">
|
||||
<route name="分区帖子" author="zhboner" example="/t66y/20/2" path="/t66y/:id/:type?" :paramsDesc="['分区 id, 可在分区页 URL 中找到', '类型 id, 可在分区类型过滤后的 URL 中找到']">
|
||||
|
||||
> 注意:并非所欲的分区都有子类型,可以参考成人文学交流区的[古典武侠]这一子类型。
|
||||
|
||||
| 亚洲无码原创区 | 亚洲有码原创区 | 欧美原创区 | 动漫原创区 | 国产原创区 |
|
||||
| -------------- | -------------- | ---------- | ---------- | ---------- |
|
||||
|
|
@ -845,9 +847,9 @@ GitHub 官方也提供了一些 RSS:
|
|||
| ---------- | ---------- | ----------- | ---------- |
|
||||
| 26 | 27 | 21 | 22 |
|
||||
|
||||
| 技术讨论区 | 新时代的我们 | 达盖尔的旗帜 |
|
||||
| ---------- | ------------ | ------------ |
|
||||
| 7 | 8 | 16 |
|
||||
| 技术讨论区 | 新时代的我们 | 达盖尔的旗帜 | 成人文学交流 |
|
||||
| ---------- | ------------ | ------------ | ------------ |
|
||||
| 7 | 8 | 16 | 20 |
|
||||
|
||||
</route>
|
||||
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ router.get('/cctv/:category', require('./routes/cctv/category'));
|
|||
router.get('/caixin/:column/:category', require('./routes/caixin/category'));
|
||||
|
||||
// 草榴社区
|
||||
router.get('/t66y/:id', require('./routes/t66y/index'));
|
||||
router.get('/t66y/:id/:type?', require('./routes/t66y/index'));
|
||||
|
||||
// 机核
|
||||
router.get('/gcores/category/:category', require('./routes/gcores/category'));
|
||||
|
|
|
|||
|
|
@ -34,9 +34,11 @@ const sourceTimezoneOffset = -8;
|
|||
const filterReg = /read\.php/;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const res = await axios_ins.get(url.resolve(base, `${section}${ctx.params.id}&search=today`));
|
||||
const typefilter = ctx.params.type ? `&type=${ctx.params.type}` : '';
|
||||
const res = await axios_ins.get(url.resolve(base, `${section}${ctx.params.id}${typefilter}&search=today`));
|
||||
const data = iconv.decode(res.data, 'gbk');
|
||||
const $ = cheerio.load(data);
|
||||
const typeTitle = ctx.params.type ? `[${$('.t .fn b').text()}]` : '';
|
||||
let list = $('#ajaxtable > tbody:nth-child(2)');
|
||||
list = $('.tr2', list)
|
||||
.not('.tr2.tac')
|
||||
|
|
@ -57,7 +59,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
// Change the image tag to display image in rss reader
|
||||
try {
|
||||
$ = cheerio.load(content);
|
||||
$ = cheerio.load(content, { decodeEntities: false }); // 修复无发进行filter与filterout的问题
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -92,7 +94,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
|
||||
return {
|
||||
description: $.html(),
|
||||
description: $('body').html(),
|
||||
pubDate: time.toUTCString(),
|
||||
};
|
||||
};
|
||||
|
|
@ -115,6 +117,11 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const tnode = $('.tal')
|
||||
.contents()
|
||||
.get(0);
|
||||
const catalog = tnode.type === 'text' ? tnode.data.trim() : '';
|
||||
|
||||
if (
|
||||
cheerio
|
||||
.load(title)('font')
|
||||
|
|
@ -132,7 +139,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
|
||||
const single = {
|
||||
title: title,
|
||||
title: `${catalog} ${title}`,
|
||||
link: link,
|
||||
guid: path,
|
||||
};
|
||||
|
|
@ -156,8 +163,8 @@ module.exports = async (ctx) => {
|
|||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: url.resolve(base, `${section}${ctx.params.id}`),
|
||||
title: typeTitle + $('title').text(),
|
||||
link: url.resolve(base, `${section}${ctx.params.id}${typefilter}`),
|
||||
item: out.filter((item) => item !== ''),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue