feat(route)!: remove JASA in journal (#9971)

* feat(route): remove JASA in journal;

* feat(fix docs): add `/scitation/...` to path in journal.md(en/zh)
This commit is contained in:
Derek
2022-06-18 23:14:24 +08:00
committed by GitHub
parent 1e5cab9d1a
commit be32ca0e95
8 changed files with 4 additions and 243 deletions

View File

@@ -140,24 +140,6 @@ The parameter id in the route is the id in the URL of the user's Google Scholar
<RouteEn author="Fatpandac" example="/informs/mnsc" path="/informs/:category?" :paramsDesc="['Category, can be found in the url of the page, `orsc` by default']"/>
## JASA
### Latest Research
<RouteEn author="Derekmini auto-bot-ty" example="/jasa/latest" path="/jasa/latest" radar="1" rssbud="1">
</RouteEn>
### Section Research
<RouteEn author="Derekmini" example="/jasa/section/ANIMAL+BIOACOUSTICS" path="/jasa/section/:id" :paramsDesc="['Section Name, get it from tocSection of the URL']" radar="1" rssbud="1">
| Section | REFLECTIONS | ANIMAL BIOACOUSTICS | others |
| :-----: | :---------: | :-----------------: | :----: |
| `:id` | REFLECTIONS | ANIMAL+BIOACOUSTICS | ... |
</RouteEn>
## MIT Technology Review
<RouteEn author="zphw" example="/technologyreview" path="/technologyreview" />
@@ -346,11 +328,11 @@ _only support Science Journal_
### Journal
<RouteEn author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp" path="/:pub/:jrn" :paramsDesc="['Publisher, the part of the URL before `scitation.org`','Journal, the part of the URL after `/toc/`']" radar="1" rssbud="1"/>
<RouteEn author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp" path="/scitation/:pub/:jrn" :paramsDesc="['Publisher, the part of the URL before `scitation.org`','Journal, the part of the URL after `/toc/`']" radar="1" rssbud="1"/>
### Section
<RouteEn author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp/COMPUTATIONAL+PHYSICS" path="/:pub/:jrn/:sec" :paramsDesc="['Publisher, the part of the URL before `scitation.org`','Journal, the part of the URL after `/toc/`','Section, the `tocSection` part of the URL']" radar="1" rssbud="1"/>
<RouteEn author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp/COMPUTATIONAL+PHYSICS" path="/scitation/:pub/:jrn/:sec" :paramsDesc="['Publisher, the part of the URL before `scitation.org`','Journal, the part of the URL after `/toc/`','Section, the `tocSection` part of the URL']" radar="1" rssbud="1"/>
## Springer

View File

@@ -134,24 +134,6 @@ pageClass: routes
<Route author="Fatpandac" example="/informs/mnsc" path="/informs/:category?" :paramsDesc="['类型, 可以在 url 中得到,默认为 `orsc`']"/>
## JASA
### 最新文章
<Route author="Derekmini auto-bot-ty" example="/jasa/latest" path="/jasa/latest" radar="1" rssbud="1">
</Route>
### 专栏
<Route author="Derekmini" example="/jasa/section/ANIMAL+BIOACOUSTICS" path="/jasa/section/:id" :paramsDesc="['专栏名称,复制 URL 中 tocSection 部分']" radar="1" rssbud="1">
| Section | REFLECTIONS | ANIMAL BIOACOUSTICS | others |
| :-----: | :---------: | :-----------------: | :----: |
| `:id` | REFLECTIONS | ANIMAL+BIOACOUSTICS | ... |
</Route>
## Nature 系列
::: tip Tips
@@ -313,11 +295,11 @@ You can get all short name of a journal from <https://www.nature.com/siteindex>
### 期刊
<Route author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp" path="/:pub/:jrn" :paramsDesc="['出版社URL 中 `scitation.org` 前部分','期刊URL 中 `/toc/` 后部分']" radar="1" rssbud="1"/>
<Route author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp" path="/scitation/:pub/:jrn" :paramsDesc="['出版社URL 中 `scitation.org` 前部分','期刊URL 中 `/toc/` 后部分']" radar="1" rssbud="1"/>
### 专栏
<Route author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp/COMPUTATIONAL+PHYSICS" path="/:pub/:jrn/:sec" :paramsDesc="['出版社URL 中 `scitation.org` 前部分','期刊URL 中 `/toc/` 后部分','专栏URL 中 `tocSection` 部分']" radar="1" rssbud="1"/>
<Route author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp/COMPUTATIONAL+PHYSICS" path="/scitation/:pub/:jrn/:sec" :paramsDesc="['出版社URL 中 `scitation.org` 前部分','期刊URL 中 `/toc/` 后部分','专栏URL 中 `tocSection` 部分']" radar="1" rssbud="1"/>
## Springer

View File

@@ -1,70 +0,0 @@
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://asa.scitation.org';
const hostUrl = host.concat('/toc/jas/current?size=all');
const resp = await got(host);
const cookie = resp.headers['set-cookie'].join(' ');
const headers = {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Accept-Encoding': 'gzip, deflate, br',
'User-Agent': config.ua,
cookie,
};
const curtResponse = await got({
method: 'get',
url: hostUrl,
headers,
});
const $ = cheerio.load(curtResponse.data);
const list = $('.card')
.map((_, item) => {
$(item).find('.access-text').remove();
const title = $(item).find('.hlFld-Title').text();
const authors = $(item).find('.entryAuthor.all').text();
const img = $(item).find('img').attr('src');
const link = $(item).find('.ref.nowrap').attr('href');
const doi = link.replace('/doi/full/', '');
return {
title,
link,
doi,
authors,
img,
};
})
.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: 'post',
url: host.concat('/action/PB2showAjaxAbstract'),
headers,
body: 'doi=' + item.doi,
});
const content = cheerio.load(itemResponse.data);
item.abstract = content('span').text();
item.description = renderDesc(item);
return item;
})
)
);
ctx.state.data = {
title: 'JASA - Latest',
link: hostUrl,
item: list,
};
};

View File

@@ -1,4 +0,0 @@
module.exports = {
'/latest': ['Derekmini', 'auto-bot-ty'],
'/section/:id': ['Derekmini'],
};

View File

@@ -1,19 +0,0 @@
module.exports = {
'scitation.org': {
_name: 'JASA',
asa: [
{
title: 'latest',
docs: 'https://docs.rsshub.app/journal.html#jasa',
source: '/*',
target: '/jasa/latest',
},
{
title: 'section',
docs: 'https://docs.rsshub.app/journal.html#jasa',
source: '/*',
target: (params, url) => `/jasa/section/${new URL(url).searchParams.get('tocSection')}`,
},
],
},
};

View File

@@ -1,4 +0,0 @@
module.exports = function (router) {
router.get('/latest', require('./latest'));
router.get('/section/:id', require('./section'));
};

View File

@@ -1,95 +0,0 @@
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://asa.scitation.org';
const hostUrl = host.concat('/toc/jas/current?size=all');
const resp = await got(host);
const cookie = resp.headers['set-cookie'].join(' ');
const headers = {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Accept-Encoding': 'gzip, deflate, br',
'User-Agent': config.ua,
cookie,
};
const curtResponse = await got({
method: 'get',
url: hostUrl,
headers,
});
const $1 = cheerio.load(curtResponse.data);
const baseUrl = $1('.row.js_issue.highlighted').find('a').attr('href');
const heading = $1('.subject-heading')
.map((_, item) => ({
section: $1(item).text(),
}))
.get();
let list;
let ifContainSection = false;
const id = ctx.params.id.split('+').join(' ');
for (let i = 0, l = heading.length; i < l; i++) {
if (heading[i].section === id) {
ifContainSection = true;
}
}
if (ifContainSection === true) {
const sectUrl = baseUrl.concat('?tocSection=', id);
const response = await got({
method: 'get',
url: sectUrl,
headers,
});
const $ = cheerio.load(response.data);
list = $('.card')
.map((_, item) => {
$(item).find('.access-text').remove();
const title = $(item).find('.hlFld-Title').text();
const authors = $(item).find('.entryAuthor.all').text();
const img = $(item).find('img').attr('src');
const link = $(item).find('.ref.nowrap').attr('href');
const doi = link.replace('/doi/full/', '');
return {
title,
link,
doi,
authors,
img,
};
})
.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: 'post',
url: host.concat('/action/PB2showAjaxAbstract'),
headers,
body: 'doi=' + item.doi,
});
const content = cheerio.load(itemResponse.data);
item.abstract = content('span').text();
item.description = renderDesc(item);
return item;
})
)
);
}
ctx.state.data = {
title: 'JASA - '.concat(id),
link: hostUrl,
item: list,
allowEmpty: true,
};
};

View File

@@ -1,11 +0,0 @@
<p>
<span><big>{{ item.title }}</big></span><br />
</p>
<p>
<span><small><i>{{ item.authors }}</i></small></span><br />
<span><small><i>https://doi.org/{{ item.doi }}</i></small></span><br />
<img src={{ item.img }}/>
</p>
<p>
<span>{{ item.abstract }}</span><br />
</p>