Files
RSSHub/lib/routes/uniqlo/stylingbook.js
T
Sukka d82847f541 style/chore(eslint): enforce new rules (#8040)
* style: prefer object shorthand syntax
* refactor: prefer Array#map over Array#forEach
* style: prefer arrow callback
* chore(eslint): update rules
* style: auto fix by eslint
2021-08-17 22:23:23 +08:00

25 lines
804 B
JavaScript

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,
})),
};
};