mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-21 12:49:53 +08:00
+22
-22
@@ -206,10 +206,10 @@ You can get all short name of a journal from <https://www.nature.com/siteindex>
|
||||
| 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 abstract is rendered in some researches
|
||||
- The journals from NPG are run by different group of people, and the website of may not be consitent for all the journals
|
||||
- Only abstract is rendered in some researches
|
||||
|
||||
</RouteEn>
|
||||
|
||||
@@ -228,8 +228,8 @@ You can get all short name of a journal from <https://www.nature.com/siteindex>
|
||||
| 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.
|
||||
- The journals from NPG are run by different group of people, and the website of may not be consitent for all the journals
|
||||
- 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
|
||||
|
||||
</RouteEn>
|
||||
|
||||
@@ -277,7 +277,7 @@ Only some journals are supported.
|
||||
|
||||
<RouteEn author="emdoe" example="/pnas/Applied Mathematics" path="/pnas/:topic" :paramsDesc="['topic name', 'obtain it from pnas.org (new research in ...)']" />
|
||||
|
||||
- Using router (`/pnas/` + Topic of Interest) to query latest research paper for a certain topic from PNAS journal.
|
||||
- Using router (`/pnas/` + Topic of Interest) to query latest research paper for a certain topic from PNAS journal.
|
||||
If the `:topic` parameter is blank, or equal to 'latest', then all the latest papers will return.
|
||||
|
||||
</RouteEn>
|
||||
@@ -300,41 +300,41 @@ In <https://pubmed.ncbi.nlm.nih.gov/trending/?filter=simsearch1.fha&filter=pubt.
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Science Journal
|
||||
## Science Magazine
|
||||
|
||||
### Current Issue
|
||||
|
||||
<RouteEn author="yech1990" example="/sciencemag/current/science" path="/sciencemag/research/:journal" :paramsDesc="['short name for a journal']" supportScihub="1"/>
|
||||
<RouteEn author="yech1990 TonyRL" example="/science/current/science" path="/science/current/:journal?" :paramsDesc="['Short name for a journal']" supportScihub="1" anticrawler="1" puppeteer="1" radar="1" rssbud="1"/>
|
||||
|
||||
| `:journal` | Full Name of the Journal | Route |
|
||||
| Short name | Full name of the journal | Route |
|
||||
| :--------: | :----------------------------: | ---------------------------------------------------------------------------------- |
|
||||
| science | Science | [/sciencemag/current/science](https://rsshub.app/sciencemag/current/science) |
|
||||
| advances | Science Advances | [/sciencemag/current/advances](https://rsshub.app/sciencemag/current/advances) |
|
||||
| immunology | Science Immunology | [/sciencemag/current/immunology](https://rsshub.app/sciencemag/current/immunology) |
|
||||
| robotics | Science Robotics | [/sciencemag/current/robotics](https://rsshub.app/sciencemag/current/robotics) |
|
||||
| stke | Science Signaling | [/sciencemag/current/stke](https://rsshub.app/sciencemag/current/stke) |
|
||||
| stm | Science Translational Medicine | [/sciencemag/current/stm](https://rsshub.app/sciencemag/current/stm) |
|
||||
| science | Science | [/science/current/science](https://rsshub.app/science/current/science) |
|
||||
| sciadv | Science Advances | [/science/current/sciadv](https://rsshub.app/science/current/sciadv) |
|
||||
| sciimmunol | Science Immunology | [/science/current/sciimmunol](https://rsshub.app/science/current/sciimmunol) |
|
||||
| scirobotics | Science Robotics | [/science/current/scirobotics](https://rsshub.app/science/current/scirobotics) |
|
||||
| signaling | Science Signaling | [/science/current/signaling](https://rsshub.app/science/current/signaling) |
|
||||
| stm | Science Translational Medicine | [/science/current/stm](https://rsshub.app/science/current/stm) |
|
||||
|
||||
- Using router (`/sciencemag/current/` + “short name for a journal”) to query current issue of a journal form AAAS.
|
||||
leave the parameter blank(`/sciencemag/current`)to get update from Science.
|
||||
- Using route (`/science/current/` + "short name for a journal") to get current issue of a journal from AAAS.
|
||||
- Leaving it empty (`/science/current`) to get update from Science.
|
||||
|
||||
</RouteEn>
|
||||
|
||||
### Cover Story
|
||||
|
||||
<RouteEn author="yech1990" example="/sciencemag/cover" path="/sciencemag/cover" />
|
||||
<RouteEn author="yech1990 TonyRL" example="/science/cover" path="/science/cover" anticrawler="1" radar="1" rssbud="1"/>
|
||||
|
||||
Subscribe to the cover images of the Science journals, and get the latest publication updates in time.
|
||||
Subscribe to the cover images of Science journals, and get the latest publication updates in time.
|
||||
|
||||
Including ‘Science’, 'Science Advances', 'Science Immunology', 'Science Robotics', 'Science Signaling' and 'Science Translational Medicine'.
|
||||
Including 'Science', 'Science Advances', 'Science Immunology', 'Science Robotics', 'Science Signaling' and 'Science Translational Medicine'.
|
||||
|
||||
</RouteEn>
|
||||
|
||||
### First Release
|
||||
|
||||
<RouteEn author="yech1990" example="/sciencemag/early/science" path="/sciencemag/early/science" supportScihub="1"/>
|
||||
<RouteEn author="yech1990 TonyRL" example="/science/early" path="/science/early/:journal?" :paramsDesc="['Short name for a journal']" supportScihub="1" anticrawler="1" puppeteer="1" radar="1" rssbud="1"/>
|
||||
|
||||
_only support Science Journal_
|
||||
*only Science, Science Immunology and Science Translational Medicine have first release*
|
||||
|
||||
</RouteEn>
|
||||
|
||||
|
||||
+16
-16
@@ -271,37 +271,37 @@ You can get all short name of a journal from <https://www.nature.com/siteindex>
|
||||
|
||||
### 本期刊物
|
||||
|
||||
<Route author="yech1990" example="/sciencemag/current/science" path="/sciencemag/current/:journal" :paramsDesc="['期刊名简写']" supportScihub="1"/>
|
||||
<Route author="yech1990 TonyRL" example="/science/current/science" path="/science/current/:journal" :paramsDesc="['期刊名简写']" supportScihub="1" anticrawler="1" puppeteer="1" radar="1" rssbud="1"/>
|
||||
|
||||
| `:journal` | 期刊名 | 路由 |
|
||||
| :--------: | :----------------------------: | ---------------------------------------------------------------------------------- |
|
||||
| science | Science | [/sciencemag/current/science](https://rsshub.app/sciencemag/current/science) |
|
||||
| advances | Science Advances | [/sciencemag/current/advances](https://rsshub.app/sciencemag/current/advances) |
|
||||
| immunology | Science Immunology | [/sciencemag/current/immunology](https://rsshub.app/sciencemag/current/immunology) |
|
||||
| robotics | Science Robotics | [/sciencemag/current/robotics](https://rsshub.app/sciencemag/current/robotics) |
|
||||
| stke | Science Signaling | [/sciencemag/current/stke](https://rsshub.app/sciencemag/current/stke) |
|
||||
| stm | Science Translational Medicine | [/sciencemag/current/stm](https://rsshub.app/sciencemag/current/stm) |
|
||||
| 简写 | 期刊名 | 路由 |
|
||||
| :---------: | :----------------------------: | ------------------------------------------------------------------------------ |
|
||||
| science | Science | [/science/current/science](https://rsshub.app/science/current/science) |
|
||||
| sciadv | Science Advances | [/science/current/sciadv](https://rsshub.app/science/current/sciadv) |
|
||||
| sciimmunol | Science Immunology | [/science/current/sciimmunol](https://rsshub.app/science/current/sciimmunol) |
|
||||
| scirobotics | Science Robotics | [/science/current/scirobotics](https://rsshub.app/science/current/scirobotics) |
|
||||
| signaling | Science Signaling | [/science/current/signaling](https://rsshub.app/science/current/signaling) |
|
||||
| stm | Science Translational Medicine | [/science/current/stm](https://rsshub.app/science/current/stm) |
|
||||
|
||||
- 通过 `/sciencemag/current/` + “杂志简写” 来获取对应杂志最新一期的文章(Current Issue)。
|
||||
若参数置空(`/sciencemag/current`),则默认获取主刊(Science)的最新文章。
|
||||
- 通过 `/science/current/` + "期刊名简写" 来获取对应杂志最新一期的文章(Current Issue)。
|
||||
若参数置空(`/science/current`),则默认获取主刊(Science)的最新文章。
|
||||
|
||||
</Route>
|
||||
|
||||
### 封面故事
|
||||
|
||||
<Route author="yech1990" example="/sciencemag/cover" path="/sciencemag/cover" />
|
||||
<Route author="yech1990 TonyRL" example="/science/cover" path="/science/cover" anticrawler="1" radar="1" rssbud="1"/>
|
||||
|
||||
订阅 Science 系列杂志的封面图片,并及时获取刊物更新状态。
|
||||
|
||||
包含了: ‘Science’, 'Science Advances', 'Science Immunology', 'Science Robotics', 'Science Signaling' 和 'Science Translational Medicine'。
|
||||
包含了: 'Science', 'Science Advances', 'Science Immunology', 'Science Robotics', 'Science Signaling' 和 'Science Translational Medicine'。
|
||||
|
||||
</Route>
|
||||
|
||||
### 主刊 - 在线发表
|
||||
### 在线发表
|
||||
|
||||
<Route author="yech1990" example="/sciencemag/early/science" path="/sciencemag/early/science" supportScihub="1"/>
|
||||
<Route author="yech1990 TonyRL" example="/science/early" path="/science/early/:journal?" :paramsDesc="['期刊名简写']" supportScihub="1" anticrawler="1" puppeteer="1" radar="1" rssbud="1"/>
|
||||
|
||||
*仅支持 Science 主刊*
|
||||
*仅 Science, Science Immunology 和 Science Translational Medicine 提供在线发表*
|
||||
|
||||
</Route>
|
||||
|
||||
|
||||
+3
-3
@@ -2186,9 +2186,9 @@ router.get('/cell/cover', lazyloadRouteHandler('./routes/cell/cover'));
|
||||
// router.get('/nature/highlight/:year?', lazyloadRouteHandler('./routes/nature/highlight'));
|
||||
|
||||
// science [Sci Journal]
|
||||
router.get('/sciencemag/current/:journal?', lazyloadRouteHandler('./routes/sciencemag/current'));
|
||||
router.get('/sciencemag/cover', lazyloadRouteHandler('./routes/sciencemag/cover'));
|
||||
router.get('/sciencemag/early/science', lazyloadRouteHandler('./routes/sciencemag/early'));
|
||||
// router.get('/sciencemag/current/:journal?', lazyloadRouteHandler('./routes/sciencemag/current'));
|
||||
// router.get('/sciencemag/cover', lazyloadRouteHandler('./routes/sciencemag/cover'));
|
||||
// router.get('/sciencemag/early/science', lazyloadRouteHandler('./routes/sciencemag/early'));
|
||||
|
||||
// dlsite
|
||||
router.get('/dlsite/new/:type', lazyloadRouteHandler('./routes/dlsite/new'));
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
// journals form AAAS publishing group
|
||||
//
|
||||
// science: Science
|
||||
// advances: Science Advances
|
||||
// immunology: Science Immunology
|
||||
// robotics: Science Robotics
|
||||
// stke: Science Signaling
|
||||
// stm: Science Translational Medicine
|
||||
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const pageURL = 'https://www.sciencemag.org/journals';
|
||||
|
||||
const pageResponse = await got.get(pageURL);
|
||||
const $ = cheerio.load(pageResponse.data);
|
||||
|
||||
const items = $('[class^="view-highwire-blocks-hw-"]')
|
||||
.map((_, elem) => {
|
||||
// eg, www.sciencemag.org/sites/default/files/styles/240x300__4_3_/public/highwire/covers/scitransmed/12/532/-F1.medium.gif?itok=aOwRMF-8
|
||||
const { id, vol, no } = $('div.media__icon > a > img', elem)
|
||||
.attr('src')
|
||||
.match(/\/covers\/(?<id>\w+)\/(?<vol>\d+)\/(?<no>\d+)\//).groups;
|
||||
const url = $('div.media__body > ul > li > a', elem)
|
||||
.filter((_, el) => $(el).text() === 'Current Issue')
|
||||
.attr('href')
|
||||
.replace(/^http:/, 'https:')
|
||||
.replace(/\/$/, '');
|
||||
const name = $('div.media__body > h2', elem).text();
|
||||
const date = $('div.media__body > p > span', elem).text();
|
||||
|
||||
// eg, https://advances.sciencemag.org/content/6/8
|
||||
const address = `${url}/content/${vol}/${no}`;
|
||||
// eg, https://immunology.sciencemag.org/content/immunology/5/44/F1.medium.gif
|
||||
const imageURL = `${url}/content/${id}/${vol}/${no}/F1.medium.gif`;
|
||||
const contents = `<div align="center"><img src="${imageURL}" alt="Vol. ${vol} No. ${no}" width="550" height="auto"></div>`;
|
||||
|
||||
return {
|
||||
title: `${name} | Vol. ${vol} No. ${no}`,
|
||||
author: '@yech1990',
|
||||
description: contents,
|
||||
link: address,
|
||||
guid: address,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Science Covers Story',
|
||||
description: 'Find out the cover story of some Science journals.',
|
||||
link: pageURL,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -1,123 +0,0 @@
|
||||
// journals form AAAS publishing group
|
||||
//
|
||||
// science: Science
|
||||
// advances: Science Advances
|
||||
// immunology: Science Immunology
|
||||
// robotics: Science Robotics
|
||||
// stke: Science Signaling
|
||||
// stm: Science Translational Medicine
|
||||
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const journal = ctx.params.journal || 'science';
|
||||
const baseURL = `https://${journal}.sciencemag.org`;
|
||||
|
||||
const pageURL = baseURL;
|
||||
const pageResponse = await got.get(pageURL);
|
||||
const pageCapture = cheerio.load(pageResponse.data);
|
||||
|
||||
const pageTitleName = pageCapture('head > title').text() || `Science (${journal})`;
|
||||
|
||||
// just select paper relative sections
|
||||
const sectionList = ['research-articles', 'review', 'reports'];
|
||||
|
||||
const list = [].concat.apply(
|
||||
[],
|
||||
sectionList.map((section) => {
|
||||
const sectionContent = pageCapture(`ul > li.issue-toc-section.issue-toc-section-${section}`).html();
|
||||
if (sectionContent !== null) {
|
||||
const sec = cheerio.load(sectionContent);
|
||||
const sectionName = sec('h2').text();
|
||||
const sectionList = sec('ul > li > div > div > article > div').append(`<div class="toc-section-type">${sectionName}</div>`).get();
|
||||
return sectionList;
|
||||
}
|
||||
return [];
|
||||
})
|
||||
);
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
|
||||
const title = $('h3').text();
|
||||
const partial = $('h3 > a').attr('href');
|
||||
const address = `${baseURL}${partial}`;
|
||||
const section = $('div .toc-section-type').text();
|
||||
|
||||
let author;
|
||||
const authorList = $('span.highwire-citation-authors > span.highwire-citation-author')
|
||||
.map((_, el) => $(el).text())
|
||||
.get();
|
||||
if (authorList.length > 5) {
|
||||
author = authorList.slice(0, 5).join(', ') + ' et al.';
|
||||
} else {
|
||||
author = authorList.join(', ');
|
||||
}
|
||||
|
||||
const time = new Date($('p.highwire-cite-metadata > time').text()).toUTCString();
|
||||
|
||||
const cache = await ctx.cache.get(address);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
// contents
|
||||
// section content
|
||||
let sectionContents = '';
|
||||
if (section !== '') {
|
||||
sectionContents = `
|
||||
<div id="content-section">
|
||||
<span style="color: #d40016; text-transform: uppercase; font-weight: 700;">${section}</span>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
// brief content
|
||||
const brief = $('div.highwire-cite-snippet > div > div > p').text();
|
||||
let briefContents = '';
|
||||
if (brief !== '') {
|
||||
briefContents = `
|
||||
<div id="content-brief">
|
||||
<p>${brief}</p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
const itemPage = await got.get(address);
|
||||
const itemCapture = cheerio.load(itemPage.data);
|
||||
|
||||
const abs = itemCapture('div > div.article > div.section')
|
||||
.map((_, el) => $(el).html())
|
||||
.get()
|
||||
.join('<br>');
|
||||
|
||||
// abs content
|
||||
let absContents = '';
|
||||
if (abs !== null) {
|
||||
absContents = `
|
||||
<div id="content-abs">
|
||||
${abs}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
const contents = sectionContents + briefContents + absContents;
|
||||
|
||||
const single = {
|
||||
title,
|
||||
author,
|
||||
description: contents,
|
||||
link: address,
|
||||
guid: address,
|
||||
pubDate: time,
|
||||
};
|
||||
ctx.cache.set(address, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: `${pageTitleName} | Current Issue`,
|
||||
description: `Current Issue of ${pageTitleName}`,
|
||||
link: baseURL,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
@@ -1,97 +0,0 @@
|
||||
// only support Science journal
|
||||
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const base = `https://science.sciencemag.org/content/early/recent`;
|
||||
|
||||
const res = await got.get(base);
|
||||
const pageCapture = cheerio.load(res.data);
|
||||
|
||||
const list = pageCapture('ul > li > div > article > div').get();
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
|
||||
const title = $('h3').text();
|
||||
const partial = $('h3 > a').attr('href');
|
||||
const address = `${base}${partial}`;
|
||||
|
||||
let author;
|
||||
const authorList = $('span.highwire-citation-authors > span.highwire-citation-author')
|
||||
.map((i, el) => $(el).text())
|
||||
.get();
|
||||
if (authorList.length > 5) {
|
||||
author = authorList.slice(0, 5).join(', ') + ' <i>et al.</i>';
|
||||
} else {
|
||||
author = authorList.join(', ');
|
||||
}
|
||||
|
||||
const time = new Date($('p.highwire-cite-metadata > time').text()).toUTCString();
|
||||
|
||||
const cache = await ctx.cache.get(address);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
// contents
|
||||
// brief content
|
||||
const brief = $('div.highwire-cite-snippet > div > div > p').text();
|
||||
let briefContents = '';
|
||||
if (brief !== '') {
|
||||
briefContents = `
|
||||
<div id="content-brief">
|
||||
<p>${brief}</p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
const itemPage = await got.get(address);
|
||||
const itemCapture = cheerio.load(itemPage.data);
|
||||
// section content
|
||||
const section = itemCapture('header > div.overline').text();
|
||||
let sectionContents = '';
|
||||
if (section !== '') {
|
||||
sectionContents = `
|
||||
<div id="content-section">
|
||||
<span style="color: #d40016; text-transform: uppercase; font-weight: 700;">${section}</span>
|
||||
<span style="color: grey; text-transform: uppercase; font-weight: 700;">[Published Online]</span>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
// abs content
|
||||
const abs = itemCapture('div > div.abstract-view > div.section')
|
||||
.map((i, el) => $(el).html())
|
||||
.get()
|
||||
.join('<br>');
|
||||
let absContents = '';
|
||||
if (abs !== null) {
|
||||
absContents = `
|
||||
<div id="content-abs">
|
||||
${abs}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
const contents = sectionContents + briefContents + absContents;
|
||||
|
||||
const single = {
|
||||
title,
|
||||
author,
|
||||
description: contents,
|
||||
link: address,
|
||||
guid: address,
|
||||
pubDate: time,
|
||||
};
|
||||
ctx.cache.set(address, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: `Science | First Release`,
|
||||
description: `Science, a research journal. For papers that published online.`,
|
||||
link: base,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
// journals form AAAS publishing group
|
||||
//
|
||||
// science: Science
|
||||
// sciadv: Science Advances
|
||||
// sciimmunol: Science Immunology
|
||||
// scirobotics: Science Robotics
|
||||
// signaling: Science Signaling
|
||||
// stm: Science Translational Medicine
|
||||
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
const { baseUrl } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const pageURL = `${baseUrl}/journals`;
|
||||
|
||||
const { data: pageResponse } = await got(pageURL, {
|
||||
headers: {
|
||||
cookie: 'cookiePolicy=iaccept;',
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(pageResponse);
|
||||
|
||||
const items = $('.browse-journals .browse-journals__item')
|
||||
.not('.partner-journals')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const name = item.find('.row h2').first().text().trim();
|
||||
const volume = item
|
||||
.find('.row li')
|
||||
.eq(0)
|
||||
.text()
|
||||
.trim()
|
||||
.match(/Volume (\d+)/)[1];
|
||||
const issue = item
|
||||
.find('.row li')
|
||||
.eq(1)
|
||||
.text()
|
||||
.trim()
|
||||
.match(/Issue (\d+)/)[1];
|
||||
const date = item.find('.row li').eq(2).text().trim();
|
||||
const coverUrl = `${baseUrl}${item.find('.cover-image__popup-moving-cover').attr('data-cover-src')}`;
|
||||
const content = $('.cover-image__popup-view__caption-wrapper').html();
|
||||
const link = $('.browse-journals__item__links a').eq(0).attr('href').replace('/current', '');
|
||||
|
||||
return {
|
||||
title: `${name} | Volume ${volume} Issue ${issue}`,
|
||||
description: art(path.join(__dirname, 'templates/cover.art'), {
|
||||
coverUrl,
|
||||
content,
|
||||
}),
|
||||
link: `${baseUrl}/${link}/${volume}/${issue}`,
|
||||
pubDate: parseDate(date),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('head title').text(),
|
||||
description: $('meta[property="og:description"]').attr('content'),
|
||||
image: `${baseUrl}/apple-touch-icon.png`,
|
||||
link: pageURL,
|
||||
language: 'en-US',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
// journals form AAAS publishing group
|
||||
//
|
||||
// science: Science
|
||||
// sciadv: Science Advances
|
||||
// sciimmunol: Science Immunology
|
||||
// scirobotics: Science Robotics
|
||||
// signaling: Science Signaling
|
||||
// stm: Science Translational Medicine
|
||||
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const { baseUrl, fetchDesc, getItem } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { journal = 'science' } = ctx.params;
|
||||
const pageURL = `${baseUrl}/toc/${journal}/current`;
|
||||
|
||||
const { data: pageResponse } = await got(pageURL, {
|
||||
headers: {
|
||||
cookie: 'cookiePolicy=iaccept;',
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(pageResponse);
|
||||
const pageTitleName = $('head > title').text();
|
||||
|
||||
const list = $('.toc__section .card')
|
||||
.toArray()
|
||||
.map((item) => getItem(item, $));
|
||||
|
||||
const browser = await require('@/utils/puppeteer')();
|
||||
const items = await fetchDesc(list, browser, ctx.cache.tryGet);
|
||||
await browser.close();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${pageTitleName} | Current Issue`,
|
||||
description: `Current Issue of ${pageTitleName}`,
|
||||
image: `${baseUrl}/apple-touch-icon.png`,
|
||||
link: pageURL,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
const { baseUrl, fetchDesc, getItem } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { journal = 'science' } = ctx.params;
|
||||
const pageUrl = `${baseUrl}/toc/${journal}/0/0`;
|
||||
|
||||
const { data: res } = await got(pageUrl, {
|
||||
headers: {
|
||||
cookie: 'cookiePolicy=iaccept;',
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(res);
|
||||
|
||||
const list = $('.card-content .card-header')
|
||||
.toArray()
|
||||
.map((item) => getItem(item, $));
|
||||
|
||||
const browser = await require('@/utils/puppeteer')();
|
||||
const items = await fetchDesc(list, browser, ctx.cache.tryGet);
|
||||
await browser.close();
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('head title').text(),
|
||||
description: $('.body02').text().trim(),
|
||||
image: `${baseUrl}/apple-touch-icon.png`,
|
||||
link: pageUrl,
|
||||
language: 'en-US',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
'/cover': ['yech1990', 'TonyRL'],
|
||||
'/current/:journal?': ['yech1990', 'TonyRL'],
|
||||
'/early/:journal?': ['yech1990', 'TonyRL'],
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
module.exports = {
|
||||
'science.org': {
|
||||
_name: 'Science Magazine',
|
||||
'.': [
|
||||
{
|
||||
title: '本期刊物',
|
||||
docs: 'https://docs-rsshub.pages.dev/journal.html#science-xi-lie',
|
||||
source: ['/journal/:journal', '/toc/:journal/current'],
|
||||
target: '/science/current/:journal',
|
||||
},
|
||||
{
|
||||
title: '封面故事',
|
||||
docs: 'https://docs-rsshub.pages.dev/journal.html#science-xi-lie',
|
||||
source: ['/'],
|
||||
target: '/science/cover',
|
||||
},
|
||||
{
|
||||
title: '在线发表',
|
||||
docs: 'https://docs-rsshub.pages.dev/journal.html#science-xi-lie',
|
||||
source: ['/journal/:journal', '/toc/:journal/0/0'],
|
||||
target: '/science/early/:journal',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/cover', require('./cover'));
|
||||
router.get('/current/:journal?', require('./current'));
|
||||
router.get('/early/:journal?', require('./early'));
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
{{ if abs }}{{@ abs }}{{ /if }}
|
||||
{{ if content }}<br>{{@ content }}{{ /if }}
|
||||
@@ -0,0 +1,2 @@
|
||||
<img src="{{ coverUrl }}">
|
||||
{{@ content }}
|
||||
@@ -0,0 +1,64 @@
|
||||
const cheerio = require('cheerio');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const baseUrl = 'https://www.science.org';
|
||||
|
||||
const fetchDesc = (list, browser, tryGet) =>
|
||||
Promise.all(
|
||||
list.map((item) =>
|
||||
tryGet(item.link, async () => {
|
||||
const page = await browser.newPage();
|
||||
await page.setRequestInterception(true);
|
||||
page.on('request', (request) => {
|
||||
request.resourceType() === 'document' || request.resourceType() === 'script' ? request.continue() : request.abort();
|
||||
});
|
||||
|
||||
await page.goto(item.link, {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
await page.waitForSelector('section#frontmatter, .news-article-content, .news-article-content--featured');
|
||||
const res = await page.evaluate(() => document.documentElement.innerHTML);
|
||||
await page.close();
|
||||
|
||||
const $ = cheerio.load(res);
|
||||
const abstract = $('div#abstracts').html();
|
||||
const content = $('.news-article-content--featured').length
|
||||
? $('.news-article-content--featured').html()
|
||||
: $('.news-article-content').length
|
||||
? $('.news-article-content').html()
|
||||
: $('.info-panel__formats a.btn__request-access').length
|
||||
? ''
|
||||
: $('section#bodymatter').html();
|
||||
|
||||
item.description = art(path.join(__dirname, 'templates/article.art'), {
|
||||
abs: abstract,
|
||||
content,
|
||||
});
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
const getItem = (item, $) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.article-title a').attr('title'),
|
||||
link: `${baseUrl}${item.find('.article-title a').attr('href')}`,
|
||||
doi: item.find('.article-title a').attr('href').replace('/doi/', ''),
|
||||
pubDate: parseDate(item.find('.card-meta__item time').text()),
|
||||
author: item
|
||||
.find('.card-meta ul[title="list of authors"] li')
|
||||
.toArray()
|
||||
.map((author) => $(author).text())
|
||||
.join(', '),
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
baseUrl,
|
||||
fetchDesc,
|
||||
getItem,
|
||||
};
|
||||
Reference in New Issue
Block a user