Skip to content

Commit

Permalink
fix(route): update v2/scitation to v2/aip (DIYgod#12955)
Browse files Browse the repository at this point in the history
* fix(route): scitation/journal

* fix(docs): scitation/journal

* fix(docs): (en) scitation/journal

* chores

* fix(radar): scitation/journal

* fix(radar): scitation/journal

* fix(radar): scitation/journal

* style: auto format

* fix(route): mv scitation to aip

* fix(route): v2/AIP chores

* fix(docs): v2/aip docs

* fix(docs): chores: jounus/advanced/advanced-feed

* fix(docs): update en docs

* fix(docs): not right close the <RouteEn>

* fix(docs): correct some mistake

* Update lib/v2/aip/radar.js

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Derekmini and github-actions[bot] authored Aug 19, 2023
1 parent e455b54 commit 8d4dbb9
Showing 13 changed files with 107 additions and 123 deletions.
4 changes: 2 additions & 2 deletions lib/v2/scitation/journal.js → lib/v2/aip/journal-pupp.js
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ const { isValidHost } = require('@/utils/valid-host');
module.exports = async (ctx) => {
const pub = ctx.params.pub;
const jrn = ctx.params.jrn;
const host = `https://${pub}.scitation.org`;
const jrnlUrl = `${host}/toc/${jrn}/current?size=all`;
const host = `https://pubs.aip.org`;
const jrnlUrl = `${host}/${pub}/${jrn}/issue`;
if (!isValidHost(pub)) {
throw Error('Invalid pub');
}
55 changes: 55 additions & 0 deletions lib/v2/aip/journal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { renderDesc } = require('./utils');

module.exports = async (ctx) => {
const pub = ctx.params.pub;
const jrn = ctx.params.jrn;
const host = `https://pubs.aip.org`;
const jrnlUrl = `${host}/${pub}/${jrn}/issue`;

const { data: response } = await got.get(jrnlUrl);
const $ = cheerio.load(response);
const jrnlName = $('meta[property="og:title"]')
.attr('content')
.match(/(?:[^=]*=)?\s*([^>]+)\s*/)[1];
const publication = $('.al-article-item-wrap.al-normal');

const list = publication
.map((_, item) => {
const title = $(item).find('.item-title a:first').text();
const link = $(item).find('.item-title a:first').attr('href');
const doilink = $(item).find('.citation-label a').attr('href');
const doi = doilink && doilink.match(/10\.\d+\/\S+/)[0];
const id = $(item).find('h5[data-resource-id-access]').data('resource-id-access');
const authors = $(item)
.find('.al-authors-list')
.find('a')
.map(function () {
return $(this).text();
})
.get()
.join('; ');
const imgUrl = $(item).find('.issue-featured-image a img').attr('src');
const img = imgUrl ? imgUrl.replace(/\?.+$/, '') : '';
const description = renderDesc(title, authors, doi, img);
return {
title,
link,
doilink,
id,
authors,
img,
doi,
description,
};
})
.get();

ctx.state.data = {
title: jrnlName,
link: jrnlUrl,
item: list,
allowEmpty: true,
};
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
'/:pub/:jrn': ['Derekmini', 'auto-bot-ty'],
'/:pub/:jrn/:sec': ['Derekmini', 'auto-bot-ty'],
};
13 changes: 13 additions & 0 deletions lib/v2/aip/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'aip.org': {
_name: 'American Institute of Physics',
pubs: [
{
title: 'Journal',
docs: 'https://docs.rsshub.app/routes/journal#american-institute-of-physics',
source: '/:pub/:jrn',
target: '/aip/:pub/:jrn',
},
],
},
};
4 changes: 4 additions & 0 deletions lib/v2/aip/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = function (router) {
router.get('/:pub/:jrn', require('./journal'));
// router.get('/:pub/:jrn', require('./journal-pupp')); // Switch to this route if the official website blocks the "got" method.
};
File renamed without changes.
File renamed without changes.
19 changes: 0 additions & 19 deletions lib/v2/scitation/radar.js

This file was deleted.

4 changes: 0 additions & 4 deletions lib/v2/scitation/router.js

This file was deleted.

76 changes: 0 additions & 76 deletions lib/v2/scitation/section.js

This file was deleted.

2 changes: 1 addition & 1 deletion website/docs/joinus/advanced/advanced-feed.md
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ ctx.state.data = {

### 更新文档

要显示您制作的期刊订阅源支持 Sui-hub 功能,您需要将 `Route` 组件的 `supportScihub` 属性设置为 `"1"`。以下是一个示例:
要显示您制作的期刊订阅源支持 Sci-hub 功能,您需要将 `Route` 组件的 `supportScihub` 属性设置为 `"1"`。以下是一个示例:

```vue
<Route author="..." example="..." path="..." supportScihub="1" />
26 changes: 16 additions & 10 deletions website/docs/routes/journal.md
Original file line number Diff line number Diff line change
@@ -61,6 +61,22 @@ import Route from '@site/src/components/Route';

</Route>

## American Institute of Physics {#american-institute-of-physics}

### Journal {#american-institute-of-physics-journal}

<Route author="Derekmini auto-bot-ty" example="/aip/aapt/ajp" path="/aip/:pub/:jrn" paramsDesc={['出版社 id','期刊 id']} radar="1" rssbud="1" supportScihub="1">

参考 URL 格式 `pubs.aip.org/:pub/:jrn`

:::tip 提示

更多期刊可在 [AIP Publications](https://publishing.aip.org/publications/find-the-right-journal) 中找到。

:::

</Route>

## Annual Reviews {#annual-reviews}

### Journal {#annual-reviews-journal}
@@ -398,16 +414,6 @@ You can get all short name of a journal from <https://www.nature.com/siteindex>

<Route author="nczitzk" example="/sciencedirect/journal/research-policy" path="/sciencedirect/journal/:id" paramsDesc={['期刊 id,可在对应期刊页 URL 中找到']}/>

## Scitation {#scitation}

### 期刊 {#scitation-qi-kan}

<Route author="Derekmini auto-bot-ty" example="/scitation/aapt/ajp" path="/scitation/:pub/:jrn" paramsDesc={['出版社,URL 中 `scitation.org` 前部分','期刊,URL 中 `/toc/` 后部分']} radar="1" rssbud="1" puppeteer="1"/>

### 专栏 {#scitation-zhuan-lan}

<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" puppeteer="1"/>

## Springer {#springer}

### 期刊 {#springer-qi-kan}
Original file line number Diff line number Diff line change
@@ -61,6 +61,22 @@ More jounals can be found in [AEA Journals](https://www.aeaweb.org/journals).

</RouteEn>

## American Institute of Physics

### Journal

<RouteEn author="Derekmini auto-bot-ty" example="/aip/aapt/ajp" path="/aip/:pub/:jrn" paramsDesc={['Publisher id','Journal id']} radar="1" rssbud="1" supportScihub="1">

Refer to the URL format `pubs.aip.org/:pub/:jrn`

:::tip Tip

More jounals can be found in [AIP Publications](https://publishing.aip.org/publications/find-the-right-journal).

:::

</RouteEn>

## Annual Reviews

### Journal
@@ -427,16 +443,6 @@ To subscribe to [IN THE PIPELINE by Derek Lowe’s](https://science.org/blogs/pi

<RouteEn author="nczitzk" example="/sciencedirect/journal/research-policy" path="/sciencedirect/journal/:id" paramsDesc={['Journal id, can be found in URL']}/>

## Scitation

### Journal

<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" puppeteer="1"/>

### Section

<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" puppeteer="1"/>

## Springer

### Journal

0 comments on commit 8d4dbb9

Please sign in to comment.