mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
const id = ctx.params.id;
|
|
const response = await got(`https://i.ui.cn/ucenter/${id}.html`);
|
|
const $ = cheerio.load(response.data);
|
|
const name = $('.person_name').text();
|
|
const intro = $('.person_intro').text();
|
|
const response2 = await got({
|
|
method: 'get',
|
|
url: `https://i.ui.cn/index.php/Uweb/Api/projectlst?uid=${id}&type=&size=12&page=0`,
|
|
headers: {
|
|
Referer: `https://i.ui.cn/ucenter/${id}.html`,
|
|
},
|
|
});
|
|
const postList = response2.data.data.list;
|
|
ctx.state.data = {
|
|
title: `${name} 的设计作品 - UI 中国`,
|
|
link: `https://i.ui.cn/ucenter/${id}.html`,
|
|
description: intro,
|
|
item: postList.map((item) => ({
|
|
title: item.name,
|
|
description: `${item.name}<br><img src="${item.picurl}">`,
|
|
link: `https://www.ui.cn/detail/${item.id}.html`,
|
|
guid: item.id,
|
|
})),
|
|
};
|
|
};
|