mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 12:21:31 +08:00
feat: add 有赞商铺商品 (#2843)
This commit is contained in:
@@ -165,3 +165,9 @@ pageClass: routes
|
||||
### 小米有品每日上新
|
||||
|
||||
<Route author="xyqfer" example="/mi/youpin/new" path="/mi/youpin/new"/>
|
||||
|
||||
## 有赞
|
||||
|
||||
### 商品上新
|
||||
|
||||
<Route author="LogicJake" example="/youzan/goods/13328377" path="/youzan/goods/:id" :paramsDesc="['商铺id']"/>
|
||||
|
||||
@@ -1651,6 +1651,9 @@ router.get('/wechat-open/community/xyx-announce', require('./routes/wechat-open/
|
||||
router.get('/wechat-open/community/pay-announce', require('./routes/wechat-open/community/pay-announce'));
|
||||
router.get('/wechat-open/pay/announce', require('./routes/wechat-open/pay/announce'));
|
||||
|
||||
// 有赞
|
||||
router.get('/youzan/goods/:id', require('./routes/youzan/goods'));
|
||||
|
||||
// 币世界快讯
|
||||
router.get('/bishijie/kuaixun', require('./routes/bishijie/kuaixun'));
|
||||
|
||||
|
||||
32
lib/routes/youzan/goods.js
Normal file
32
lib/routes/youzan/goods.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = String(ctx.params.id);
|
||||
|
||||
const link = `https://h5.youzan.com/wscshop/feature/goods/all?kdt_id=${id}`;
|
||||
const api_link = `https://h5.youzan.com/wscshop/showcase/goods/allGoods.json?pageSize=20&page=1&offlineId=0&order=&order_by=createdTime&kdt_id=${id}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: api_link,
|
||||
headers: {
|
||||
Referer: link,
|
||||
},
|
||||
});
|
||||
const goods = response.data.data.list;
|
||||
|
||||
const out = goods.map((good) => {
|
||||
const item = {
|
||||
title: good.title,
|
||||
description: `价格:${good.price}<br><img referrerpolicy="no-referrer" src="${good.image_url}">`,
|
||||
link: `https://detail.youzan.com/show/goods?alias=${good.alias}`,
|
||||
};
|
||||
return item;
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${id} 商铺上新`,
|
||||
link: link,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user