feat: add uniqlo new arrival route (#13885)
This commit is contained in:
parent
15b41aee31
commit
8cb3214a42
|
|
@ -1,24 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ? ctx.params.category : 'women';
|
||||
const url = `https://style.uniqlo.com/api/v2/styleSearch.json?dptId=${category}&lang=en&limit=50&locale=my&offset=0`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
|
||||
const data = response.data.result.styles;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `Uniqlo styling book`,
|
||||
link: `https://www.uniqlo.com/my/stylingbook/pc/${category}`,
|
||||
description: `Uniqlo styling book`,
|
||||
item: data.map((item) => ({
|
||||
title: item.styleId,
|
||||
description: `<img src="${item.styleImgUrl}">`,
|
||||
link: `https://www.uniqlo.com/my/stylingbook/pc/style/` + item.styleId,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/new/:country/:category': ['DIYgod'],
|
||||
};
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { country, category } = ctx.params;
|
||||
|
||||
const map = {
|
||||
sg: {
|
||||
url: 'https://www.uniqlo.com/sg/api/commerce/v3/en/products',
|
||||
withFlag: true,
|
||||
path: {
|
||||
women: 5855,
|
||||
men: 5856,
|
||||
kids: 5857,
|
||||
baby: 5858,
|
||||
},
|
||||
},
|
||||
us: {
|
||||
url: 'https://www.uniqlo.com/us/api/commerce/v5/en/products',
|
||||
withFlag: false,
|
||||
path: {
|
||||
women: 22210,
|
||||
men: 22211,
|
||||
kids: 22212,
|
||||
baby: 22213,
|
||||
},
|
||||
},
|
||||
jp: {
|
||||
url: 'https://www.uniqlo.com/jp/api/commerce/v5/ja/products',
|
||||
withFlag: false,
|
||||
path: {
|
||||
women: 1071,
|
||||
men: 1072,
|
||||
kids: 1073,
|
||||
baby: 1074,
|
||||
},
|
||||
lang: 'ja',
|
||||
},
|
||||
};
|
||||
const { data } = await got(map[country].url, {
|
||||
searchParams: {
|
||||
path: map[country].path[category],
|
||||
flagCodes: map[country].withFlag ? 'salesStart newSKU,salesStart newSKU,salesStart newSKU' : undefined,
|
||||
sort: 1,
|
||||
limit: 24,
|
||||
offset: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const items = data.result.items.map((item) => ({
|
||||
title: item.name,
|
||||
link: `https://www.uniqlo.com/${country}/${map[country].lang || 'en'}/products/${item.productId}`,
|
||||
description: `${item.longDescription || item.name}<br><br>Price: ${(item.prices.base || item.prices.promo).currency.symbol}${(item.prices.base || item.prices.promo).value}<br><br>${
|
||||
item.images.main.length ? item.images.main.map((image) => `<img src="${image.url || image.image}">`).join('') : ''
|
||||
}${item.images.sub.map((image) => `<img src="${image.url || image.image}">`).join('')}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `Uniqlo ${category} new arrivals in ${country}`,
|
||||
link: `https://www.uniqlo.com/${country}/${map[country].lang || 'en'}/feature/new/${category}`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
module.exports = {
|
||||
'uniqlo.com': {
|
||||
_name: 'Uniqlo',
|
||||
www: [
|
||||
{
|
||||
title: 'New Arrivals',
|
||||
docs: 'https://docs.rsshub.app/routes/shopping#uniqlo',
|
||||
source: ['/sg', '/us', '/jp'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/new/:country/:category', require('./new'));
|
||||
};
|
||||
|
|
@ -835,9 +835,9 @@ Refer to [the list of supported currencies](https://wise.com/tools/exchange-rate
|
|||
|
||||
<Route author="LogicJake" example="/kpmg/insights" path="/kpmg/insights" />
|
||||
|
||||
## 成都住建蓉 e 办 {#cheng-du-zhu-jian-rong-e-ban}
|
||||
## 成都住建蓉 e 办 {#cheng-dou-zhu-jian-rong-e-ban}
|
||||
|
||||
### 商品住房购房登记 {#cheng-du-zhu-jian-rong-e-ban-shang-pin-zhu-fang-gou-fang-deng-ji}
|
||||
### 商品住房购房登记 {#cheng-dou-zhu-jian-rong-e-ban-shang-pin-zhu-fang-gou-fang-deng-ji}
|
||||
|
||||
<Route author="TonyRL" example="/cdzjryb/zw/projectList" path="/cdzjryb/zw/projectList" radar="1"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -307,6 +307,12 @@ Language
|
|||
|
||||
<Route author="DIYgod" example="/independent/ps5-stock-uk" path="/independent/ps5-stock-uk"/>
|
||||
|
||||
## Uniqlo {#uniqlo}
|
||||
|
||||
### New Arrivals {#uniqlo-new-arrivals}
|
||||
|
||||
<Route author="DIYgod" example="/uniqlo/new/sg/man" path="/uniqlo/new/:country/:category" paramsDesc={['currently only supports sg, us, jp', 'supports `men` `women`, `kids`, `baby`']} radar="1" rssbud="1"/>
|
||||
|
||||
## Westore {#westore}
|
||||
|
||||
### 新品 {#westore-xin-pin}
|
||||
|
|
|
|||
Loading…
Reference in New Issue