feat: 期刊路由优化,增加 scihub 模式 (#4094)

This commit is contained in:
Henry Wang
2020-03-01 04:24:31 +00:00
committed by GitHub
parent 70b333c400
commit 19fa95d553
25 changed files with 194 additions and 241 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="routeBlock" :id="path"> <div class="routeBlock" :id="path">
<p class="badge"> <p class="badge">
<Badge text="支持 BT" type="tip" vertical="middle" v-if="supportBT"/> <Badge text="支持播客" type="tip" vertical="middle" v-if="supportPodcast"/> <a target="_blank" href="/faq.html" v-if="anticrawler"><Badge text="反爬严格" vertical="middle" type="warn"/></a> <a target="_blank" href="https://github.com/DIYgod/RSSHub-Radar" v-if="radar"><Badge text="支持浏览器扩展" vertical="middle" type="tip"/></a> <Badge text="支持 BT" type="tip" vertical="middle" v-if="supportBT"/> <Badge text="支持播客" type="tip" vertical="middle" v-if="supportPodcast"/> <Badge text="支持 Scihub" type="tip" vertical="middle" v-if="supportScihub"/> <a target="_blank" href="/faq.html" v-if="anticrawler"><Badge text="反爬严格" vertical="middle" type="warn"/></a> <a target="_blank" href="https://github.com/DIYgod/RSSHub-Radar" v-if="radar"><Badge text="支持浏览器扩展" vertical="middle" type="tip"/></a>
</p> </p>
<p class="author"> <p class="author">
作者: <a v-for="uid in author.split(' ')" :href="`https://github.com/${uid}`" target="_blank"> @{{ uid }} </a> 作者: <a v-for="uid in author.split(' ')" :href="`https://github.com/${uid}`" target="_blank"> @{{ uid }} </a>
@@ -52,6 +52,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
supportScihub: {
type: String,
default: null
},
radar: { radar: {
type: String, type: String,
default: null default: null

View File

@@ -376,3 +376,7 @@ Access control includes a whitelist and a blacklist, support IP and route, use `
- discuz cookies - discuz cookies
- `DISCUZ_COOKIE_{cid}`: Cookie of a forum powered by discuz, cid can be anything from 00 to 99. When visiting route discuz, using cid to specify this cookie. - `DISCUZ_COOKIE_{cid}`: Cookie of a forum powered by discuz, cid can be anything from 00 to 99. When visiting route discuz, using cid to specify this cookie.
- Sci-hub for scientific journal routes:
- `SCIHUB_HOST`: The Sci-hub mirror address that is accssible from your location, default to `https://sci-hub.tw`.

View File

@@ -2,13 +2,11 @@
pageClass: routes pageClass: routes
--- ---
# Sciences Journal # Scientific Journal
## Online papers ## Cell Journal
### Cell Journal <RouteEn author="yech1990" example="/cell/cell/current" path="/journal/cell/cell/:category" supportScihub="1" />
<RouteEn author="yech1990" example="/cell/cell/current" path="/cell/cell/:category" />
| `:category` | Query Type | Route | | `:category` | Query Type | Route |
| :---------: | :---------------------: | ---------------------------------------- | | :---------: | :---------------------: | ---------------------------------------- |
@@ -17,17 +15,43 @@ pageClass: routes
</RouteEn> </RouteEn>
### eLife - Latest Research-ALL ## eLife
<RouteEn author="emdoe" example="/elife/latest" path="/elife/latest" /> ### Latest Research - Research by Subject
### eLife - Latest Research-Research by Subject <RouteEn author="emdoe" example="/elife/cell-biology" path="/journal/elife/:subject" :paramsDesc="['topic name', 'obtain it from the homepage. `latest` will include all topics.']" supportScihub="1"/>
<RouteEn author="emdoe" example="/elife/cell-biology" path="/elife/:subject" :paramsDesc="['topic name', 'obtain it from the homepage']" /> ## Google Scholar
### Nature Journal - Latest Research ### Keywords Monitoring
<RouteEn author="yech1990" example="/nature/research/ng" path="/nature/research/:journal" :paramsDesc="['short name for a journal']" /> <RouteEn author="HenryQW" path="/google/scholar/:query" example="/google/scholar/data+visualization" :paramsDesc="['query statement which supports「Basic」and「Advanced」modes']" anticrawler="1">
::: warning
Google Scholar has strict anti-crawling mechanism implemented, the demo below doesn't guarantee availability. Please deploy your own instance as it might increase the stability.
:::
1. Basic mode, sample query is the keywords desired, eg.「data visualization」, [https://rsshub.app/google/scholar/data+visualization](https://rsshub.app/google/scholar/data+visualization).
2. Advanced mode, visit [Google Scholar](https://scholar.google.com/schhp?hl=en&as_sdt=0,5), click the top left corner and select「Advanced Search」, fill in your conditions and submit the search. The URL should look like this: [https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5](https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5), copy everything after `https://scholar.google.com/scholar?` from the URL and use it as the query for this route. The complete URL for the above example should look like this: [https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5](https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5).
</RouteEn>
### Author Citations
<RouteEn author="KellyHwong" example="/google/citations/mlmE4JMAAAAJ" path="/google/citations/:id" anticrawler="1">
The parameter id in the route is the id in the URL of the user s Google Scholar reference pagefor example `https://scholar.google.com/citations?hl=zh-CN&user=mlmE4JMAAAAJ` to `mlmE4JMAAAAJ`
</RouteEn>
## Nature Journal
### Latest Research
<RouteEn author="yech1990" example="/nature/research/ng" path="/journal/nature/research/:journal" :paramsDesc="['short name for a journal']" />
| `:journal` | Full Name of the Journal | Route | | `:journal` | Full Name of the Journal | Route |
| :-----------: | :-------------------------: | ---------------------------------------------------------------- | | :-----------: | :-------------------------: | ---------------------------------------------------------------- |
@@ -48,9 +72,9 @@ pageClass: routes
</RouteEn> </RouteEn>
### Nature Journal - News & Comment ### News & Comment
<RouteEn author="yech1990" example="/nature/news-and-comment/ng" path="/nature/news-and-comment/:journal" :paramsDesc="['short name for a journal']" /> <RouteEn author="yech1990" example="/nature/news-and-comment/ng" path="/journal/nature/news-and-comment/:journal" :paramsDesc="['short name for a journal']" />
| `:journal` | Full Name of the Journal | Route | | `:journal` | Full Name of the Journal | Route |
| :-----------: | :-------------------------: | -------------------------------------------------------------------------------- | | :-----------: | :-------------------------: | -------------------------------------------------------------------------------- |
@@ -68,25 +92,31 @@ pageClass: routes
</RouteEn> </RouteEn>
### Nature Journal - News ### News
<RouteEn author="yech1990" example="/nature/nature/news" path="/nature/nature/news" /> <RouteEn author="yech1990" example="/nature/news" path="/journal/nature/news" />
### Nature Journal - Research Highlight ### Research Highlight
<RouteEn author="yech1990" example="/nature/nature/highlight" path="/nature/nature/highlight" /> <RouteEn author="yech1990" example="/nature/highlight" path="/journal/nature/highlight" supportScihub="1"/>
### Proceedings of The National Academy of Sciences (PNAS) - Latest Articles - ALL ## Proceedings of The National Academy of Sciences (PNAS)
<RouteEn author="emdoe" example="/pnas/latest" path="/pnas/latest" /> ### Latest Articles - Articles by Topic
### Proceedings of The National Academy of Sciences (PNAS) - Latest Articles-Articles by Topic <RouteEn author="emdoe HenryQW" example="/pnas/Applied Mathematics" path="/journal/pnas/:topic" :paramsDesc="['topic name', 'obtain it from pnas.org (new research in ...). `Latest` will include all.']" supportScihub="1"/>
<RouteEn author="emdoe" example="/pnas/Applied Mathematics" path="/pnas/:topic" :paramsDesc="['topic name', 'obtain it from pnas.org (new research in ...)']" /> ## PubMed
### Science Journal - Current Issue ### Trending
<RouteEn author="yech1990" example="/sciencemag/current/science" path="/nature/research/:journal" :paramsDesc="['short name for a journal']" /> <RouteEn author="yech1990" example="/pubmed/trending" path="/journal/pubmed/trending" supportScihub="1"/>
## Science Journal
### Current Issue
<RouteEn author="yech1990" example="/sciencemag/current/science" path="/journal/sciencemag/research/:journal" :paramsDesc="['short name for a journal']" supportScihub="1"/>
| `:journal` | Full Name of the Journal | Route | | `:journal` | Full Name of the Journal | Route |
| :--------: | :----------------------------: | ---------------------------------------------------------------- | | :--------: | :----------------------------: | ---------------------------------------------------------------- |
@@ -102,44 +132,16 @@ pageClass: routes
</RouteEn> </RouteEn>
### Science Journal - First Release ### First Release
<RouteEn author="yech1990" example="/sciencemag/early/science" path="/sciencemag/early/science" /> <RouteEn author="yech1990" example="/sciencemag/early/science" path="/journal/sciencemag/early/science" supportScihub="1"/>
_only support Science Journal_ _only support Science Journal_
</RouteEn> </RouteEn>
## Search Engine ## X-MOL Platform
### PubMed Trending ### Journal
<RouteEn author="yech1990" example="/pubmed/trending" path="/pubmed/trending" /> <RouteEn author="cssxsh" example="/x-mol/paper/0/9" path="/journal/x-mol/paper/:type/:magazine" :paramsDesc="['type','magazine']" />
### X-MOL Platform - Journal
<RouteEn author="cssxsh" example="/x-mol/paper/0/9" path="/x-mol/paper/:type/:magazine" :paramsDesc="['类别','机构两个参数都可从期刊URL获取。']" />
### Google Scholar - Keywords Monitoring
<RouteEn author="HenryQW" path="/google/scholar/:query" example="/google/scholar/data+visualization" :paramsDesc="['query statement which supports「Basic」and「Advanced」modes']" anticrawler="1">
::: warning
Google Scholar has strict anti-crawling mechanism implemented, the demo below doesn't guarantee availability. Please deploy your own instance as it might increase the stability.
:::
1. Basic mode, sample query is the keywords desired, eg.「data visualization」, [https://rsshub.app/google/scholar/data+visualization](https://rsshub.app/google/scholar/data+visualization).
2. Advanced mode, visit [Google Scholar](https://scholar.google.com/schhp?hl=en&as_sdt=0,5), click the top left corner and select「Advanced Search」, fill in your conditions and submit the search. The URL should look like this: [https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5](https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5), copy everything after `https://scholar.google.com/scholar?` from the URL and use it as the query for this route. The complete URL for the above example should look like this: [https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5](https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=en&as_sdt=0%2C5).
</RouteEn>
### Google Scholar - Author Citations
<RouteEn author="KellyHwong" example="/google/citations/mlmE4JMAAAAJ" path="/google/citations/:id" anticrawler="1">
The parameter id in the route is the id in the URL of the user s Google Scholar reference pagefor example `https://scholar.google.com/citations?hl=zh-CN&user=mlmE4JMAAAAJ` to `mlmE4JMAAAAJ`
</RouteEn>

View File

@@ -64,6 +64,14 @@ Enable Telegram Instant View requires a page template, it can be obtained from T
Eg: <https://rsshub.app/novel/biquge/94_94525?tgiv=bd3c42818a7f7e> Eg: <https://rsshub.app/novel/biquge/94_94525?tgiv=bd3c42818a7f7e>
## Sci-hub link
Output Sci-hub link in scientific journal routes, this supports major journals or routes that output DOIs.
- scihub: set to any value
举例: <https://rsshub.app/pnas/latest?scihub=1>
### Output Formats ### Output Formats
RSSHub conforms to RSS 2.0 and Atom Standard, simply append `.rss` `.atom` to the end of the feed address to obtain the feed in corresponding format, default to RSS 2.0. RSSHub conforms to RSS 2.0 and Atom Standard, simply append `.rss` `.atom` to the end of the feed address to obtain the feed in corresponding format, default to RSS 2.0.

View File

@@ -413,3 +413,7 @@ RSSHub 支持 `memory` 和 `redis` 两种缓存方式
- discuz cookies 设定 - discuz cookies 设定
- `DISCUZ_COOKIE_{cid}`: 某 Discuz 驱动的论坛,用户注册后的 Cookie 值 , cid 可自由设定,取值范围[00, 99], 使用 discuz 通用路由时, 通过指定 cid 来调用该 cookie - `DISCUZ_COOKIE_{cid}`: 某 Discuz 驱动的论坛,用户注册后的 Cookie 值 , cid 可自由设定,取值范围[00, 99], 使用 discuz 通用路由时, 通过指定 cid 来调用该 cookie
- Sci-hub 设置,用于科学期刊路由。
- `SCIHUB_HOST`: 可访问的 sci-hub 镜像地址,默认为 `https://sci-hub.tw`

View File

@@ -4,38 +4,11 @@ pageClass: routes
# 科学期刊 # 科学期刊
## 聚合平台 ## Cell
### PubMed-热门文章 ### 主刊
<Route author="yech1990" example="/pubmed/trending" path="/pubmed/trending" /> <Route author="yech1990" example="/cell/cell/current" path="/journals/cell/cell/:category" supportScihub="1"/>
### X-MOL 平台-期刊
<Route author="cssxsh" example="/x-mol/paper/0/9" path="/x-mol/paper/:type/:magazine" :paramsDesc="['类别','机构两个参数都可从期刊URL获取。']" />
### 谷歌学术-关键词更新
<Route author="HenryQW" example="/google/scholar/data+visualization" path="/google/scholar/:query" :paramsDesc="['查询语句, 支持「简单」和「高级」两种模式:']" anticrawler="1">
1. 简单模式, 例如「data visualization」, <https://rsshub.app/google/scholar/data+visualization>.
2. 高级模式, 前往 [Google Scholar](https://scholar.google.com/schhp?hl=zh-cn&as_sdt=0,5), 点击左上角, 选择高级搜索并提交查询. 此时 URL 应为: <https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=zh-CN&as_sdt=0%2C5>, 复制`https://scholar.google.com/scholar?`后的所有语句作为本路由的查询参数. 例子所对应的完整路由为<https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=zh-CN&as_sdt=0%2C5>.
</Route>
### 谷歌学术-作者引用更新
<Route author="KellyHwong" example="/google/citations/mlmE4JMAAAAJ" path="/google/citations/:id" anticrawler="1">
路由中的参数 id即用户谷歌学术引用页面 url 中的 id如 https://scholar.google.com/citations?hl=zh-CN&user=mlmE4JMAAAAJ 中 user= 后的 mlmE4JMAAAAJ。
</Route>
## 期刊网站
### Cell 主刊
<Route author="yech1990" example="/cell/cell/current" path="/cell/cell/:category" />
| `:category` | 类型说明 | 路由 | | `:category` | 类型说明 | 路由 |
| :---------: | :-----------------: | ---------------------------------------- | | :---------: | :-----------------: | ---------------------------------------- |
@@ -44,17 +17,17 @@ pageClass: routes
</Route> </Route>
### eLife-最新成果-综合 ## elife
<Route author="emdoe" example="/elife/latest" path="/elife/latest" /> ### 最新成果
### elife-最新成果-细分领域 <Route author="emdoe HenryQW" example="/elife/cell-biology" path="/journals/elife/:subject" :paramsDesc="['方向名称', '请在主页获取。`latest` 则为全部。']" supportScihub="1"/>
<Route author="emdoe" example="/elife/cell-biology" path="/elife/:subject" :paramsDesc="['方向名称', '请在主页获取']" /> ## Nature 系列
### Nature 系列-最新成果 ### 最新成果
<Route author="yech1990" example="/nature/research/ng" path="/nature/research/:journal" :paramsDesc="['期刊名简写']" /> <Route author="yech1990" example="/nature/research/ng" path="/journals/nature/research/:journal" :paramsDesc="['期刊名简写']" />
| `:journal` | 期刊名 | 路由 | | `:journal` | 期刊名 | 路由 |
| :-----------: | :-------------------------: | ---------------------------------------------------------------- | | :-----------: | :-------------------------: | ---------------------------------------------------------------- |
@@ -75,9 +48,9 @@ pageClass: routes
</Route> </Route>
### Nature-新闻及评论 ### 新闻及评论
<Route author="yech1990" example="/nature/news-and-comment/ng" path="/nature/news-and-comment/:journal" :paramsDesc="['期刊名简写']" /> <Route author="yech1990" example="/nature/news-and-comment/ng" path="/journals/nature/news-and-comment/:journal" :paramsDesc="['期刊名简写']" supportScihub="1"/>
| `:journal` | 期刊名 | 路由 | | `:journal` | 期刊名 | 路由 |
| :-----------: | :-------------------------: | -------------------------------------------------------------------------------- | | :-----------: | :-------------------------: | -------------------------------------------------------------------------------- |
@@ -91,30 +64,36 @@ pageClass: routes
| natmachintell | Nature Machine Intelligence | [/nature/news-and-comment/natmachintell](/nature/news-and-comment/natmachintell) | | natmachintell | Nature Machine Intelligence | [/nature/news-and-comment/natmachintell](/nature/news-and-comment/natmachintell) |
- 通过 `/nature/research/` + “杂志简写”来获取对应杂志的最新文章Latest Research - 通过 `/nature/research/` + “杂志简写”来获取对应杂志的最新文章Latest Research
主刊由于格式不同,该 router 并未支持,采用 `/nature/nature/news` 来获取新闻。 主刊由于格式不同,该 router 并未支持,采用 `/nature/news` 来获取新闻。
- 由于 Nature 系列的刊物是分别由不同的编辑来独立运营,所以页面格式上有些差异。目前**仅**对以下杂志进行了测试。 - 由于 Nature 系列的刊物是分别由不同的编辑来独立运营,所以页面格式上有些差异。目前**仅**对以下杂志进行了测试。
</Route> </Route>
### Nature 主刊-新闻动态 ### 主刊 - 新闻动态
<Route author="yech1990" example="/nature/nature/news" path="/nature/nature/news" /> <Route author="yech1990" example="/nature/news" path="/journals/nature/news" />
### Nature 主刊-精彩研究 ### 主刊 - 精彩研究
<Route author="yech1990" example="/nature/nature/highlight" path="/nature/nature/highlight" /> <Route author="yech1990" example="/nature/highlight" path="/journals/nature/highlight" supportScihub="1"/>
### PNAS-最新文章(全部) ## PNAS
<Route author="emdoe" example="/pnas/latest" path="/pnas/latest" /> ### 最新文章(根据领域分类)
### PNAS-最新文章(根据领域分类) <Route author="emdoe HenryQW" example="/pnas/Applied Mathematics" path="/journals/pnas/:topic" :paramsDesc="['领域名称, 可从 pnas.org 获得。`latest` 则为全部。']" supportScihub="1" />
<Route author="emdoe" example="/pnas/Applied Mathematics" path="/pnas/:topic" :paramsDesc="['领域名称','可从 pnas.org 获得']" /> ## PubMed
### Science 系列-本期刊物 ### 热门文章
<Route author="yech1990" example="/sciencemag/current/science" path="/nature/research/:journal" :paramsDesc="['期刊名简写']" /> <Route author="yech1990" example="/pubmed/trending" path="/journals/pubmed/trending" supportScihub="1"/>
## Science 系列
### 本期刊物
<Route author="yech1990" example="/sciencemag/current/science" path="/journals/sciencemag/current/:journal" :paramsDesc="['期刊名简写']" supportScihub="1"/>
| `:journal` | 期刊名 | 路由 | | `:journal` | 期刊名 | 路由 |
| :--------: | :----------------------------: | ---------------------------------------------------------------- | | :--------: | :----------------------------: | ---------------------------------------------------------------- |
@@ -130,10 +109,35 @@ pageClass: routes
</Route> </Route>
### Science 主刊-在线发表 ### 主刊-在线发表
<Route author="yech1990" example="/sciencemag/early/science" path="/sciencemag/early/science" /> <Route author="yech1990" example="/sciencemag/early/science" path="/journals/sciencemag/early/science" supportScihub="1"/>
_仅支持 Science 主刊_ _仅支持 Science 主刊_
</Route> </Route>
## X-MOL
### 平台-期刊
<Route author="cssxsh" example="/journals/x-mol/paper/0/9" path="/journals/x-mol/paper/:type/:magazine" :paramsDesc="['类别','机构两个参数都可从期刊URL获取。']" />
## 谷歌学术
### 关键词更新
<Route author="HenryQW" example="/google/scholar/data+visualization" path="/google/scholar/:query" :paramsDesc="['查询语句, 支持「简单」和「高级」两种模式:']" anticrawler="1">
1. 简单模式, 例如「data visualization」, <https://rsshub.app/google/scholar/data+visualization>.
2. 高级模式, 前往 [Google Scholar](https://scholar.google.com/schhp?hl=zh-cn&as_sdt=0,5), 点击左上角, 选择高级搜索并提交查询. 此时 URL 应为: <https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=zh-CN&as_sdt=0%2C5>, 复制`https://scholar.google.com/scholar?`后的所有语句作为本路由的查询参数. 例子所对应的完整路由为<https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=zh-CN&as_sdt=0%2C5>.
</Route>
### 作者引用更新
<Route author="KellyHwong" example="/google/citations/mlmE4JMAAAAJ" path="/google/citations/:id" anticrawler="1">
路由中的参数 id即用户谷歌学术引用页面 url 中的 id如 https://scholar.google.com/citations?hl=zh-CN&user=mlmE4JMAAAAJ 中 user= 后的 mlmE4JMAAAAJ。
</Route>

View File

@@ -65,6 +65,14 @@ Telegram 即时预览模式需要在官网制作页面处理模板,请前往[
举例: <https://rsshub.app/novel/biquge/94_94525?tgiv=bd3c42818a7f7e> 举例: <https://rsshub.app/novel/biquge/94_94525?tgiv=bd3c42818a7f7e>
## 输出 Sci-hub 链接
可以输出 Sci-hub 链接,用于知名期刊或输出 DOI 的科学期刊类 RSS。
- scihub: 任意值开启
举例: <https://rsshub.app/pnas/latest?scihub=1>
## 输出格式 ## 输出格式
RSSHub 同时支持 RSS 2.0 和 Atom 输出格式, 在路由末尾添加 `.rss``.atom` 即可请求对应输出格式, 缺省为 RSS 2.0 RSSHub 同时支持 RSS 2.0 和 Atom 输出格式, 在路由末尾添加 `.rss``.atom` 即可请求对应输出格式, 缺省为 RSS 2.0

View File

@@ -124,6 +124,9 @@ const calculateValue = () => {
discuz: { discuz: {
cookies: discuz_cookies, cookies: discuz_cookies,
}, },
scihub: {
host: envs.SCIHUB_HOST || 'https://sci-hub.tw/',
},
}; };
}; };
calculateValue(); calculateValue();

View File

@@ -186,7 +186,7 @@ module.exports = async (ctx, next) => {
}); });
} }
// fulltest // fulltext
if (ctx.query.mode && ctx.query.mode.toLowerCase() === 'fulltext') { if (ctx.query.mode && ctx.query.mode.toLowerCase() === 'fulltext') {
const tasks = ctx.state.data.item.map(async (item) => { const tasks = ctx.state.data.item.map(async (item) => {
const { link, author, description } = item; const { link, author, description } = item;
@@ -209,6 +209,14 @@ module.exports = async (ctx, next) => {
}); });
await Promise.all(tasks); await Promise.all(tasks);
} }
// scihub
if (ctx.query.scihub) {
ctx.state.data.item.map((item) => {
item.link = item.doi ? `https://sci-hub.tw/${item.doi}` : `https://sci-hub.tw/${item.link}`;
return item;
});
}
} }
} }
}; };

View File

@@ -1958,8 +1958,8 @@ router.get('/kzfeed/topic/:id', require('./routes/kzfeed/topic'));
router.get('/factcheck', require('./routes/tencent/factcheck')); router.get('/factcheck', require('./routes/tencent/factcheck'));
// X-MOL化学资讯平台 // X-MOL化学资讯平台
router.get('/x-mol/news/:tag?', require('./routes/x-mol/news.js')); router.get('/x-mol/news/:tag?', require('./routes/journals/x-mol/news.js'));
router.get('/x-mol/paper/:type/:magazine', require('./routes/x-mol/paper')); router.get('/x-mol/paper/:type/:magazine', require('./routes/journals/x-mol/paper'));
// 知识分子 // 知识分子
router.get('/zhishifenzi/news/:type?', require('./routes/zhishifenzi/news')); router.get('/zhishifenzi/news/:type?', require('./routes/zhishifenzi/news'));
@@ -1987,31 +1987,29 @@ router.get('/kaggle/discussion/:forumId/:sort?', require('./routes/kaggle/discus
router.get('/kaggle/competitions/:category?', require('./routes/kaggle/competitions')); router.get('/kaggle/competitions/:category?', require('./routes/kaggle/competitions'));
// PubMed Trending // PubMed Trending
router.get('/pubmed/trending', require('./routes/pubmed/trending')); router.get('/pubmed/trending', require('./routes/journals/pubmed/trending'));
// 领科 (linkresearcher.com) // 领科 (linkresearcher.com)
router.get('/linkresearcher/:params', require('./routes/linkresearcher/index')); router.get('/linkresearcher/:params', require('./routes/linkresearcher/index'));
// eLife [Sci Journal] // eLife [Sci Journal]
router.get('/elife/latest', require('./routes/elife/latest')); router.get('/elife/:tid', require('./routes/journals/elife/index'));
router.get('/elife/:tid', require('./routes/elife/subject'));
// PNAS [Sci Journal] // PNAS [Sci Journal]
router.get('/pnas/latest', require('./routes/pnas/latest')); router.get('/pnas/:tid', require('./routes/journals/pnas/index'));
router.get('/pnas/:tid', require('./routes/pnas/topic'));
// cell [Sci Journal] // cell [Sci Journal]
router.get('/cell/cell/:category', require('./routes/cell/cell/index')); router.get('/cell/cell/:category', require('./routes/journals/cell/cell/index'));
// nature + nature 子刊 [Sci Journal] // nature + nature 子刊 [Sci Journal]
router.get('/nature/research/:journal?', require('./routes/nature/research')); router.get('/nature/research/:journal?', require('./routes/journals/nature/research'));
router.get('/nature/news-and-comment/:journal?', require('./routes/nature/news-and-comment')); router.get('/nature/news-and-comment/:journal?', require('./routes/journals/nature/news-and-comment'));
router.get('/nature/news', require('./routes/nature/news')); router.get('/nature/news', require('./routes/journals/nature/news'));
router.get('/nature/highlight', require('./routes/nature/highlight')); router.get('/nature/highlight', require('./routes/journals/nature/highlight'));
// science [Sci Journal] // science [Sci Journal]
router.get('/sciencemag/current/:journal?', require('./routes/sciencemag/current')); router.get('/sciencemag/current/:journal?', require('./routes/journals/sciencemag/current'));
router.get('/sciencemag/early/science', require('./routes/sciencemag/early')); router.get('/sciencemag/early/science', require('./routes/journals/sciencemag/early'));
// dlsite // dlsite
router.get('/dlsite/new/:type', require('./routes/dlsite/new')); router.get('/dlsite/new/:type', require('./routes/dlsite/new'));

View File

@@ -1,54 +0,0 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `https://elifesciences.org`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
$('.grid-secondary-column').remove();
const list = $('li.listing-list__item').get();
const out = await Promise.all(
list.map(async (item) => {
const $ = cheerio.load(item);
const title = $('a.teaser__header_text_link').text();
const partial = $('a.teaser__header_text_link').attr('href');
const address = `${url}${partial}`;
const time = $('time').text();
const description = $('div.teaser__body').text();
const author = $('div.teaser__secondary_info').text();
const cache = await ctx.cache.get(address);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await got.get(address);
const capture = cheerio.load(res.data);
const abstract = capture('#abstract .article-section__body').html();
let contents;
if (description !== '') {
contents = `${description}<br /><br /><h2 style="font-size: 14pt"><center>Abstract</center></h2>${abstract}`;
} else {
contents = `<h2"><center>Abstract</center></h2>${abstract}`;
}
const single = {
title,
author: author,
description: contents,
link: address,
guid: address,
pubDate: new Date(time).toUTCString(),
};
ctx.cache.set(address, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: `eLife | Latest Research`,
link: url,
item: out,
};
};

View File

@@ -107,6 +107,7 @@ module.exports = async (ctx) => {
description: contents, description: contents,
link: address, link: address,
guid: address, guid: address,
doi: $('dc\\:identifier').text(),
pubDate: pubDate, pubDate: pubDate,
}; };
ctx.cache.set(address, JSON.stringify(single)); ctx.cache.set(address, JSON.stringify(single));

View File

@@ -3,12 +3,22 @@ const got = require('@/utils/got');
module.exports = async (ctx) => { module.exports = async (ctx) => {
const baseUrl = `https://elifesciences.org`; const baseUrl = `https://elifesciences.org`;
const url = `${baseUrl}/subjects/${ctx.params.tid}`; const tid = ctx.params.tid;
let url = baseUrl;
if (tid !== 'latest') {
url = `${baseUrl}/subjects/${ctx.params.tid}`;
}
const res = await got.get(url); const res = await got.get(url);
const $ = cheerio.load(res.data); const $ = cheerio.load(res.data);
$('.grid-secondary-column').remove(); $('.grid-secondary-column').remove();
const topic = $('h1.content-header__title.content-header__title--xx-short').text();
let topic = 'latest';
if (tid !== 'latest') {
topic = $('h1.content-header__title.content-header__title--xx-short').text();
}
const list = $('li.listing-list__item').get(); const list = $('li.listing-list__item').get();
const out = await Promise.all( const out = await Promise.all(
@@ -19,7 +29,9 @@ module.exports = async (ctx) => {
const address = `${baseUrl}${partial}`; const address = `${baseUrl}${partial}`;
const time = $('time').text(); const time = $('time').text();
const description = $('div.teaser__body').text(); const description = $('div.teaser__body').text();
const author = $('div.teaser__secondary_info').text(); const author = $('div.teaser__secondary_info')
.text()
.trim();
const cache = await ctx.cache.get(address); const cache = await ctx.cache.get(address);
if (cache) { if (cache) {
@@ -42,6 +54,7 @@ module.exports = async (ctx) => {
description: contents, description: contents,
link: address, link: address,
guid: address, guid: address,
doi: capture('meta[name="dc.identifier"]')[0].attribs.content,
pubDate: new Date(time).toUTCString(), pubDate: new Date(time).toUTCString(),
}; };
ctx.cache.set(address, JSON.stringify(single)); ctx.cache.set(address, JSON.stringify(single));

View File

@@ -3,7 +3,15 @@ const got = require('@/utils/got');
module.exports = async (ctx) => { module.exports = async (ctx) => {
const baseUrl = `https://www.pnas.org`; const baseUrl = `https://www.pnas.org`;
const url = `${baseUrl}/content/by/section/${ctx.params.tid}`;
const tid = ctx.params.tid;
let url = `${baseUrl}/content/early/recent`;
if (tid !== 'latest') {
url = `${baseUrl}/content/by/section/${ctx.params.tid}`;
} else {
ctx.params.tid = 'Latest Research';
}
const res = await got.get(url); const res = await got.get(url);
const $ = cheerio.load(res.data); const $ = cheerio.load(res.data);
@@ -15,7 +23,6 @@ module.exports = async (ctx) => {
const title = $('.highwire-cite-title').text(); const title = $('.highwire-cite-title').text();
const partial = $('.highwire-cite-linked-title').attr('href'); const partial = $('.highwire-cite-linked-title').attr('href');
const address = `${baseUrl}${partial}`; const address = `${baseUrl}${partial}`;
const time = $('time').text();
let author; let author;
if ($('.highwire-citation-authors span').length > 3) { if ($('.highwire-citation-authors span').length > 3) {
author = $('.highwire-citation-author.first').text() + ' et al.'; author = $('.highwire-citation-author.first').text() + ' et al.';
@@ -44,7 +51,8 @@ module.exports = async (ctx) => {
description: contents, description: contents,
link: address, link: address,
guid: address, guid: address,
pubDate: new Date(time).toUTCString(), doi: capture('meta[name="DC.Identifier"]')[0].attribs.content,
pubDate: new Date(capture('meta[name="DC.Date"]')[0].attribs.content).toUTCString(),
}; };
ctx.cache.set(address, JSON.stringify(single)); ctx.cache.set(address, JSON.stringify(single));
return Promise.resolve(single); return Promise.resolve(single);

View File

@@ -1,58 +0,0 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const baseUrl = `https://www.pnas.org`;
const url = `${baseUrl}/content/early/recent`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('.highwire-citation-pnas-list-complete').get();
const out = await Promise.all(
list.map(async (item) => {
const $ = cheerio.load(item);
const title = $('.highwire-cite-title').text();
const partial = $('.highwire-cite-linked-title').attr('href');
const address = `${baseUrl}${partial}`;
const time = $('time').text();
let author;
if ($('.highwire-citation-authors span').length > 3) {
author = $('.highwire-citation-author.first').text() + ' et al.';
} else {
author = $('.highwire-citation-authors span').text();
}
const cache = await ctx.cache.get(address);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await got.get(address);
const capture = cheerio.load(res.data);
const significance = capture('.executive-summary').html();
const abstract = capture('.section.abstract').html();
let contents;
if (abstract !== null) {
contents = significance + abstract;
} else {
contents = significance;
}
const single = {
title,
author: author,
description: contents,
link: address,
guid: address,
pubDate: new Date(time).toUTCString(),
};
ctx.cache.set(address, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: `PNAS | Latest Research`,
link: url,
item: out,
};
};