From 2e738448a2e252e21a87d9eef7be300075d70929 Mon Sep 17 00:00:00 2001 From: Queensferry Date: Sun, 28 Jun 2020 11:15:06 +0800 Subject: [PATCH] feat: add a router for IEEE Xplore authors (#5038) (#5059) --- docs/journal.md | 12 ++++++++++++ lib/router.js | 3 +++ lib/routes/ieee/author.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 lib/routes/ieee/author.js diff --git a/docs/journal.md b/docs/journal.md index 92a0fbc34..9aee5bb0e 100644 --- a/docs/journal.md +++ b/docs/journal.md @@ -45,6 +45,18 @@ pageClass: routes +## IEEE Xplore + +### 作者 + + + +| 排序方式 | 最新 | 最旧 | 最多论文引用 | 最多专利引用 | 最流行 | 标题升序 | 标题降序 | +| ----------- | -------- | -------- | ----------------- | ------------------ | -------------- | --------------- | ---------------- | +| `:sortType` | `newest` | `oldest` | `paper-citations` | `patent-citations` | `most-popular` | `pub-title-asc` | `pub-title-desc` | + + + ## Nature 系列 ### 最新成果 diff --git a/lib/router.js b/lib/router.js index 73cfac3bd..d621e0408 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/ieee/author.js b/lib/routes/ieee/author.js new file mode 100644 index 000000000..4dc034c12 --- /dev/null +++ b/lib/routes/ieee/author.js @@ -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('
')}`, + 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}`, + })), + }; +};