mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 22:19:40 +08:00
feat: add leemeng blog (#3068)
This commit is contained in:
@@ -26,6 +26,12 @@ pageClass: routes
|
||||
|
||||
<Route author="kt286" example="/latexstudio/home" path="/latexstudio/home"/>
|
||||
|
||||
## LeeMeng
|
||||
|
||||
### blog
|
||||
|
||||
<Route author="xyqfer" example="/leemeng" path="/leemeng"/>
|
||||
|
||||
## 财新博客
|
||||
|
||||
### 用户博客
|
||||
|
||||
@@ -1717,6 +1717,9 @@ router.get('/engadget-cn', require('./routes/engadget-cn/home'));
|
||||
// 吹牛部落
|
||||
router.get('/chuiniu/column/:id', require('./routes/chuiniu/column'));
|
||||
|
||||
// leemeng
|
||||
router.get('/leemeng', require('./routes/blogs/leemeng'));
|
||||
|
||||
// 中国地质大学
|
||||
router.get('/cug/graduate', require('./routes/cug/graduate'));
|
||||
|
||||
|
||||
30
lib/routes/blogs/leemeng.js
Normal file
30
lib/routes/blogs/leemeng.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://leemeng.tw/blog.html';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const resultItem = $('article')
|
||||
.map((index, elem) => {
|
||||
elem = $(elem);
|
||||
const $link = elem.find('[rel="bookmark"]');
|
||||
const title = $link.text();
|
||||
const link = $link.attr('href');
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'LeeMeng - 部落格',
|
||||
link: url,
|
||||
item: resultItem,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user