Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): add orcid #7582

Merged
merged 25 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5431f17
完成issues#7485,在每日一图-国家地理中增加每日精选节点
OrangeEd1t May 6, 2021
c3ce5e7
修改文档和router位置
OrangeEd1t May 6, 2021
9fa439c
Merge remote-tracking branch 'upstream/master'
OrangeEd1t May 12, 2021
3255f63
对日期pubDate规范进行了调整
OrangeEd1t May 12, 2021
dadbb6f
Merge branch 'issues-#7485'
OrangeEd1t May 12, 2021
7fd967b
优化调整获取内容逻辑,修改pubDate字段的获取方式
OrangeEd1t May 13, 2021
703ccaa
调整pubDate参数
OrangeEd1t May 15, 2021
556db62
删除代码中多余的console
OrangeEd1t May 17, 2021
20bf6ff
调整parse-date引用
OrangeEd1t May 17, 2021
17934e2
Merge remote-tracking branch 'upstream/master'
OrangeEd1t May 19, 2021
279003f
Merge branch 'master' into issues-#7485
OrangeEd1t May 19, 2021
e378a4b
调整时区
OrangeEd1t May 19, 2021
c38f2db
修改国家地理每日一图
OrangeEd1t May 19, 2021
09cd835
issues-#7471,解决国家地理每日一图获取失败问题,因为网站更改,并且网站对图片进行了处理,所以调整获取方式。
OrangeEd1t May 20, 2021
1db9ab4
删除无用代码
OrangeEd1t May 20, 2021
4fdd89d
调整代码,错删了代码
OrangeEd1t May 20, 2021
288c203
重新提交,之前提交后部署失败。
OrangeEd1t May 20, 2021
15df7a1
Merge branch 'feature-geoDailyPhoto'
OrangeEd1t May 20, 2021
fd005b8
Merge branch 'issues-#7485'
OrangeEd1t May 20, 2021
ec5048e
feat:add orcid works route
OrangeEd1t May 25, 2021
864e9c9
feat(route):add ORCID 获取Works(前20条)
OrangeEd1t May 26, 2021
a77e52f
调整代码,使其更加规范
OrangeEd1t May 26, 2021
f43d39b
Merge branch 'upstream' into pr/OrangeEd1t/7582
TonyRL Feb 20, 2022
fcd0e07
fix: remove all unnecessary changes
TonyRL Feb 20, 2022
055480b
refactor: migrate to v2
TonyRL Feb 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/en/study.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ pageClass: routes
| columns | columns=健康 | string / undefined |
| columns | columns=virus | string / undefined |

## ORCID

### Works List

<Route author="OrangeEd1t" example="/orcid/0000-0002-4731-9700" path="/orcid/:id" :paramsDesc="['Open Researcher and Contributor ID']"/>

## X-MOL

### News
Expand Down
24 changes: 12 additions & 12 deletions docs/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@ type 为 all 时,category 参数不支持 cost 和 free

<Route author="sanmmm" example="/afdian/dynamic/@afdian" path="/afdian/dynamic/:uid?" :paramsDesc="['用户id, 用户动态页面url里可找到']"/>

## 澳門特別行政區政府各公共部門獎助貸學金服務平台

官方網址:<https://www.bolsas.gov.mo/>

<Route author="KeiLongW" example="/macau-bolsas" path="/macau-bolsas/:lang?" :paramsDesc="['語言']" >

| 中文 | 葡文 |
| -- | -- |
| ch | pt |

</Route>

## 百度搜索风云榜

### 榜单
Expand Down Expand Up @@ -1067,15 +1079,3 @@ type 为 all 时,category 参数不支持 cost 和 free
### はてな匿名ダイアリー - 人気記事アーカイブ

<Route author="masakichi" example="/hatena/anonymous_diary/archive" path="/hatena/anonymous_diary/archive"/>

### 澳門特別行政區政府各公共部門獎助貸學金服務平台

官方網址:<https://www.bolsas.gov.mo/>

<Route author="KeiLongW" example="/macau-bolsas" path="/macau-bolsas/:lang?" :paramsDesc="['語言']" >

| 中文 | 葡文 |
| -- | -- |
| ch | pt |

</Route>
6 changes: 6 additions & 0 deletions docs/study.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ path="/ctfhub/upcoming/:limit?"

<Route author="nczitzk" example="/neea/jlpt" path="/neea/jlpt"/>

## ORCID

### 作品列表

<Route author="OrangeEd1t" example="/orcid/0000-0002-4731-9700" path="/orcid/:id" :paramsDesc="['学术识别号']"/>

## ProcessOn

### 推荐
Expand Down
4 changes: 2 additions & 2 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const lazyloadRouteHandler = (routeHandlerPath) => (ctx) => {
return handler(ctx);
};

// Deprecated: DO NOT ADD ROUTE HERE
// Deprecated: DO NOT ADD ANY NEW ROUTES HERE

// RSSHub migrated to v2
// router.get('/rsshub/rss', lazyloadRouteHandler('./routes/rsshub/routes')); // 弃用
Expand Down Expand Up @@ -4176,6 +4176,6 @@ router.get('/mirror/:id', lazyloadRouteHandler('./routes/mirror/entries'));
// KBS
router.get('/kbs/today/:language?', lazyloadRouteHandler('./routes/kbs/today'));

// Deprecated: DO NOT ADD ROUTE HERE
// Deprecated: DO NOT ADD ANY NEWS ROUTES HERE

module.exports = router;
54 changes: 54 additions & 0 deletions lib/v2/orcid/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const got = require('@/utils/got');
const { art } = require('@/utils/render');
const path = require('path');

module.exports = async (ctx) => {
const id = ctx.params.id;
const rootUrl = 'https://orcid.org/';
const currentUrl = `${rootUrl}${id}/worksPage.json?offset=0&sort=date&sortAsc=false&pageSize=20`;
const response = await got(currentUrl);

const items = response.data.groups;
const works = new Array();
const out = new Array();

for (let i = 0; i < items.length; i++) {
for (let j = 0; j < items[i].works.length; j++) {
works.push(items[i].works[j]);
}
}

works.map((work) => {
let Str = '';

for (let l = 0; l < work.workExternalIdentifiers.length; l++) {
if (work.workExternalIdentifiers[l].url) {
Str += '<a href="' + work.workExternalIdentifiers[l].url.value + '">' + work.workExternalIdentifiers[l].externalIdentifierType.value + ': ' + work.workExternalIdentifiers[l].externalIdentifierId.value + '</a><br>';
} else {
Str += work.workExternalIdentifiers[l].externalIdentifierType.value + ': ' + work.workExternalIdentifiers[l].externalIdentifierId.value + '<br>';
}
}

const info = {
title: work.title.value,
link: work.url,
description: art(path.join(__dirname, 'templates/description.art'), {
title: work.title.value,
journalTitle: work.journalTitle.value,
publicationDate: work.publicationDate,
workType: work.workType.value,
Str,
sourceName: work.sourceName,
}),
guid: work.putCode.value,
};
out.push(info);
return info;
});

ctx.state.data = {
title: 'ORCID Works List' + id,
link: currentUrl,
item: out,
};
};
3 changes: 3 additions & 0 deletions lib/v2/orcid/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/:id': ['OrangeEd1t'],
};
13 changes: 13 additions & 0 deletions lib/v2/orcid/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'orcid.org': {
_name: 'ORCID',
'.': [
{
title: '作品列表',
docs: 'https://docs.rsshub.app/study.html#orcid',
source: ['/:id', '/'],
target: '/ocrid/:id',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/orcid/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/:id', require('./index'));
};
3 changes: 3 additions & 0 deletions lib/v2/orcid/templates/description.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h2>{{ title }}</h2><h3>{{ journalTitle }}</h3>
<span>{{ if publicationDate.year }}{{ publicationDate.year }}{{ /if }}{{ if publicationDate.month }}-{{ publicationDate.month }}{{ /if }}{{ if publicationDate.day }}-{{ publicationDate.day }}{{ /if }} | {{ workType }}</span><br>
<span>{{@ Str }}</span><span>Source: {{ sourceName }}</span>