feat(route): add ELSEVIER journal (#8583)
This commit is contained in:
@@ -68,6 +68,20 @@ Including 'cell', 'cancer-cell', 'cell-chemical-biology', 'cell-host-microbe', '
|
||||
|
||||
<RouteEn author="emdoe" example="/elife/cell-biology" path="/elife/:subject" :paramsDesc="['topic name', 'obtain it from the homepage. `latest` will include all topics.']" supportScihub="1"/>
|
||||
|
||||
## ELSEVIER
|
||||
|
||||
### Latest Research
|
||||
|
||||
<RouteEn author="Derekmini sunsunwolf-swb" example="/elsevier/signal-processing/latest" path="/elsevier/:journal/latest" :paramsDesc="['Journal Name, get it from tocSection of the URL.']" radar="1" rssbud="1">
|
||||
|
||||
</RouteEn>
|
||||
|
||||
### Special Volume
|
||||
|
||||
<RouteEn author="Derekmini sunsunwolf-swb" example="/elsevier/signal-processing/vol/192" path="/elsevier/:journal/vol/:id" :paramsDesc="['Journal Name, get it from tocSection of the URL','Volume Number, get it from the Journal Website (If `Issue` exist, must use `Volume-Issue`, e.g., `/elsevier/aace-clinical-case-reports/vol/7-6`)']" radar="1" rssbud="1">
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Google Scholar
|
||||
|
||||
### Keywords Monitoring
|
||||
|
||||
@@ -80,6 +80,20 @@ pageClass: routes
|
||||
|
||||
<Route author="emdoe HenryQW" example="/elife/cell-biology" path="/elife/:subject" :paramsDesc="['方向名称', '请在主页获取。`latest` 则为全部。']" supportScihub="1"/>
|
||||
|
||||
## ELSEVIER
|
||||
|
||||
### 最新文章
|
||||
|
||||
<Route author="Derekmini sunsunwolf-swb" example="/elsevier/signal-processing/latest" path="/elsevier/:journal/latest" :paramsDesc="['期刊名称,复制 URL 中 tocSection 部分']" radar="1" rssbud="1">
|
||||
|
||||
</Route>
|
||||
|
||||
### 指定卷中的文章
|
||||
|
||||
<Route author="Derekmini sunsunwolf-swb" example="/elsevier/signal-processing/vol/192" path="/elsevier/:journal/vol/:id" :paramsDesc="['期刊名称,复制 URL 中 tocSection 部分','卷号 (如果 `Issue` 存在, 使用 `Volume-Issue`, e.g., `/elsevier/aace-clinical-case-reports/vol/7-6`)']" radar="1" rssbud="1">
|
||||
|
||||
</Route>
|
||||
|
||||
## IEEE Xplore
|
||||
|
||||
### 作者
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('@/config').value;
|
||||
const path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const host = 'https://www.sciencedirect.com';
|
||||
const journal = ctx.params.journal;
|
||||
const hostUrl = host.concat('/journal/', journal);
|
||||
const resp = await got(host);
|
||||
const cookie = resp.headers['set-cookie'].join(' ');
|
||||
const headers = {
|
||||
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9',
|
||||
Referer: 'https://id.elsevier.com/',
|
||||
Host: host.replace('https://', ''),
|
||||
'User-Agent': config.ua,
|
||||
cookie,
|
||||
};
|
||||
|
||||
const preResponse = await got({
|
||||
method: 'get',
|
||||
url: hostUrl,
|
||||
headers,
|
||||
});
|
||||
const $1 = cheerio.load(preResponse.data);
|
||||
const jrnlName = $1('.anchor.js-title-link').text();
|
||||
const ltstUrl = host.concat($1('.anchor.js-volume').attr('href'));
|
||||
let volume = '';
|
||||
if (ltstUrl.match('suppl') !== null) {
|
||||
volume = 'Volume ' + ltstUrl.match('vol/(.*)/suppl')[1];
|
||||
} else if (ltstUrl.match('issue') !== null) {
|
||||
volume = 'Volume ' + ltstUrl.match('vol/(.*)/issue')[1] + ' Issue ' + ltstUrl.match('/issue/(.*)')[1];
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: ltstUrl,
|
||||
headers,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('.js-article')
|
||||
.map((_, item) => {
|
||||
const title = $(item).find('.js-article-title').text();
|
||||
const authors = $(item).find('.js-article__item__authors').text();
|
||||
const link = $(item).find('.article-content-title').attr('href');
|
||||
const id = $(item).find('.article-content-title').attr('id');
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
id,
|
||||
authors,
|
||||
volume,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const renderDesc = (item) =>
|
||||
art(path.join(__dirname, 'templates/description.art'), {
|
||||
item,
|
||||
});
|
||||
await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const itemResponse = await got({
|
||||
method: 'get',
|
||||
url: host.concat('/science/article/pii/', item.id),
|
||||
headers,
|
||||
});
|
||||
const content = cheerio.load(itemResponse.data);
|
||||
content('.section-title').remove();
|
||||
const doi = content('.doi').attr('href').replace('https://doi.org/', '');
|
||||
item.doi = doi;
|
||||
item.abstract = content('.abstract.author').html();
|
||||
item.description = renderDesc(item);
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: jrnlName.concat(' - Latest'),
|
||||
link: hostUrl,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/:journal/latest': ['Derekmini', 'sunsunwolf-swb'],
|
||||
'/:journal/vol/:id': ['Derekmini', 'sunsunwolf-swb'],
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
'sciencedirect.com': {
|
||||
_name: 'Elsevier',
|
||||
www: [
|
||||
{
|
||||
title: 'latest',
|
||||
docs: 'https://docs.rsshub.app/journal.html#Elsevier',
|
||||
source: '/journal/:journal/*',
|
||||
target: '/elsevier/:journal/latest',
|
||||
},
|
||||
{
|
||||
title: 'volume',
|
||||
docs: 'https://docs.rsshub.app/journal.html#Elsevier',
|
||||
source: '/journal/:journal/vol/:id',
|
||||
target: '/elsevier/:journal/vol/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/:journal/latest', require('./latest'));
|
||||
router.get('/:journal/vol/:id', require('./volume'));
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
<p>
|
||||
<span><big>{{ item.title }}</big></span><br />
|
||||
<span><small><i>{{ item.authors }}</i></small></span><br />
|
||||
<span><small><i>https://doi.org/{{ item.doi }}</i></small></span><br />
|
||||
<span><small><i>{{ item.volume }}</i></small></span><br />
|
||||
</p>
|
||||
<p>
|
||||
<span>{{ item.abstract }}</span><br />
|
||||
</p>
|
||||
@@ -0,0 +1,75 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('@/config').value;
|
||||
const path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const host = 'https://www.sciencedirect.com';
|
||||
const journal = ctx.params.journal;
|
||||
const volume = 'Volume ' + ctx.params.id.replace('-', ' Issue ');
|
||||
const volUrl = 'https://www.sciencedirect.com/journal/' + journal + '/vol/' + ctx.params.id.replace('-', '/issue/');
|
||||
const resp = await got(host);
|
||||
const cookie = resp.headers['set-cookie'].join(' ');
|
||||
const headers = {
|
||||
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9',
|
||||
Referer: 'https://id.elsevier.com/',
|
||||
Host: host.replace('https://', ''),
|
||||
'User-Agent': config.ua,
|
||||
cookie,
|
||||
};
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: volUrl,
|
||||
headers,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const jrnlName = $('.anchor.js-title-link').text();
|
||||
const list = $('.js-article')
|
||||
.map((_, item) => {
|
||||
const title = $(item).find('.js-article-title').text();
|
||||
const authors = $(item).find('.js-article__item__authors').text();
|
||||
const link = $(item).find('.article-content-title').attr('href');
|
||||
const id = $(item).find('.article-content-title').attr('id');
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
id,
|
||||
authors,
|
||||
volume,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const renderDesc = (item) =>
|
||||
art(path.join(__dirname, 'templates/description.art'), {
|
||||
item,
|
||||
});
|
||||
await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const itemResponse = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.sciencedirect.com/science/article/pii/' + item.id,
|
||||
headers,
|
||||
});
|
||||
const content = cheerio.load(itemResponse.data);
|
||||
content('.section-title').remove();
|
||||
const doi = content('.doi').attr('href').replace('https://doi.org/', '');
|
||||
item.doi = doi;
|
||||
item.abstract = content('.abstract.author').html();
|
||||
item.description = renderDesc(item);
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: jrnlName.concat(' - ', volume),
|
||||
link: volUrl,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user