feat: add a router for IEEE Xplore authors (#5038) (#5059)

This commit is contained in:
Queensferry
2020-06-28 11:15:06 +08:00
committed by GitHub
parent ac5b32508b
commit 2e738448a2
3 changed files with 45 additions and 0 deletions
+12
View File
@@ -45,6 +45,18 @@ pageClass: routes
<Route author="emdoe HenryQW" example="/elife/cell-biology" path="/elife/:subject" :paramsDesc="['方向名称', '请在主页获取。`latest` 则为全部。']" supportScihub="1"/>
## IEEE Xplore
### 作者
<Route author="queensferryme" example="/ieee/author/37283006000/newest/10" path="/ieee/author/:aid/:sortType/:count?" :paramsDesc="['作者 ID,可以在 URL 中找到,例如 [https://ieeexplore.ieee.org/author/37283006000](https://ieeexplore.ieee.org/author/37283006000)', '排序方式,详细见下', '数量限制,默认为 10 篇']">
| 排序方式 | 最新 | 最旧 | 最多论文引用 | 最多专利引用 | 最流行 | 标题升序 | 标题降序 |
| ----------- | -------- | -------- | ----------------- | ------------------ | -------------- | --------------- | ---------------- |
| `:sortType` | `newest` | `oldest` | `paper-citations` | `patent-citations` | `most-popular` | `pub-title-asc` | `pub-title-desc` |
</Route>
## Nature 系列
### 最新成果
+3
View File
@@ -2117,6 +2117,9 @@ router.get('/linkresearcher/:params', require('./routes/linkresearcher/index'));
// eLife [Sci Journal]
router.get('/elife/:tid', require('./routes/elife/index'));
// IEEE Xplore [Sci Journal]
router.get('/ieee/author/:aid/:sortType/:count?', require('./routes/ieee/author'));
// PNAS [Sci Journal]
router.get('/pnas/:topic?', require('./routes/pnas/index'));
+30
View File
@@ -0,0 +1,30 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const { aid, sortType, count = 10 } = ctx.params;
const response = await got(`https://ieeexplore.ieee.org/rest/author/${aid}`);
const author = response.data[0];
const { data: papers } = await got.post('https://ieeexplore.ieee.org/rest/search', {
json: {
rowsPerPage: count,
searchWithin: [`"Author Ids": ${aid}`],
sortType: sortType,
},
});
ctx.state.data = {
title: `${author.preferredName} on IEEE Xplore`,
link: `https://ieeexplore.ieee.org/author/${aid}`,
description: `${author.bioParagraphs.join('<br/>')}`,
item: papers.records.map((item) => ({
title: item.articleTitle,
author: item.authors.map((author) => author.preferredName).join(', '),
category: item.articleContentType,
description: item.abstract,
pubDate: item.publicationDate,
link: `https://ieeexplore.ieee.org${item.documentLink}`,
})),
};
};