mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
@@ -3039,6 +3039,10 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
|
||||
|
||||
</route>
|
||||
|
||||
### instapaper
|
||||
|
||||
<route name="个人分享" author="LogicJake" example="/instapaper/person/viridiano" path="/instapaper/person"/>
|
||||
|
||||
### UI 中国
|
||||
|
||||
<route name="推荐文章" author="WenryXu" example="/ui-cn/article" path="/ui-cn/article"/>
|
||||
|
||||
@@ -1083,6 +1083,9 @@ router.get('/security/pulses', require('./routes/security/pulses'));
|
||||
// DoNews
|
||||
router.get('/donews/:column?', require('./routes/donews/index'));
|
||||
|
||||
// instapaper
|
||||
router.get('/instapaper/person/:name', require('./routes/instapaper/person'));
|
||||
|
||||
// UI 中国
|
||||
router.get('/ui-cn/article', require('./routes/ui-cn/article'));
|
||||
router.get('/ui-cn/user/:id', require('./routes/ui-cn/user'));
|
||||
|
||||
34
lib/routes/instapaper/person.js
Normal file
34
lib/routes/instapaper/person.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const name = ctx.params.name;
|
||||
const link = `https://www.instapaper.com/p/${name}`;
|
||||
|
||||
const response = await axios.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const out = $('article.article_item.article_browse')
|
||||
.slice(0, 10)
|
||||
.map(function() {
|
||||
const info = {
|
||||
title: $(this)
|
||||
.find('div.js_title_row.title_row a')
|
||||
.attr('title'),
|
||||
link: $(this)
|
||||
.find('div.js_title_row.title_row a')
|
||||
.attr('href'),
|
||||
description: $(this)
|
||||
.find('div.article_preview')
|
||||
.text(),
|
||||
};
|
||||
return info;
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${name}-Instapaper分享`,
|
||||
link: link,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user