forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(route): update v2/scitation to v2/aip (DIYgod#12955)
* 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>
1 parent
e455b54
commit 8d4dbb9
Showing
13 changed files
with
107 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters