diff --git a/docs/design.md b/docs/design.md index dd0eba955a..f7fac83e53 100644 --- a/docs/design.md +++ b/docs/design.md @@ -18,6 +18,13 @@ pageClass: routes +## Inside Design + +### Recent Stories + + + + ## UI 中国 ### 推荐文章 diff --git a/docs/en/design.md b/docs/en/design.md index 4982671768..5d793fc848 100644 --- a/docs/en/design.md +++ b/docs/en/design.md @@ -17,3 +17,10 @@ pageClass: routes ### Keyword + +## Inside Design + +### Recent Stories + + + diff --git a/docs/en/other.md b/docs/en/other.md index e8cb31e1fd..5d3dea9e58 100644 --- a/docs/en/other.md +++ b/docs/en/other.md @@ -79,6 +79,15 @@ pageClass: routes +## Product Hunt + +> The official feed: [https://www.producthunt.com/feed](https://www.producthunt.com/feed) + +### Today Popular + + + + ## Remote.work ### Remote.work Job Information diff --git a/docs/other.md b/docs/other.md index 2a3778f841..0eb3aa987a 100644 --- a/docs/other.md +++ b/docs/other.md @@ -91,6 +91,15 @@ pageClass: routes +## Product Hunt + +> 官方 Feed 地址为: [https://www.producthunt.com/feed](https://www.producthunt.com/feed) + +### Today Popular + + + + ## SANS Institute ### 最新会议材料 diff --git a/lib/router.js b/lib/router.js index c63ad5d194..72d6ff8154 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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; diff --git a/lib/routes/invisionapp/inside-design.js b/lib/routes/invisionapp/inside-design.js new file mode 100644 index 0000000000..7500951dad --- /dev/null +++ b/lib/routes/invisionapp/inside-design.js @@ -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: ``, + link: 'https://www.invisionapp.com' + itemDom.find('.hover > a').attr('href'), + }; + }) + .get(), + }; +}; diff --git a/lib/routes/producthunt/today.js b/lib/routes/producthunt/today.js new file mode 100644 index 0000000000..df79d51f32 --- /dev/null +++ b/lib/routes/producthunt/today.js @@ -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()}
`, + link: 'https://www.producthunt.com' + itemDom.find('a').attr('href'), + }; + }) + .get(), + }; +};