From 039e8eb80fe26d7028c0dff36a712e1a1ac6e4d7 Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 13 May 2022 14:37:06 -0200 Subject: [PATCH] fix(route): nature (#9748) --- docs/en/journal.md | 36 +- docs/journal.md | 38 +- lib/router.js | 12 +- lib/routes/nature/cover.js | 90 --- lib/routes/nature/highlight.js | 57 -- lib/routes/nature/news-and-comment.js | 78 -- lib/routes/nature/news.js | 51 -- lib/routes/nature/research.js | 184 ----- lib/v2/nature/cover.js | 77 ++ lib/v2/nature/highlight.js | 22 + lib/v2/nature/maintainer.js | 8 + lib/v2/nature/news-and-comment.js | 37 + lib/v2/nature/news.js | 30 + lib/v2/nature/radar.js | 37 + lib/v2/nature/research.js | 39 + lib/v2/nature/router.js | 8 + lib/v2/nature/siteindex.js | 48 ++ lib/v2/nature/utils.js | 978 ++++++++++++++++++++++++++ 18 files changed, 1344 insertions(+), 486 deletions(-) delete mode 100644 lib/routes/nature/cover.js delete mode 100644 lib/routes/nature/highlight.js delete mode 100644 lib/routes/nature/news-and-comment.js delete mode 100644 lib/routes/nature/news.js delete mode 100644 lib/routes/nature/research.js create mode 100644 lib/v2/nature/cover.js create mode 100644 lib/v2/nature/highlight.js create mode 100644 lib/v2/nature/maintainer.js create mode 100644 lib/v2/nature/news-and-comment.js create mode 100644 lib/v2/nature/news.js create mode 100644 lib/v2/nature/radar.js create mode 100644 lib/v2/nature/research.js create mode 100644 lib/v2/nature/router.js create mode 100644 lib/v2/nature/siteindex.js create mode 100644 lib/v2/nature/utils.js diff --git a/docs/en/journal.md b/docs/en/journal.md index 55fc8f451..4e5048203 100644 --- a/docs/en/journal.md +++ b/docs/en/journal.md @@ -178,9 +178,15 @@ New items may always at the end of the list, when the number of paper entries is ## Nature Journal +::: tip Tips + +You can get all short name of a journal from or [Journal List](#nature-journal-journal-list). + +::: + ### Latest Research - + | `:journal` | Full Name of the Journal | Route | | :-----------: | :-------------------------: | ---------------------------------------------------------------------------------- | @@ -194,16 +200,16 @@ New items may always at the end of the list, when the number of paper entries is | nmat | Nature Materials | [/nature/research/nmat](https://rsshub.app/nature/research/nmat) | | natmachintell | Nature Machine Intelligence | [/nature/research/natmachintell](https://rsshub.app/nature/research/natmachintell) | -- Using router (`/nature/research/` + “short name for a journal”) to query latest research paper for a certain journal of Nature Publishing Group. +- Using router (`/nature/research/` + "short name for a journal") to query latest research paper for a certain journal of Nature Publishing Group. If the `:journal` parameter is blank, then latest research of Nature will return. - The journals from NPG are run by different group of people, and the website of may not be consitent for all the journals -- Only the abstract section is rendered +- Only abstract is rendered in some researches ### News & Comment - + | `:journal` | Full Name of the Journal | Route | | :-----------: | :-------------------------: | --------------------------------------------------------------------------------------------------------------------- | @@ -216,7 +222,7 @@ New items may always at the end of the list, when the number of paper entries is | nmat | Nature Materials | [/nature/news-and-comment/nmat](https://rsshub.app/nature/news-and-comment/nmat) | | natmachintell | Nature Machine Intelligence | [/nature/news-and-https://rsshub.app/comment/natmachintell](https://rsshub.app/nature/news-and-comment/natmachintell) | -- Using router (`/nature/research/` + “short name for a journal”) to query latest research paper for a certain journal of Nature Publishing Group. +- Using router (`/nature/research/` + "short name for a journal") to query latest research paper for a certain journal of Nature Publishing Group. - The journals from NPG are run by different group of people, and the website of may not be consitent for all the journals @@ -229,13 +235,25 @@ Subscribe to the cover images of the Nature journals, and get the latest publica -### News +### Nature News - + ### Research Highlight - + + +::: warning Warning + +Only some journals are supported. + +::: + + + +### Journal List + + ## Oxford University Press @@ -243,7 +261,7 @@ Subscribe to the cover images of the Nature journals, and get the latest publica #### Journal - + ## Proceedings of The National Academy of Sciences (PNAS) diff --git a/docs/journal.md b/docs/journal.md index d67c9404f..9bb41c3dc 100644 --- a/docs/journal.md +++ b/docs/journal.md @@ -150,9 +150,15 @@ pageClass: routes ## Nature 系列 +::: tip Tips + +You can get all short name of a journal from or [期刊列表](#nature-xi-lie-qi-kan-lie-biao). + +::: + ### 最新成果 - + | `:journal` | 期刊名 | 路由 | | :-----------: | :-------------------------: | ---------------------------------------------------------------------------------- | @@ -166,16 +172,16 @@ pageClass: routes | nmat | Nature Materials | [/nature/research/nmat](https://rsshub.app/nature/research/nmat) | | natmachintell | Nature Machine Intelligence | [/nature/research/natmachintell](https://rsshub.app/nature/research/natmachintell) | -- 通过 `/nature/research/` + “杂志简写” 来获取对应杂志的最新文章(Latest Research)。 - 若参数置空(`/nature/research`),则默认获取主刊(Nature)的最新文章。 -- 由于 Nature 系列的刊物是分别由不同的编辑来独立运营,所以页面格式上有些差异。目前**仅**对以下杂志进行了测试。 -- 由于权限的限制,目前仅获取论文的摘要进行展示。 +- 通过 `/nature/research/` + “杂志简写” 来获取对应杂志的最新文章 (Latest Research)。 + 若参数置空 (`/nature/research`),则默认获取主刊 (Nature) 的最新文章。 +- 由于 Nature 系列的刊物是分别由不同的编辑来独立运营,所以页面格式上有些差异。目前**仅**对以上杂志进行了测试。 +- 由于权限的限制,目前部分论文仅获取摘要进行展示。 ### 新闻及评论 - + | `:journal` | 期刊名 | 路由 | | :-----------: | :-------------------------: | -------------------------------------------------------------------------------------------------- | @@ -188,9 +194,9 @@ pageClass: routes | nmat | Nature Materials | [/nature/news-and-comment/nmat](https://rsshub.app/nature/news-and-comment/nmat) | | natmachintell | Nature Machine Intelligence | [/nature/news-and-comment/natmachintell](https://rsshub.app/nature/news-and-comment/natmachintell) | -- 通过 `/nature/research/` + “杂志简写” 来获取对应杂志的最新文章(Latest Research)。 +- 通过 `/nature/research/` + “杂志简写” 来获取对应杂志的最新文章 (Latest Research)。 主刊由于格式不同,该 router 并未支持,采用 `/nature/news` 来获取新闻。 -- 由于 Nature 系列的刊物是分别由不同的编辑来独立运营,所以页面格式上有些差异。目前**仅**对以下杂志进行了测试。 +- 由于 Nature 系列的刊物是分别由不同的编辑来独立运营,所以页面格式上有些差异。目前**仅**对以上杂志进行了测试。 @@ -204,11 +210,21 @@ pageClass: routes ### 主刊 - 新闻动态 - + -### 主刊 - 精彩研究 +### 精彩研究 - + + +::: warning 警告 + +仅支持部分期刊。 + +::: + +### 期刊列表 + + ## Oxford University Press diff --git a/lib/router.js b/lib/router.js index 5be285e5b..a95263f33 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2180,12 +2180,12 @@ router.get('/pnas/:topic?', lazyloadRouteHandler('./routes/pnas/index')); router.get('/cell/cell/:category', lazyloadRouteHandler('./routes/cell/cell/index')); router.get('/cell/cover', lazyloadRouteHandler('./routes/cell/cover')); -// nature + nature 子刊 [Sci Journal] -router.get('/nature/research/:journal?', lazyloadRouteHandler('./routes/nature/research')); -router.get('/nature/news-and-comment/:journal?', lazyloadRouteHandler('./routes/nature/news-and-comment')); -router.get('/nature/cover', lazyloadRouteHandler('./routes/nature/cover')); -router.get('/nature/news', lazyloadRouteHandler('./routes/nature/news')); -router.get('/nature/highlight', lazyloadRouteHandler('./routes/nature/highlight')); +// nature + nature 子刊 [Sci Journal] migrated to v2 +// router.get('/nature/research/:journal?', lazyloadRouteHandler('./routes/nature/research')); +// router.get('/nature/news-and-comment/:journal?', lazyloadRouteHandler('./routes/nature/news-and-comment')); +// router.get('/nature/cover', lazyloadRouteHandler('./routes/nature/cover')); +// router.get('/nature/news', lazyloadRouteHandler('./routes/nature/news')); +// router.get('/nature/highlight/:year?', lazyloadRouteHandler('./routes/nature/highlight')); // science [Sci Journal] router.get('/sciencemag/current/:journal?', lazyloadRouteHandler('./routes/sciencemag/current')); diff --git a/lib/routes/nature/cover.js b/lib/routes/nature/cover.js deleted file mode 100644 index c3f6aed7c..000000000 --- a/lib/routes/nature/cover.js +++ /dev/null @@ -1,90 +0,0 @@ -// The content is generateed by undocumentated API of nature journals -// This router has **just** been tested in: -// nature: Nature -// nbt: Nature Biotechnology -// neuro: Nature Neuroscience -// ng: Nature Genetics -// ni: Nature Immunology -// nmeth: Nature Method -// nchem: Nature Chemistry -// nmat: Nature Materials -// natmachintell: Nature Machine Intelligence -// ncb: Nature Cell Biology -// nplants: Nature Plants -// natastron: Nature Astronomy -// nphys Nature Physics - -const got = require('@/utils/got'); - -module.exports = async (ctx) => { - const baseURL = 'https://www.nature.com'; - const journalMap = new Map([ - ['nature', { id: '41586', name: 'Nature' }], - ['nbt', { id: '41587', name: 'Nature Biotechnology' }], - ['neuro', { id: '41593', name: 'Nature Neuroscience' }], - ['ng', { id: '41588', name: 'Nature Genetics' }], - ['ni', { id: '41590', name: 'Nature Immunology' }], - ['nmeth', { id: '41592', name: 'Nature Methods' }], - ['nchem', { id: '41590', name: 'Nature Chemistry' }], - ['nmat', { id: '41563', name: 'Nature Material' }], - ['natmachintell', { id: '42256', name: 'Nature Machine Intelligence' }], - ['ncb', { id: '41556', name: 'Nature Cell Biology' }], - ['nplants', { id: '41477', name: 'Nature Plants' }], - ['natastron', { id: '41550', name: 'Nature Astronomy' }], - ['nphys', { id: '41567', name: 'Nature Physics' }], - ]); - const journals = [...journalMap.keys()]; - const out = await Promise.all( - journals.map(async (journal) => { - // get the lastest volumn and issue id - const pageURL = `${baseURL}/${journal}/current-issue`; - const cookieData = await got - .extend({ - prefixUrl: 'https://idp.nature.com/authorize', - followRedirect: false, - }) - .get(`?response_type=cookie&client_id=grover&redirect_uri=${encodeURI(pageURL)}`) - .then((response) => response.headers['set-cookie'].join(' ')); - const issueURL = await got - .extend({ - prefixUrl: pageURL, - headers: { - cookie: cookieData, - }, - followRedirect: false, - }) - .get('') - .then((response) => response.headers.location); - const capturingRegex = /volumes\/(?\d+)\/issues\/(?\d+)/; - const { volumes, issues } = issueURL.match(capturingRegex).groups; - - const address = `${baseURL}${issueURL}`; - const cache = await ctx.cache.get(address); - if (cache) { - return Promise.resolve(JSON.parse(cache)); - } - const imgSize = 600; - - const id = journalMap.get(journal).id; - const imageURL = `https://media.springernature.com/w${imgSize}/springer-static/cover-hires/journal/${id}/${volumes}/${issues}?as=webp`; - const contents = `
Volume ${volumes} Issue ${issues}
`; - - const single = { - title: `${journalMap.get(journal).name} | Volume ${volumes} Issue ${issues}`, - author: '@yech1990', - description: contents, - link: address, - guid: address, - pubDate: new Date().toUTCString(), - }; - ctx.cache.set(address, JSON.stringify(single)); - return Promise.resolve(single); - }) - ); - ctx.state.data = { - title: 'Nature Covers Story', - description: 'Find out the cover story of some Nature journals.', - link: baseURL, - item: out, - }; -}; diff --git a/lib/routes/nature/highlight.js b/lib/routes/nature/highlight.js deleted file mode 100644 index c75128044..000000000 --- a/lib/routes/nature/highlight.js +++ /dev/null @@ -1,57 +0,0 @@ -const cheerio = require('cheerio'); -const got = require('@/utils/got'); - -module.exports = async (ctx) => { - const base = `https://www.nature.com`; - const url = `${base}/nature/articles?type=research-highlight`; - - const res = await got.get(url); - const $ = cheerio.load(res.data); - const list = $('.border-bottom-1.pb20').get(); - - const out = await Promise.all( - list.slice(0, 2).map(async (item) => { - const $ = cheerio.load(item); - const title = $('h3 > a').text(); - const partial = $('h3 > a').attr('href'); - const address = `${base}${partial}`; - const time = $('time').text(); - let author; - if ($('.js-list-authors-3 li').length > 3) { - author = $('.js-list-authors-3 li').slice(0, 1).text() + ' et al.'; - } else { - author = $('.js-list-authors-3 li').text(); - } - const cache = await ctx.cache.get(address); - if (cache) { - return Promise.resolve(JSON.parse(cache)); - } - const res = await got.get(address); - const capture = cheerio.load(res.data); - let figure = capture('figure .figure--bleed').html(); - if (figure === null) { - figure = ''; - } - let contents = capture('.article-item--open .article-item__body').html(); - if (contents === null) { - contents = ''; - } - const single = { - title, - author, - description: figure + contents, - link: address, - guid: address, - pubDate: new Date(time).toUTCString(), - }; - ctx.cache.set(address, JSON.stringify(single)); - return Promise.resolve(single); - }) - ); - ctx.state.data = { - title: `Nature | Research Highlight`, - description: `Nature, a nature research journal`, - link: url, - item: out, - }; -}; diff --git a/lib/routes/nature/news-and-comment.js b/lib/routes/nature/news-and-comment.js deleted file mode 100644 index 3f0be383b..000000000 --- a/lib/routes/nature/news-and-comment.js +++ /dev/null @@ -1,78 +0,0 @@ -// example usage: `/nature/news-and-comment/ng` -// The journals from NPG are run by different group of people, -// and the website of may not be consitent for all the journals -// -// This router has **just** been tested in: -// nbt: Nature Biotechnology -// neuro: Nature Neuroscience -// ng: Nature Genetics -// ni: Nature Immunology -// nmeth: Nature Method -// nchem: Nature Chemistry -// nmat: Nature Materials -// natmachintell: Nature Machine Intelligence - -const cheerio = require('cheerio'); -const got = require('@/utils/got'); - -module.exports = async (ctx) => { - const baseURL = `https://www.nature.com`; - - const journal = ctx.params.journal; - const pageURL = `${baseURL}/${journal}/news-and-comment`; - - const pageResponse = await got.get(pageURL); - const pageCapture = cheerio.load(pageResponse.data); - - const pageDescription = pageCapture('meta[name="description"]').attr('content') || `Nature, a nature research journal`; - const pageTitleName = pageCapture('meta[name="WT.cg_n"]').attr('content') || `Nature (${journal})`; - const pageTitleSub = pageCapture('meta[name="WT.cg_s"]').attr('content') || 'News & Comment'; - - const list = pageCapture('.border-bottom-1.pb20').get(); - - const items = list.map((el) => { - const $ = cheerio.load(el); - const title = $('h3 > a').text(); - const partial = $('h3 > a').attr('href'); - const address = `${baseURL}${partial}`; - const brief = $('.hide-overflow.inline').text(); - const time = $('time').text(); - const author = $('.js-list-authors-3 li').text(); - const articleType = $('p > span').attr('data-class'); - const headerContents = ` -
-

- ${articleType} - | - ${author} -

-
- `; - let briefContents = ''; - if (brief !== '') { - briefContents = ` -
-

Brief

-

${brief}

-
- `; - } - const contents = headerContents + briefContents; - - return { - title, - author, - description: contents, - link: address, - guid: address, - pubDate: new Date(time).toUTCString(), - }; - }); - - ctx.state.data = { - title: `${pageTitleName} | ${pageTitleSub}`, - description: pageDescription, - link: pageURL, - item: items, - }; -}; diff --git a/lib/routes/nature/news.js b/lib/routes/nature/news.js deleted file mode 100644 index c1fb67ad3..000000000 --- a/lib/routes/nature/news.js +++ /dev/null @@ -1,51 +0,0 @@ -const cheerio = require('cheerio'); -const got = require('@/utils/got'); - -module.exports = async (ctx) => { - const base = `https://www.nature.com`; - const url = `${base}/nature/articles?type=news`; - - const res = await got.get(url); - const $ = cheerio.load(res.data); - const list = $('.border-bottom-1.pb20').get(); - - const out = await Promise.all( - list.map(async (item) => { - const $ = cheerio.load(item); - const title = $('h3 > a').text(); - const partial = $('h3 > a').attr('href'); - const address = `${base}${partial}`; - const time = $('time').text(); - let author; - if ($('.js-list-authors-3 li').length > 3) { - author = $('.js-list-authors-3 li').slice(0, 1).text() + ' et al.'; - } else { - author = $('.js-list-authors-3 li').text(); - } - const cache = await ctx.cache.get(address); - if (cache) { - return Promise.resolve(JSON.parse(cache)); - } - const res = await got.get(address); - const capture = cheerio.load(res.data); - const contents = capture('.content .article__body').html(); - - const single = { - title, - author, - description: contents, - link: address, - guid: address, - pubDate: new Date(time).toUTCString(), - }; - ctx.cache.set(address, JSON.stringify(single)); - return Promise.resolve(single); - }) - ); - ctx.state.data = { - title: `Nature | Latest News`, - description: `Nature, a nature research journal`, - link: url, - item: out, - }; -}; diff --git a/lib/routes/nature/research.js b/lib/routes/nature/research.js deleted file mode 100644 index 927d44fef..000000000 --- a/lib/routes/nature/research.js +++ /dev/null @@ -1,184 +0,0 @@ -// example usage: `/nature/research/ng` -// The journals from NPG are run by different group of people, -// and the website of may not be consitent for all the journals -// -// This router has **just** been tested in: -// nature: Nature -// nbt: Nature Biotechnology -// neuro: Nature Neuroscience -// ng: Nature Genetics -// ni: Nature Immunology -// nmeth: Nature Method -// nchem: Nature Chemistry -// nmat: Nature Materials -// natmachintell: Nature Machine Intelligence - -const cheerio = require('cheerio'); -const got = require('@/utils/got'); - -module.exports = async (ctx) => { - const baseURL = `https://www.nature.com`; - - const journal = ctx.params.journal || 'nature'; - const pageURL = `${baseURL}/${journal}/research`; - - const pageResponse = await got.get(pageURL); - const pageCapture = cheerio.load(pageResponse.data); - - const pageDescription = pageCapture('meta[name="description"]').attr('content') || `Nature, a nature research journal`; - const pageTitleName = pageCapture('meta[name="WT.cg_n"]').attr('content') || `Nature (${journal})`; - const pageTitleSub = pageCapture('meta[name="WT.cg_s"]').attr('content') || 'Latest Research'; - - const list = pageCapture('.border-bottom-1.pb20').get(); - - const items = await Promise.all( - list.map(async (el) => { - const $ = cheerio.load(el); - const title = $('h3 > a').text(); - const partial = $('h3 > a').attr('href'); - const address = `${baseURL}${partial}`; - const brief = $('.hide-overflow.inline').text(); - const time = $('time').text(); - let author; - if ($('.js-list-authors-3 li').length > 3) { - author = $('.js-list-authors-3 li').slice(0, 1).text() + ' et al.'; - } else { - author = $('.js-list-authors-3 li').text(); - } - const cache = await ctx.cache.get(address); - if (cache) { - return Promise.resolve(JSON.parse(cache)); - } - const itemResponse = await got.get(address); - const itemCapture = cheerio.load(itemResponse.data); - - // Brief [obtain from entry of each item] - let briefContents = ''; - if (brief !== '') { - briefContents = ` -
-

Brief

-

${brief}

-
- `; - } - // Abstract [obtain form address of each page] - const abs = itemCapture('div#Abs1-content.c-article-section__content > p').html(); - let absContents = ''; - if (abs !== null) { - absContents = ` -
-

Abstract

-

${abs}

-
- `; - } - // Info [obtain form address of each page] - const subject = itemCapture('li.c-article-subject-list__subject > a') - .map(function () { - const link = $(this).attr('href'); - const name = $(this).text(); - if (name !== '') { - return `
  • ${name}
  • `; - } else { - return ''; - } - }) - .get() - .join(''); - const subjectContents = subject !== '' ? `
      ${subject}
    ` : ''; - const citation = itemCapture('p.c-bibliographic-information__download-citation > a').attr('href'); - const citationContents = citation !== undefined ? `Download citation` : ''; - const doi = itemCapture('meta[name="DOI"]').attr('content'); - const doiContents = doi !== undefined ? `DOI: ${doi}` : ''; - const pdf = itemCapture('meta[name="citation_pdf_url"]').attr('content'); - const pdfContents = pdf !== undefined ? `Offical PDF` : ''; - const linkContents = '
      ' + [citationContents, doiContents, pdfContents].filter((x) => x !== '').map((x) => `
    • ${x}
    • `) + '
    '; - const infoContents = ` -
    -

    About this article

    -

    Subjects:

    - ${subjectContents} -
    -

    Links:

    - ${linkContents} -
    - `; - // Add style - const contentStyle = ` - - `; - const contents = briefContents + absContents + infoContents + contentStyle; - - const item = { - title, - author, - description: contents, - link: address, - guid: address, - pubDate: new Date(time).toUTCString(), - }; - ctx.cache.set(address, JSON.stringify(item)); - return Promise.resolve(item); - }) - ); - ctx.state.data = { - title: `${pageTitleName} | ${pageTitleSub}`, - description: pageDescription, - link: pageURL, - item: items, - }; -}; diff --git a/lib/v2/nature/cover.js b/lib/v2/nature/cover.js new file mode 100644 index 000000000..c08bb161d --- /dev/null +++ b/lib/v2/nature/cover.js @@ -0,0 +1,77 @@ +// The content is generateed by undocumentated API of nature journals +// This router has **just** been tested in: +// nature: Nature +// nbt: Nature Biotechnology +// neuro: Nature Neuroscience +// ng: Nature Genetics +// ni: Nature Immunology +// nmeth: Nature Method +// nchem: Nature Chemistry +// nmat: Nature Materials +// natmachintell: Nature Machine Intelligence +// ncb: Nature Cell Biology +// nplants: Nature Plants +// natastron: Nature Astronomy +// nphys Nature Physics + +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const { baseUrl, journalMap } = require('./utils'); + +module.exports = async (ctx) => { + const journals = journalMap.items; + const out = await Promise.all( + journals + .filter((j) => j.id) + .map(async (journal) => { + // get the lastest volumn and issue id + const pageURL = `${baseUrl}/${journal.title}/current-issue`; + const cookieData = await got + .extend({ + prefixUrl: 'https://idp.nature.com/authorize', + followRedirect: false, + }) + .get(`?response_type=cookie&client_id=grover&redirect_uri=${encodeURI(pageURL)}`) + .then((response) => response.headers['set-cookie'].join(' ')); + const issueURL = await got + .extend({ + prefixUrl: pageURL, + headers: { + cookie: cookieData, + }, + followRedirect: false, + }) + .get('') + .then((response) => response.headers.location); + const capturingRegex = /volumes\/(?\d+)\/issues\/(?\d+)/; + const { volumes, issues } = issueURL.match(capturingRegex).groups; + + const address = `${baseUrl}${issueURL}`; + return ctx.cache.tryGet(address, async () => { + const id = journal.id; + const imageURL = `https://media.springernature.com/full/springer-static/cover-hires/journal/${id}/${volumes}/${issues}?as=webp`; + const contents = `
    Volume ${volumes} Issue ${issues}
    `; + + const response = await got(address); + const $ = cheerio.load(response.data); + const date = $('title').text().split(',')[1].trim(); + const issueDescription = $('div[data-test=issue-description]').html() ?? ''; + + const single = { + title: `${journal.name} | Volume ${volumes} Issue ${issues}`, + description: contents + issueDescription, + link: address, + pubDate: parseDate(date, 'MMMM YYYY'), + }; + return single; + }); + }) + ); + ctx.state.data = { + title: 'Nature Covers Story', + description: 'Find out the cover story of some Nature journals.', + link: baseUrl, + item: out, + }; +}; diff --git a/lib/v2/nature/highlight.js b/lib/v2/nature/highlight.js new file mode 100644 index 000000000..f8a4bf0cd --- /dev/null +++ b/lib/v2/nature/highlight.js @@ -0,0 +1,22 @@ +const cheerio = require('cheerio'); +const got = require('@/utils/got'); +const { baseUrl, getArticleList, getArticle } = require('./utils'); + +module.exports = async (ctx) => { + const { journal = 'nature' } = ctx.params; + const url = `${baseUrl}/${journal}/articles?type=research-highlight`; + + const res = await got(url); + const $ = cheerio.load(res.data); + + let items = getArticleList($); + + items = await Promise.all(items.map((item) => getArticle(item, ctx))); + + ctx.state.data = { + title: $('title').text().trim(), + description: $('meta[name=description]').attr('content'), + link: url, + item: items, + }; +}; diff --git a/lib/v2/nature/maintainer.js b/lib/v2/nature/maintainer.js new file mode 100644 index 000000000..cd003d9d0 --- /dev/null +++ b/lib/v2/nature/maintainer.js @@ -0,0 +1,8 @@ +module.exports = { + '/cover': ['yech1990'], + '/highlight/:journal?/:year?': ['yech1990', 'TonyRL'], + '/news': ['yech1990', 'TonyRL'], + '/news-and-comment/:journal?': ['yech1990', 'TonyRL'], + '/research/:journal?': ['yech1990', 'TonyRL'], + '/siteindex': ['TonyRL'], +}; diff --git a/lib/v2/nature/news-and-comment.js b/lib/v2/nature/news-and-comment.js new file mode 100644 index 000000000..9b0ebd046 --- /dev/null +++ b/lib/v2/nature/news-and-comment.js @@ -0,0 +1,37 @@ +// example usage: `/nature/news-and-comment/ng` +// The journals from NPG are run by different group of people, +// and the website of may not be consitent for all the journals +// +// This router has **just** been tested in: +// nbt: Nature Biotechnology +// neuro: Nature Neuroscience +// ng: Nature Genetics +// ni: Nature Immunology +// nmeth: Nature Method +// nchem: Nature Chemistry +// nmat: Nature Materials +// natmachintell: Nature Machine Intelligence + +const cheerio = require('cheerio'); +const got = require('@/utils/got'); +const { baseUrl, getArticleList, getArticle } = require('./utils'); + +module.exports = async (ctx) => { + const journal = ctx.params.journal; + const pageURL = `${baseUrl}/${journal}/news-and-comment`; + + const pageResponse = await got(pageURL); + const pageCapture = cheerio.load(pageResponse.data); + const pageDescription = pageCapture('meta[name=description]').attr('content') || 'Nature, a nature research journal'; + + let items = getArticleList(pageCapture); + + items = await Promise.all(items.map((item) => getArticle(item, ctx))); + + ctx.state.data = { + title: pageCapture('title').text(), + description: pageDescription, + link: pageURL, + item: items, + }; +}; diff --git a/lib/v2/nature/news.js b/lib/v2/nature/news.js new file mode 100644 index 000000000..911edf0e6 --- /dev/null +++ b/lib/v2/nature/news.js @@ -0,0 +1,30 @@ +const cheerio = require('cheerio'); +const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); +const { baseUrl, getArticle } = require('./utils'); + +module.exports = async (ctx) => { + const url = `${baseUrl}/latest-news`; + const res = await got(url); + const $ = cheerio.load(res.data); + + let items = $('.c-article-item__content') + .toArray() + .map((item) => { + item = $(item); + return { + title: item.find('h3').text(), + link: baseUrl + item.find('a').attr('href'), + pubDate: parseDate(item.find('.c-article-item__date').text()), + }; + }); + + items = await Promise.all(items.map((item) => ctx.cache.tryGet(item.link, () => getArticle(item, ctx)))); + + ctx.state.data = { + title: 'Nature | Latest News', + description: $('meta[name=description]').attr('content'), + link: url, + item: items, + }; +}; diff --git a/lib/v2/nature/radar.js b/lib/v2/nature/radar.js new file mode 100644 index 000000000..d2cecfaa5 --- /dev/null +++ b/lib/v2/nature/radar.js @@ -0,0 +1,37 @@ +module.exports = { + 'nature.com': { + _name: 'Nature', + '.': [ + { + title: '最新成果', + docs: 'https://docs.rsshub.app/journal.html#nature-xi-lie', + source: ['/:journal/research-articles', '/:journal', '/'], + target: '/nature/research/:journal', + }, + { + title: '新闻及评论', + docs: 'https://docs.rsshub.app/journal.html#nature-xi-lie', + source: ['/:journal/news-and-comment', '/:journal', '/'], + target: '/nature/news-and-comment/:journal', + }, + { + title: '封面故事', + docs: 'https://docs.rsshub.app/journal.html#nature-xi-lie', + source: ['/'], + target: '/nature/cover', + }, + { + title: '主刊 - 新闻动态', + docs: 'https://docs.rsshub.app/journal.html#nature-xi-lie', + source: ['/latest-news', '/news', '/'], + target: '/nature/news', + }, + { + title: '精彩研究', + docs: 'https://docs.rsshub.app/journal.html#nature-xi-lie', + source: ['/:journal/articles?type=research-highlight', '/:journal', '/'], + target: '/nature/highlight/:journal', + }, + ], + }, +}; diff --git a/lib/v2/nature/research.js b/lib/v2/nature/research.js new file mode 100644 index 000000000..3d683bb31 --- /dev/null +++ b/lib/v2/nature/research.js @@ -0,0 +1,39 @@ +// example usage: `/nature/research/ng` +// The journals from NPG are run by different group of people, +// and the website of may not be consitent for all the journals +// +// This router has **just** been tested in: +// nature: Nature +// nbt: Nature Biotechnology +// neuro: Nature Neuroscience +// ng: Nature Genetics +// ni: Nature Immunology +// nmeth: Nature Method +// nchem: Nature Chemistry +// nmat: Nature Materials +// natmachintell: Nature Machine Intelligence + +const cheerio = require('cheerio'); +const got = require('@/utils/got'); +const { baseUrl, getArticleList, getDataLayer, getArticle } = require('./utils'); + +module.exports = async (ctx) => { + const journal = ctx.params.journal ?? 'nature'; + const pageURL = `${baseUrl}/${journal}/research-articles`; + + const pageResponse = await got(pageURL); + const pageCapture = cheerio.load(pageResponse.data); + + const pageTitle = getDataLayer(pageCapture).content.journal.title; + + let items = getArticleList(pageCapture); + + items = await Promise.all(items.map((item) => getArticle(item, ctx))); + + ctx.state.data = { + title: `Nature (${pageTitle}) | Latest Research`, + description: pageCapture('meta[name="description"]').attr('content') || `Nature, a nature research journal`, + link: pageURL, + item: items, + }; +}; diff --git a/lib/v2/nature/router.js b/lib/v2/nature/router.js new file mode 100644 index 000000000..7bee4c0c7 --- /dev/null +++ b/lib/v2/nature/router.js @@ -0,0 +1,8 @@ +module.exports = (router) => { + router.get('/cover', require('./cover')); + router.get('/highlight/:journal?', require('./highlight')); + router.get('/news', require('./news')); + router.get('/news-and-comment/:journal?', require('./news-and-comment')); + router.get('/research/:journal?', require('./research')); + router.get('/siteindex', require('./siteindex')); +}; diff --git a/lib/v2/nature/siteindex.js b/lib/v2/nature/siteindex.js new file mode 100644 index 000000000..055e67f0d --- /dev/null +++ b/lib/v2/nature/siteindex.js @@ -0,0 +1,48 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { baseUrl } = require('./utils'); + +module.exports = async (ctx) => { + const response = await got(`${baseUrl}/siteindex`); + const $ = cheerio.load(response.data); + + let items = $('li[class^="grid mq640-grid-12"]') + .toArray() + .map((item) => { + item = $(item); + return { + title: item.find('a').attr('href').replace('/', ''), + name: item.find('a').text(), + link: baseUrl + item.find('a').attr('href'), + }; + }); + + items = await Promise.all( + items.map((item) => + ctx.cache.tryGet(`nature:siteindex:${item.title}`, async () => { + const response = await got(item.link); + const $ = cheerio.load(response.data); + + delete item.link; + try { + item.id = $('.app-latest-issue-row__image img') + .attr('src') + .match(/.*\/journal\/(\d{5})/)[1]; + item.description = item.id; + } catch (e) { + // + } + return item; + }) + ) + ); + + ctx.state.data = { + title: 'Nature siteindex', + link: baseUrl + '/siteindex', + item: items, + }; + ctx.state.json = { + items, + }; +}; diff --git a/lib/v2/nature/utils.js b/lib/v2/nature/utils.js new file mode 100644 index 000000000..05990a82f --- /dev/null +++ b/lib/v2/nature/utils.js @@ -0,0 +1,978 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); + +const baseUrl = 'https://www.nature.com'; + +const fixFigure = (html) => { + html('picture source').each((_, i) => { + i = html(i); + if ( + i.attr('srcset') && + (i.attr('srcset').startsWith('//media.springernature.com/lw685/') || + i.attr('srcset').startsWith('//media.springernature.com/m312/') || + i.attr('srcset').startsWith('//media.springernature.com/relative-r300-703_m1050/') || + i.attr('srcset').startsWith('//media.springernature.com/w300/')) + ) { + i.attr('srcset', i.attr('srcset').replace('//media.springernature.com/lw685/', '//media.springernature.com/full/')); + i.attr('srcset', i.attr('srcset').replace('//media.springernature.com/m312/', '//media.springernature.com/full/')); + i.attr('srcset', i.attr('srcset').replace('//media.springernature.com/relative-r300-703_m1050/', '//media.springernature.com/full/')); + i.attr('srcset', i.attr('srcset').replace('//media.springernature.com/w300/', '//media.springernature.com/full/')); + } + }); + html('img').each((_, i) => { + i = html(i); + if ( + i.attr('src') && + (i.attr('src').startsWith('//media.springernature.com/lw685/') || + i.attr('src').startsWith('//media.springernature.com/m312/') || + i.attr('src').startsWith('//media.springernature.com/relative-r300-703_m1050/') || + i.attr('src').startsWith('//media.springernature.com/w300/')) + ) { + i.attr('src', i.attr('src').replace('//media.springernature.com/lw685/', '//media.springernature.com/full/')); + i.attr('src', i.attr('src').replace('//media.springernature.com/m312/', '//media.springernature.com/full/')); + i.attr('src', i.attr('src').replace('//media.springernature.com/relative-r300-703_m1050/', '//media.springernature.com/full/')); + i.attr('src', i.attr('src').replace('//media.springernature.com/w300/', '//media.springernature.com/full/')); + } + }); +}; + +const getArticleList = (html) => + html('.app-article-list-row__item') + .toArray() + .map((item) => { + item = html(item); + return { + title: item.find('a').text(), + link: baseUrl + item.find('a').attr('href'), + pubDate: parseDate(item.find('.c-meta time').attr('datetime'), 'YYYY-MM-DD'), + }; + }); + +const getArticle = (item, ctx) => + ctx.cache.tryGet(item.link, async () => { + const response = await got(item.link); + const $ = cheerio.load(response.data); + const responseUrl = new URL(response.url); + + if (responseUrl.pathname.startsWith('/immersive/')) { + const meta = getDataLayer($); + item.doi = meta.content.article?.doi; + item.author = meta.content.contentInfo.authors.join(', '); + item.pubDate = parseDate(meta.content.contentInfo.publishedAt * 1000) || item.pubDate; + } else { + const meta = JSON.parse($('script[type="application/ld+json"]').html()); + const freeAccess = meta.mainEntity.isAccessibleForFree; + let description; + + if (meta.mainEntity.sameAs.startsWith('https://doi.org/')) { + item.doi = meta.mainEntity.sameAs.replace('https://doi.org/', ''); + } + item.author = meta.mainEntity.author.map((author) => author.name.replace(', ', ' ')).join(', '); + item.category = meta.mainEntity.keywords.split(','); + item.pubDate = parseDate(meta.mainEntity.datePublished) || item.pubDate; + + fixFigure($); + + $('section[data-recommended=jobs], span[data-recommended=jobs]').remove(); + $('#further-reading-section').remove(); + $('figure div.u-text-right.u-hide-print').remove(); + + if (!freeAccess) { + $('div.c-article-access-provider, h2#access-options, div[data-component=entitlement-box],div[class^=LiveAreaSection-], nav.c-access-options').remove(); + description = ($('.c-article-teaser-text').html() ?? '') + ($('div.u-clear-both.c-article-wide-figure').html() ?? '') + $('.article__teaser').html() + ($('.c-article-references__container').html() ?? ''); + } else { + description = $('.c-article-body').html(); + } + + if ($('div.c-pdf-download').length) { + // Please don't use meta[name=citation_pdf_url] because some of them point to an URL that needs to be logged in. + // e.g., https://www.nature.com/articles/s41593-022-01079-5 + description += `Download PDF`; + } + + item.description = description; + } + return item; + }); + +const getDataLayer = (html) => + JSON.parse( + html('script[data-test=dataLayer]') + .html() + .match(/window\.dataLayer = \[(.*)\];/s)[1] + ); + +/** + * This is generated by /nature/siteindex.debug.json + */ +const journalMap = { + items: [ + { + title: 'aps', + name: 'Acta Pharmacologica Sinica', + id: '41401', + description: '41401', + }, + { + title: 'bdjinpractice', + name: 'BDJ In Practice', + id: '41404', + description: '41404', + }, + { + title: 'bdjopen', + name: 'BDJ Open', + }, + { + title: 'bdjstudent', + name: 'BDJ Student', + id: '41406', + description: '41406', + }, + { + title: 'bdjteam', + name: 'BDJ Team', + id: '41407', + description: '41407', + }, + { + title: 'biopharmdeal', + name: 'Biopharma Dealmakers', + id: '43747', + description: '43747', + }, + { + title: 'bcj', + name: 'Blood Cancer Journal', + }, + { + title: 'bmt', + name: 'Bone Marrow Transplantation', + id: '41409', + description: '41409', + }, + { + title: 'boneres', + name: 'Bone Research', + }, + { + title: 'bdj', + name: 'British Dental Journal', + id: '41415', + description: '41415', + }, + { + title: 'bjc', + name: 'British Journal of Cancer', + id: '41416', + description: '41416', + }, + { + title: 'cgt', + name: 'Cancer Gene Therapy', + id: '41417', + description: '41417', + }, + { + title: 'cdd', + name: 'Cell Death & Differentiation', + id: '41418', + description: '41418', + }, + { + title: 'cddis', + name: 'Cell Death & Disease', + }, + { + title: 'cddiscovery', + name: 'Cell Death Discovery', + }, + { + title: 'celldisc', + name: 'Cell Discovery', + }, + { + title: 'cr', + name: 'Cell Research', + id: '41422', + description: '41422', + }, + { + title: 'cmi', + name: 'Cellular & Molecular Immunology', + id: '41423', + description: '41423', + }, + { + title: 'commsbio', + name: 'Communications Biology', + }, + { + title: 'commschem', + name: 'Communications Chemistry', + }, + { + title: 'commsenv', + name: 'Communications Earth & Environment', + }, + { + title: 'commseng', + name: 'Communications Engineering', + }, + { + title: 'commsmat', + name: 'Communications Materials', + }, + { + title: 'commsmed', + name: 'Communications Medicine', + }, + { + title: 'commsphys', + name: 'Communications Physics', + }, + { + title: 'ejcn', + name: 'European Journal of Clinical Nutrition', + id: '41430', + description: '41430', + }, + { + title: 'ejhg', + name: 'European Journal of Human Genetics', + id: '41431', + description: '41431', + }, + { + title: 'ebd', + name: 'Evidence-Based Dentistry', + id: '41432', + description: '41432', + }, + { + title: 'emm', + name: 'Experimental & Molecular Medicine', + id: '12276', + description: '12276', + }, + { + title: 'eye', + name: 'Eye', + id: '41433', + description: '41433', + }, + { + title: 'gt', + name: 'Gene Therapy', + id: '41434', + description: '41434', + }, + { + title: 'gene', + name: 'Genes & Immunity', + id: '41435', + description: '41435', + }, + { + title: 'hdy', + name: 'Heredity', + id: '41437', + description: '41437', + }, + { + title: 'hgv', + name: 'Human Genome Variation', + }, + { + title: 'palcomms', + name: 'Humanities and Social Sciences Communications', + }, + { + title: 'hr', + name: 'Hypertension Research', + id: '41440', + description: '41440', + }, + { + title: 'ijir', + name: 'International Journal of Impotence Research', + id: '41443', + description: '41443', + }, + { + title: 'ijo', + name: 'International Journal of Obesity', + id: '41366', + description: '41366', + }, + { + title: 'ijosup', + name: 'International Journal of Obesity Supplements', + id: '41367', + description: '41367', + }, + { + title: 'ijos', + name: 'International Journal of Oral Science', + }, + { + title: 'ismecomms', + name: 'ISME Communications', + }, + { + title: 'ismej', + name: 'The ISME Journal', + id: '41396', + description: '41396', + }, + { + title: 'ja', + name: 'The Journal of Antibiotics', + id: '41429', + description: '41429', + }, + { + title: 'jes', + name: 'Journal of Exposure Science & Environmental Epidemiology', + id: '41370', + description: '41370', + }, + { + title: 'jhg', + name: 'Journal of Human Genetics', + id: '10038', + description: '10038', + }, + { + title: 'jhh', + name: 'Journal of Human Hypertension', + id: '41371', + description: '41371', + }, + { + title: 'jp', + name: 'Journal of Perinatology', + id: '41372', + description: '41372', + }, + { + title: 'laban', + name: 'Lab Animal', + id: '41684', + description: '41684', + }, + { + title: 'labinvest', + name: 'Laboratory Investigation', + id: '41374', + description: '41374', + }, + { + title: 'leu', + name: 'Leukemia', + id: '41375', + description: '41375', + }, + { + title: 'leusup', + name: 'Leukemia Supplements', + id: '41376', + description: '41376', + }, + { + title: 'lsa', + name: 'Light: Science & Applications', + }, + { + title: 'micronano', + name: 'Microsystems & Nanoengineering', + }, + { + title: 'modpathol', + name: 'Modern Pathology', + id: '41379', + description: '41379', + }, + { + title: 'mp', + name: 'Molecular Psychiatry', + id: '41380', + description: '41380', + }, + { + title: 'mi', + name: 'Mucosal Immunology', + id: '41385', + description: '41385', + }, + { + title: 'nature', + name: 'Nature', + }, + { + title: 'natafrica', + name: 'Nature Africa', + }, + { + title: 'nataging', + name: 'Nature Aging', + id: '43587', + description: '43587', + }, + { + title: 'natastron', + name: 'Nature Astronomy', + id: '41550', + description: '41550', + }, + { + title: 'natbiomedeng', + name: 'Nature Biomedical Engineering', + id: '41551', + description: '41551', + }, + { + title: 'nbt', + name: 'Nature Biotechnology', + id: '41587', + description: '41587', + }, + { + title: 'natcancer', + name: 'Nature Cancer', + id: '43018', + description: '43018', + }, + { + title: 'natcardiovascres', + name: 'Nature Cardiovascular Research', + id: '44161', + description: '44161', + }, + { + title: 'natcatal', + name: 'Nature Catalysis', + id: '41929', + description: '41929', + }, + { + title: 'ncb', + name: 'Nature Cell Biology', + id: '41556', + description: '41556', + }, + { + title: 'nchembio', + name: 'Nature Chemical Biology', + id: '41589', + description: '41589', + }, + { + title: 'nchem', + name: 'Nature Chemistry', + id: '41557', + description: '41557', + }, + { + title: 'nclimate', + name: 'Nature Climate Change', + id: '41558', + description: '41558', + }, + { + title: 'ncomms', + name: 'Nature Communications', + }, + { + title: 'natcomputsci', + name: 'Nature Computational Science', + id: '43588', + description: '43588', + }, + { + title: 'ndigest', + name: 'Nature Digest', + }, + { + title: 'natecolevol', + name: 'Nature Ecology & Evolution', + id: '41559', + description: '41559', + }, + { + title: 'natelectron', + name: 'Nature Electronics', + id: '41928', + description: '41928', + }, + { + title: 'nenergy', + name: 'Nature Energy', + id: '41560', + description: '41560', + }, + { + title: 'natfood', + name: 'Nature Food', + id: '43016', + description: '43016', + }, + { + title: 'ng', + name: 'Nature Genetics', + id: '41588', + description: '41588', + }, + { + title: 'ngeo', + name: 'Nature Geoscience', + id: '41561', + description: '41561', + }, + { + title: 'nathumbehav', + name: 'Nature Human Behaviour', + id: '41562', + description: '41562', + }, + { + title: 'ni', + name: 'Nature Immunology', + id: '41590', + description: '41590', + }, + { + title: 'natindia', + name: 'Nature India', + }, + { + title: 'natitaly', + name: 'Nature Italy', + }, + { + title: 'natmachintell', + name: 'Nature Machine Intelligence', + id: '42256', + description: '42256', + }, + { + title: 'nmat', + name: 'Nature Materials', + id: '41563', + description: '41563', + }, + { + title: 'nm', + name: 'Nature Medicine', + id: '41591', + description: '41591', + }, + { + title: 'natmentalhealth', + name: 'Nature Mental Health', + }, + { + title: 'natmetab', + name: 'Nature Metabolism', + id: '42255', + description: '42255', + }, + { + title: 'nmeth', + name: 'Nature Methods', + id: '41592', + description: '41592', + }, + { + title: 'nmicrobiol', + name: 'Nature Microbiology', + id: '41564', + description: '41564', + }, + { + title: 'nnano', + name: 'Nature Nanotechnology', + id: '41565', + description: '41565', + }, + { + title: 'neuro', + name: 'Nature Neuroscience', + id: '41593', + description: '41593', + }, + { + title: 'nphoton', + name: 'Nature Photonics', + id: '41566', + description: '41566', + }, + { + title: 'nphys', + name: 'Nature Physics', + id: '41567', + description: '41567', + }, + { + title: 'nplants', + name: 'Nature Plants', + id: '41477', + description: '41477', + }, + { + title: 'nprot', + name: 'Nature Protocols', + id: '41596', + description: '41596', + }, + { + title: 'natrevbioeng', + name: 'Nature Reviews Bioengineering', + }, + { + title: 'nrc', + name: 'Nature Reviews Cancer', + id: '41568', + description: '41568', + }, + { + title: 'nrcardio', + name: 'Nature Reviews Cardiology', + id: '41569', + description: '41569', + }, + { + title: 'natrevchem', + name: 'Nature Reviews Chemistry', + id: '41570', + description: '41570', + }, + { + title: 'nrclinonc', + name: 'Nature Reviews Clinical Oncology', + id: '41571', + description: '41571', + }, + { + title: 'nrdp', + name: 'Nature Reviews Disease Primers', + }, + { + title: 'nrd', + name: 'Nature Reviews Drug Discovery', + id: '41573', + description: '41573', + }, + { + title: 'natrevearthenviron', + name: 'Nature Reviews Earth & Environment', + id: '43017', + description: '43017', + }, + { + title: 'nrendo', + name: 'Nature Reviews Endocrinology', + id: '41574', + description: '41574', + }, + { + title: 'nrgastro', + name: 'Nature Reviews Gastroenterology & Hepatology', + id: '41575', + description: '41575', + }, + { + title: 'nrg', + name: 'Nature Reviews Genetics', + id: '41576', + description: '41576', + }, + { + title: 'nri', + name: 'Nature Reviews Immunology', + id: '41577', + description: '41577', + }, + { + title: 'natrevmats', + name: 'Nature Reviews Materials', + id: '41578', + description: '41578', + }, + { + title: 'nrmp', + name: 'Nature Reviews Methods Primers', + }, + { + title: 'nrmicro', + name: 'Nature Reviews Microbiology', + id: '41579', + description: '41579', + }, + { + title: 'nrm', + name: 'Nature Reviews Molecular Cell Biology', + id: '41580', + description: '41580', + }, + { + title: 'nrneph', + name: 'Nature Reviews Nephrology', + id: '41581', + description: '41581', + }, + { + title: 'nrneurol', + name: 'Nature Reviews Neurology', + id: '41582', + description: '41582', + }, + { + title: 'nrn', + name: 'Nature Reviews Neuroscience', + id: '41583', + description: '41583', + }, + { + title: 'natrevphys', + name: 'Nature Reviews Physics', + id: '42254', + description: '42254', + }, + { + title: 'nrpsychol', + name: 'Nature Reviews Psychology', + id: '44159', + description: '44159', + }, + { + title: 'nrrheum', + name: 'Nature Reviews Rheumatology', + id: '41584', + description: '41584', + }, + { + title: 'nrurol', + name: 'Nature Reviews Urology', + id: '41585', + description: '41585', + }, + { + title: 'nsmb', + name: 'Nature Structural & Molecular Biology', + id: '41594', + description: '41594', + }, + { + title: 'natsustain', + name: 'Nature Sustainability', + id: '41893', + description: '41893', + }, + { + title: 'natsynth', + name: 'Nature Synthesis', + id: '44160', + description: '44160', + }, + { + title: 'natwater', + name: 'Nature Water', + }, + { + title: 'npp', + name: 'Neuropsychopharmacology', + id: '41386', + description: '41386', + }, + { + title: 'am', + name: 'NPG Asia Materials', + }, + { + title: 'npj2dmaterials', + name: 'npj 2D Materials and Applications', + }, + { + title: 'npjamd', + name: 'npj Aging', + }, + { + title: 'npjbiodivers', + name: 'npj Biodiversity', + }, + { + title: 'npjbiofilms', + name: 'npj Biofilms and Microbiomes', + }, + { + title: 'npjbcancer', + name: 'npj Breast Cancer', + }, + { + title: 'npjcleanwater', + name: 'npj Clean Water', + }, + { + title: 'npjclimatsci', + name: 'npj Climate and Atmospheric Science', + }, + { + title: 'npjcompumats', + name: 'npj Computational Materials', + }, + { + title: 'npjdigitalmed', + name: 'npj Digital Medicine', + }, + { + title: 'npjflexelectron', + name: 'npj Flexible Electronics', + }, + { + title: 'npjgenmed', + name: 'npj Genomic Medicine', + }, + { + title: 'npjmatdeg', + name: 'npj Materials Degradation', + }, + { + title: 'npjmentalhealth', + name: 'npj Mental Health Research', + }, + { + title: 'npjmgrav', + name: 'npj Microgravity', + }, + { + title: 'npjparkd', + name: "npj Parkinson's Disease", + }, + { + title: 'npjprecisiononcology', + name: 'npj Precision Oncology', + }, + { + title: 'npjpcrm', + name: 'npj Primary Care Respiratory Medicine', + }, + { + title: 'npjqi', + name: 'npj Quantum Information', + }, + { + title: 'npjquantmats', + name: 'npj Quantum Materials', + }, + { + title: 'npjregenmed', + name: 'npj Regenerative Medicine', + }, + { + title: 'npjscifood', + name: 'npj Science of Food', + }, + { + title: 'npjscilearn', + name: 'npj Science of Learning', + }, + { + title: 'npjsba', + name: 'npj Systems Biology and Applications', + }, + { + title: 'npjurbansustain', + name: 'npj Urban Sustainability', + }, + { + title: 'npjvaccines', + name: 'npj Vaccines', + }, + { + title: 'nutd', + name: 'Nutrition & Diabetes', + }, + { + title: 'onc', + name: 'Oncogene', + id: '41388', + description: '41388', + }, + { + title: 'oncsis', + name: 'Oncogenesis', + }, + { + title: 'pr', + name: 'Pediatric Research', + id: '41390', + description: '41390', + }, + { + title: 'tpj', + name: 'The Pharmacogenomics Journal', + id: '41397', + description: '41397', + }, + { + title: 'pj', + name: 'Polymer Journal', + id: '41428', + description: '41428', + }, + { + title: 'pcan', + name: 'Prostate Cancer and Prostatic Diseases', + id: '41391', + description: '41391', + }, + { + title: 'npjschz', + name: 'Schizophrenia', + }, + { + title: 'scientificamerican', + name: 'Scientific American', + }, + { + title: 'scientificamericanmind', + name: 'Scientific American Mind', + }, + { + title: 'sdata', + name: 'Scientific Data', + }, + { + title: 'srep', + name: 'Scientific Reports', + }, + { + title: 'sigtrans', + name: 'Signal Transduction and Targeted Therapy', + }, + { + title: 'sc', + name: 'Spinal Cord', + id: '41393', + description: '41393', + }, + { + title: 'scsandc', + name: 'Spinal Cord Series and Cases', + }, + { + title: 'tp', + name: 'Translational Psychiatry', + }, + ], +}; + +module.exports = { + baseUrl, + getArticle, + getArticleList, + getDataLayer, + journalMap, +};