parent
feed8c8f95
commit
efefa241e2
|
|
@ -2500,3 +2500,7 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
|
|||
<route name="分类/欧陆风云" author="MegrezZhu" example="/javbus/western/genre/86" path="/javbus/western/genre/:gid" :paramsDesc="['分类id,详见[网站里](https://www.javbus.work/genre)的链接']" />
|
||||
|
||||
<route name="演员/欧陆风云" author="MegrezZhu" example="/javbus/western/star/4hv" path="/javbus/western/star/:sid" :paramsDesc="['演员id,详见[网站里](https://www.javbus.work/actresses)的链接']" />
|
||||
|
||||
### 虎嗅
|
||||
|
||||
<route name="标签" author="xyqfer" example="/huxiu/tag/291" path="/huxiu/tag/:id" :paramsDesc="['标签 id']" />
|
||||
|
|
|
|||
|
|
@ -890,4 +890,7 @@ router.get('/cpu/yjsy', require('./routes/cpu/yjsy'));
|
|||
// 字幕组
|
||||
router.get('/zimuzu/resource/:id', require('./routes/zimuzu/resource'));
|
||||
|
||||
// 虎嗅
|
||||
router.get('/huxiu/tag/:id', require('./routes/huxiu/tag'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const url = `https://www.huxiu.com/tags/${id}.html`;
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url,
|
||||
headers: {
|
||||
Referer: url,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.related-article li')
|
||||
.map((index, elem) => {
|
||||
const $elem = $(elem);
|
||||
const $link = $elem.find('a');
|
||||
const title = $link.text();
|
||||
const time = $elem.find('.time').text();
|
||||
const link = $link.attr('href');
|
||||
|
||||
return {
|
||||
title,
|
||||
link: `https://www.huxiu.com${link}`,
|
||||
description: title,
|
||||
pubDate: new Date(time).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `虎嗅-${$('.tag-title').text()}`,
|
||||
link: url,
|
||||
description: $('meta[name="description"]').attr('content'),
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue