-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 完成issues#7485,在每日一图-国家地理中增加每日精选节点 * 修改文档和router位置 * 对日期pubDate规范进行了调整 * 优化调整获取内容逻辑,修改pubDate字段的获取方式 * 调整pubDate参数 * 删除代码中多余的console * 调整parse-date引用 * 调整时区 * 修改国家地理每日一图 * issues-#7471,解决国家地理每日一图获取失败问题,因为网站更改,并且网站对图片进行了处理,所以调整获取方式。 * 删除无用代码 * 调整代码,错删了代码 * 重新提交,之前提交后部署失败。 * feat:add orcid works route * feat(route):add ORCID 获取Works(前20条) * 调整代码,使其更加规范 * fix: remove all unnecessary changes * refactor: migrate to v2 Co-authored-by: TonyRL <[email protected]>
- Loading branch information
1 parent
27ad517
commit 75cb4f9
Showing
9 changed files
with
102 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/:id': ['OrangeEd1t'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/:id', require('./index')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
75cb4f9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deployment failed with the following error:
Learn More: http://vercel.link/fair-use