diff --git a/docs/shopping.md b/docs/shopping.md index 0ecf80ef8..e1414df0d 100644 --- a/docs/shopping.md +++ b/docs/shopping.md @@ -42,6 +42,12 @@ pageClass: routes +## 礼物说 + +### 礼物说 + + + ## 什么值得买 ::: tip 提示 diff --git a/lib/router.js b/lib/router.js index c62a6299d..8a00f22f7 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1586,4 +1586,7 @@ router.get('/nogizaka46/news', require('./routes/nogizaka46/news')); // 阿里云 router.get('/aliyun/database_month', require('./routes/aliyun/database_month')); +// 礼物说 +router.get('/liwushuo/index', require('./routes/liwushuo/index.js')); + module.exports = router; diff --git a/lib/routes/liwushuo/index.js b/lib/routes/liwushuo/index.js new file mode 100644 index 000000000..1f4eae975 --- /dev/null +++ b/lib/routes/liwushuo/index.js @@ -0,0 +1,28 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const baseUrl = 'https://www.liwushuo.com'; + const link = `${baseUrl}/api/channels/1/items`; + const res = await got(link, { + query: { + limit: 21, + }, + }); + + const item = res.data.data.items.map((item) => { + const { content_url, cover_image_url, created_at, share_msg, title } = item; + return { + title, + link: content_url, + pubDate: new Date(created_at * 1000).toUTCString(), + description: [``, share_msg].join('
'), + }; + }); + + ctx.state.data = { + title: '礼物说 - 精选', + description: '礼物说 - 精选', + link: baseUrl, + item, + }; +};