feat: 添加"王垠的博客-当然我在扯淡" (#2641)

This commit is contained in:
junbaor 2019-07-18 14:23:47 +08:00 committed by DIYgod
parent 269a0b4b56
commit 09a0895ff0
3 changed files with 38 additions and 2 deletions

View File

@ -335,12 +335,16 @@ type 为 all 时category 参数不支持 cost 和 free
<Route author="fengkx" example="/maitta" path="/maitta" supportPodcast="1" />
## 博客: 敬维
## 个人博客
### 博客: 敬维
### 敬维
<Route author="a180285" example="/blogs/jingwei.link" path="/blogs/jingwei.link"/>
### 王垠-当然我在扯淡
<Route author="junbaor" example="/blogs/wangyin" path="/blogs/wangyin"/>
## 财新博客
### 用户博客

View File

@ -1152,6 +1152,9 @@ router.get('/maitta', require('./routes/maitta'));
// 敬维-以认真的态度做完美的事情: https://jingwei.link/
router.get('/blogs/jingwei.link', require('./routes/blogs/jingwei_link'));
// 王垠的博客-当然我在扯淡
router.get('/blogs/wangyin', require('./routes/blogs/wangyin'));
// 裏垢女子まとめ
router.get('/uraaka-joshi', require('./routes/uraaka-joshi/uraaka-joshi'));
router.get('/uraaka-joshi/:id', require('./routes/uraaka-joshi/uraaka-joshi-user'));

View File

@ -0,0 +1,29 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const url = 'https://www.yinwang.org';
const response = await got({
method: 'get',
url,
});
const $ = cheerio.load(response.data);
const resultItem = $("li[class='list-group-item title']")
.map((index, elem) => {
elem = $(elem);
return {
title: elem.find('a').text(),
description: elem.find('a').text(),
link: url + elem.find('a').attr('href'),
author: '王垠',
};
})
.get();
ctx.state.data = {
title: '王垠的博客-当然我在扯淡',
link: url,
item: resultItem,
};
};