[new RSS] Add routes/blogs/jingwei_link for blog https://jingwei.link/ (#1724)
This commit is contained in:
parent
08ae33635a
commit
776fb0bb08
|
|
@ -3119,6 +3119,10 @@ type 为 all 时,category 参数不支持 cost 和 free
|
|||
|
||||
<route name="最新资讯" author="WenryXu" example="/juesheng" path="/juesheng"/>
|
||||
|
||||
### 博客: 敬维
|
||||
|
||||
<route name="博客: 敬维" author="a180285" example="/blogs/jingwei.link" path="/blogs/jingwei.link"/>
|
||||
|
||||
### 裏垢女子まとめ
|
||||
|
||||
<route name="主页" author="SettingDust" example="/uraaka-joshi" path="/uraaka-joshi"/>
|
||||
|
|
|
|||
|
|
@ -1125,6 +1125,10 @@ router.get('/luogu/daily/:id?', require('./routes/luogu/daily'));
|
|||
// 决胜网
|
||||
router.get('/juesheng', require('./routes/juesheng'));
|
||||
|
||||
// 一些博客
|
||||
// 敬维-以认真的态度做完美的事情: https://jingwei.link/
|
||||
router.get('/blogs/jingwei.link', require('./routes/blogs/jingwei_link'));
|
||||
|
||||
// 裏垢女子まとめ
|
||||
router.get('/uraaka-joshi', require('./routes/uraaka-joshi/uraaka-joshi'));
|
||||
router.get('/uraaka-joshi/:id', require('./routes/uraaka-joshi/uraaka-joshi-user'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://jingwei.link/';
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const resultItem = $("article[class='article-item']")
|
||||
.map((index, elem) => {
|
||||
elem = $(elem);
|
||||
|
||||
const $esction = elem.find('section[class="post-preview"]');
|
||||
|
||||
return {
|
||||
title: $esction.find('h2').text(),
|
||||
description: $esction.find('h3').text(),
|
||||
link: $esction.find('a').attr('href'),
|
||||
author: '敬维',
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '敬维-以认真的态度做完美的事情',
|
||||
link: url,
|
||||
item: resultItem,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue