feat: add Inside Design & Product Hunt (#3636)

This commit is contained in:
miaoyafeng
2019-12-27 16:26:46 +08:00
committed by DIYgod
parent 91e37a47f7
commit dd135433f4
7 changed files with 86 additions and 0 deletions

View File

@@ -18,6 +18,13 @@ pageClass: routes
<Route author="DIYgod" example="/dribbble/keyword/player" path="/dribbble/keyword/:keyword" :paramsDesc="['想要订阅的关键词']"/>
## Inside Design
### Recent Stories
<Route author="miaoyafeng" example="/invisionapp/inside-design" path="/invisionapp/inside-design">
</Route>
## UI 中国
### 推荐文章

View File

@@ -17,3 +17,10 @@ pageClass: routes
### Keyword
<RouteEn path="/dribbble/keyword/:keyword" example="/dribbble/keyword/player" :paramsDesc="['desired keyword']" />
## Inside Design
### Recent Stories
<RouteEn author="miaoyafeng" example="/invisionapp/inside-design" path="/invisionapp/inside-design">
</RouteEn>

View File

@@ -79,6 +79,15 @@ pageClass: routes
<RouteEn author="hoilc" example="/pocket/trending" path="/pocket/trending"/>
## Product Hunt
> The official feed: [https://www.producthunt.com/feed](https://www.producthunt.com/feed)
### Today Popular
<RouteEn author="miaoyafeng" example="/producthunt/today" path="/producthunt/today">
</RouteEn>
## Remote.work
### Remote.work Job Information

View File

@@ -91,6 +91,15 @@ pageClass: routes
<Route author="hoilc" example="/pocket/trending" path="/pocket/trending"/>
## Product Hunt
> 官方 Feed 地址为: [https://www.producthunt.com/feed](https://www.producthunt.com/feed)
### Today Popular
<Route author="miaoyafeng" example="/producthunt/today" path="/producthunt/today">
</Route>
## SANS Institute
### 最新会议材料

View File

@@ -2052,4 +2052,10 @@ router.get('/xinwenlianbo/index', require('./routes/xinwenlianbo/index'));
// Paul Graham - Essays
router.get('/blogs/paulgraham', require('./routes/blogs/paulgraham'));
// invisionapp
router.get('/invisionapp/inside-design', require('./routes/invisionapp/inside-design'));
// producthunt
router.get('/producthunt/today', require('./routes/producthunt/today'));
module.exports = router;

View File

@@ -0,0 +1,24 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got.get('https://www.invisionapp.com/inside-design/');
const $ = cheerio.load(response.data);
const list = $('#recent-stories #articles-wrapper > div');
ctx.state.data = {
title: 'Inside Design',
link: 'https://www.invisionapp.com/inside-design/',
item: list
.map((i, item) => {
const itemDom = $(item);
return {
title: itemDom.find('.text h3').text(),
description: `<img src="${itemDom.find('img').attr('src')}">`,
link: 'https://www.invisionapp.com' + itemDom.find('.hover > a').attr('href'),
};
})
.get(),
};
};

View File

@@ -0,0 +1,24 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got.get('https://www.producthunt.com/');
const $ = cheerio.load(response.data);
const list = $('ul[class^="postsList"] li');
ctx.state.data = {
title: 'Product Hunt Today Popular',
link: 'https://www.producthunt.com/',
item: list
.map((i, item) => {
const itemDom = $(item);
return {
title: itemDom.find('h3').text(),
description: `${itemDom.find('h3 + p').text()}<br><img src="${itemDom.find('h3').attr('src')}">`,
link: 'https://www.producthunt.com' + itemDom.find('a').attr('href'),
};
})
.get(),
};
};