Files
RSSHub/lib/routes/ieee/author.js
T
Daniel Li (李丹阳)andSukka d77a039f05 style(eslint): add no-implicit-coercion rule (#8175)
* refactor: add no-implicit-coercion rule for ESLint

* fix: errors from deepscan

* fix: errors from deepscan

* fix: errors from deepscan

* fix: errors from deepscan

* fix: errors from deepscan

* Update docs/en/joinus/quick-start.md

Co-authored-by: Sukka <isukkaw@gmail.com>

* Update docs/joinus/quick-start.md

Co-authored-by: Sukka <isukkaw@gmail.com>

* Update lib/routes/av01/tag.js

Co-authored-by: Sukka <isukkaw@gmail.com>

* Update lib/routes/gov/taiwan/mnd.js

Co-authored-by: Sukka <isukkaw@gmail.com>

* Update lib/routes/ps/product.js

Co-authored-by: Sukka <isukkaw@gmail.com>

* refactor: minify html string

Co-authored-by: Sukka <isukkaw@gmail.com>
2021-09-15 21:22:11 +08:00

31 lines
1.0 KiB
JavaScript

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,
},
});
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}`,
})),
};
};