mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add behance user appreciations (#5835)
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ pageClass: routes
|
||||
|
||||
### User Works
|
||||
|
||||
<Route author="MisteryMonster" example="/behance/mishapetrick" path="/behance/:user" :paramsDesc="['用户名']" radar="1">
|
||||
<Route author="MisteryMonster" example="/behance/mishapetrick" path="/behance/:user/:type?" :paramsDesc="['用户名', '类型,可选 `projects` 或 `appreciated`']" radar="1">
|
||||
|
||||
Behance 用户主页 URL 获取用户名,如 <https://www.behance.net/mishapetrick> 的用户名为 `mishapetrick`。
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ Some tags are rarely used: `Script`, `direction`, `production`, `design-concep
|
||||
|
||||
### User Works
|
||||
|
||||
<RouteEn author="MisteryMonster" example="/behance/mishapetrick" path="/behance/:user" :paramsDesc="['username']" radar="1">
|
||||
<RouteEn author="MisteryMonster" example="/behance/mishapetrick" path="/behance/:user/:type?" :paramsDesc="['username', 'type, `projects` or `appreciated`, `projects` by default']" radar="1">
|
||||
|
||||
Behance user's profile URL, like <https://www.behance.net/mishapetrick> the username will be `mishapetrick`。
|
||||
|
||||
|
||||
+1
-1
@@ -3069,7 +3069,7 @@ router.get('/touhougarakuta/:language/:type', require('./routes/touhougarakuta')
|
||||
router.get('/liequtv/room/:id', require('./routes/liequtv/room'));
|
||||
|
||||
// Behance
|
||||
router.get('/behance/:user', require('./routes/behance/index'));
|
||||
router.get('/behance/:user/:type?', require('./routes/behance/index'));
|
||||
|
||||
// furstar.jp
|
||||
router.get('/furstar/characters/:lang?', require('./routes/furstar/index'));
|
||||
|
||||
@@ -4,9 +4,11 @@ const dayjs = require('dayjs');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const user = ctx.params.user || '';
|
||||
const type = ctx.params.type || 'projects';
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://www.behance.net/${user}/projects`, // 接口只获取12个项目
|
||||
url: `https://www.behance.net/${user}/${type}`, // 接口只获取12个项目
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
@@ -15,6 +17,9 @@ module.exports = async (ctx) => {
|
||||
const list = data.profile.activeSection.work.projects;
|
||||
const articledata = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
if (type !== 'projects') {
|
||||
item = item.project;
|
||||
}
|
||||
const url = `${item.url}?ilo0=1`;
|
||||
const cache = await ctx.cache.get(url);
|
||||
if (cache) {
|
||||
@@ -38,11 +43,16 @@ module.exports = async (ctx) => {
|
||||
ctx.state.data = {
|
||||
title: `${data.profile.owner.first_name} ${data.profile.owner.last_name}'s Work`,
|
||||
link: `${data.profile.owner.url}`,
|
||||
item: list.map((item, index) => ({
|
||||
title: `${item.name}`,
|
||||
description: `${articledata[index].content}`,
|
||||
link: `${item.url}`,
|
||||
pubDate: dayjs.unix(item.published_on).format(),
|
||||
})),
|
||||
item: list.map((item, index) => {
|
||||
if (type !== 'projects') {
|
||||
item = item.project;
|
||||
}
|
||||
return {
|
||||
title: `${item.name}`,
|
||||
description: `${articledata[index].content}`,
|
||||
link: `${item.url}`,
|
||||
pubDate: dayjs.unix(item.published_on).format(),
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user