feat(route): add curius.app (#11182)
* feat(route): curius.app * fix typo * fix undefined * use full text * Change style * add tab * upd * edit example * Specify the root domain only * Fix maintainer.js * fix typo * update link * fix: multiple fixes
This commit is contained in:
parent
951848b31c
commit
c9d4f76733
|
|
@ -10,6 +10,12 @@ pageClass: routes
|
|||
|
||||
<RouteEn author="lucasew" path="/curiouscat/user/:name" example="/curiouscat/user/kretyn" :paramsDesc="['name, username that is in the URL']" />
|
||||
|
||||
## Curius
|
||||
|
||||
### User
|
||||
|
||||
<RouteEn author="Ovler-Young" example="/curius/links/yuu-yuu" path="/curius/links/:name" :paramsDesc="['Username, can be found in URL']"/>
|
||||
|
||||
## Dev.to
|
||||
|
||||
### Top Posts
|
||||
|
|
|
|||
|
|
@ -344,6 +344,12 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
|
|||
|
||||
</Route>
|
||||
|
||||
## Curius
|
||||
|
||||
### 用户
|
||||
|
||||
<Route author="Ovler-Young" example="/curius/links/yuu-yuu" path="/curius/links/:name" :paramsDesc="['用户名称,可在url中找到']"/>
|
||||
|
||||
## Dev.to
|
||||
|
||||
### 最高职位
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const username = ctx.params.name;
|
||||
|
||||
const name_response = await got(`https://curius.app/api/users/${username}`, {
|
||||
headers: {
|
||||
Referer: `https://curius.app/${username}`,
|
||||
},
|
||||
});
|
||||
|
||||
const data = name_response.data;
|
||||
|
||||
const uid = data.user.id;
|
||||
const name = `${data.user.firstName} ${data.user.lastName}`;
|
||||
|
||||
const response = await got(`https://curius.app/api/users/${uid}/links?page=0`, {
|
||||
headers: {
|
||||
Referer: `https://curius.app/${username}`,
|
||||
},
|
||||
});
|
||||
|
||||
const items = response.data.userSaved.map((item) => ({
|
||||
title: item.title,
|
||||
description: art(path.join(__dirname, 'templates/description.art'), {
|
||||
item,
|
||||
}),
|
||||
link: item.link,
|
||||
pubDate: parseDate(item.createdDate),
|
||||
guid: `curius:${username}:${item.id}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${name} - Curius`,
|
||||
link: `https://curius.app/${username}`,
|
||||
description: `${name} - Curius`,
|
||||
allowEmpty: true,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/links/:name': ['Ovler-Young'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'curius.app': {
|
||||
_name: 'Curius',
|
||||
'.': [
|
||||
{
|
||||
title: '用户',
|
||||
docs: 'https://docs.rsshub.app/social-media.html#curius',
|
||||
source: '/:name',
|
||||
target: '/curius/links/:name',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/links/:name', require('./links'));
|
||||
};
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
{{ if item.metadata.full_text }}
|
||||
原文:{{@ item.metadata.full_text.replace(/\n/gm, '<br>') }}<br><br>
|
||||
{{ /if }}
|
||||
{{ if item.comments.length }}
|
||||
评论:{{ item.comments[0].text.substring(0, 100) }}<br><br>
|
||||
{{ /if }}
|
||||
{{ if item.highlights.length }}
|
||||
评论:
|
||||
{{ each item.highlights highlight }}
|
||||
{{ if highlight.comment }}
|
||||
{{ highlight.highlight }}<br>评论:{{ highlight.comment.text }}<br>
|
||||
{{ else }}
|
||||
<br>标注:{{ highlight.highlight }}<br>
|
||||
{{ /if }}
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
Loading…
Reference in New Issue