Skip to content

Commit 52e8e14

Browse files
authored
Merge pull request #948 from DIYgod/master
[pull] master from diygod:master
2 parents 6f8c2a2 + c6c8ac0 commit 52e8e14

File tree

28 files changed

+709
-7
lines changed

28 files changed

+709
-7
lines changed

docs/blog.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,60 @@ username 为博主用户名,而非`xxx.hashnode.dev`中`xxx`所代表的 blog
152152

153153
<RouteEn author="5upernova-heng" example="/macmenubar/recently/developer-apps,system-tools" path="/macmenubar/recently/:category?" :paramsDesc="['分类名,多个使用逗号隔开,留空则为全部。分类名可在 URL 中找到']" radar="1" />
154154

155+
## Medium
156+
157+
### List
158+
159+
<Route author="ImSingee" example="/medium/list/imsingee/f2d8d48096a9" path="/medium/list/:user/:catalogId" :paramsDesc="['用户名', 'List 的 ID']">
160+
161+
List ID 取的是网址中最后一部分 `-` 后面的内容,例如 `https://medium.com/@imsingee/list/collection-7e67004f23f9` 的用户名为 imsingee、ID 为 `7e67004f23f9`
162+
163+
::: warning 注意
164+
165+
想要获取 Private 的 List 则只支持自建
166+
167+
:::
168+
169+
</Route>
170+
171+
### 个性推荐 - For You
172+
173+
<Route author="ImSingee" example="/medium/for-you/imsingee" path="/medium/for-you/:user" :paramsDesc="['用户名']" selfhost="1">
174+
175+
::: warning 注意
176+
177+
个性推荐需要登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
178+
179+
:::
180+
181+
</Route>
182+
183+
### 个性推荐 - Following
184+
185+
<Route author="ImSingee" example="/medium/following/imsingee" path="/medium/following/:user" :paramsDesc="['用户名']" selfhost="1">
186+
187+
::: warning 注意
188+
189+
个性推荐需要登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
190+
191+
:::
192+
193+
</Route>
194+
195+
### 个性推荐 - Tag
196+
197+
<Route author="ImSingee" example="/medium/tag/imsingee/cybersecurity" path="/medium/tag/:user/:tag" :paramsDesc="['用户名', '订阅的 Tag']" selfhost="1">
198+
199+
Tag 有很多,可从首页点进 Tag 以后的 URL 获取,例如 `https://medium.com/?tag=web3` 则 tag 为 `web3`
200+
201+
::: warning 注意
202+
203+
个性推荐需要登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
204+
205+
:::
206+
207+
</Route>
208+
155209
## Miris Whispers
156210

157211
### 博客

docs/en/blog.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,60 @@ pageClass: routes
7070

7171
<RouteEn author="5upernova-heng" example="/macmenubar/recently/developer-apps,system-tools" path="/macmenubar/recently/:category?" :paramsDesc="['Category path name, seperate by comma, default is all categories. Category path name can be found in url']" radar="1" />
7272

73+
## Medium
74+
75+
### List
76+
77+
<RouteEn author="ImSingee" example="/medium/list/imsingee/f2d8d48096a9" path="/medium/list/:user/:catalogId" :paramsDesc="['Username', 'List ID']">
78+
79+
The List ID is the last part of the URL after `-`, for example, the username in "https://medium.com/@imsingee/list/collection-7e67004f23f9" is `imsingee`, and the ID is `7e67004f23f9`.
80+
81+
::: warning Note
82+
83+
To access private lists, only self-hosting is supported.
84+
85+
:::
86+
87+
</RouteEn>
88+
89+
### Personalized Recommendations - For You
90+
91+
<RouteEn author="ImSingee" example="/medium/for-you/imsingee" path="/medium/for-you/:user" :paramsDesc="['Username']" selfhost="1">
92+
93+
::: warning Note
94+
95+
Personalized recommendations require the cookie value after logging in, so only self-hosting is supported. See the configuration module on the deployment page for details.
96+
97+
:::
98+
99+
</RouteEn>
100+
101+
### Personalized Recommendations - Following
102+
103+
<RouteEn author="ImSingee" example="/medium/following/imsingee" path="/medium/following/:user" :paramsDesc="['Username']" selfhost="1">
104+
105+
::: warning Note
106+
107+
Personalized recommendations require the cookie value after logging in, so only self-hosting is supported. See the configuration module on the deployment page for details.
108+
109+
:::
110+
111+
</RouteEn>
112+
113+
### Personalized Recommendations - Tag
114+
115+
<RouteEn author="ImSingee" example="/medium/tag/imsingee/cybersecurity" path="/medium/tag/:user/:tag" :paramsDesc="['Username', 'Subscribed Tag']" selfhost="1">
116+
117+
There are many tags, which can be obtained by clicking on a tag from the homepage and looking at the URL. For example, if the URL is `https://medium.com/?tag=web3`, then the tag is `web3`.
118+
119+
::: warning Note
120+
121+
Personalized recommendations require the cookie value after logging in, so only self-hosting is supported. See the configuration module on the deployment page for details.
122+
123+
:::
124+
125+
</RouteEn>
126+
73127
## Miris Whispers
74128

75129
### Blog

docs/en/install/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,11 @@ See docs of the specified route and `lib/config.js` for detailed information.
758758
- `MASTODON_API_ACCESS_TOKEN`: user access token
759759
- `MASTODON_API_ACCT_DOMAIN`: acct domain for particular instance
760760
761+
- Medium related routes: Open the console, copy the cookie (in theory, only uid and sid are required)
762+
763+
- `MEDIUM_ARTICLE_COOKIE`: Cookie used when requesting the full article, can access the full text of paid content when there is an active Member subscription.
764+
- `MEDIUM_COOKIE_{username}`: Cookie of the user corresponding to the username, required for personalized recommendation related routes.
765+
761766
- nhentai torrent: [Registration](https://nhentai.net/register/)
762767
763768
- `NHENTAI_USERNAME`: nhentai username or email

docs/en/joinus/debug.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ sidebarDepth: 0
33
---
44
# Debugging
55

6-
When debugging your code, you can use more than just `console.log` or attaching the node process to a debugger. Another option is to use `ctx.state.json` to provide a custom object for debugging.
6+
When debugging your code, you can use more than just `console.log` or attaching the node process to a debugger. You can also use the following methods for debugging.
7+
8+
Note: The following methods are only effective when the instance is running with `debugInfo=true`.
79

810
## Using `ctx.state.json`
911

@@ -24,3 +26,9 @@ ctx.state.json = {
2426
```
2527

2628
In the example above, we're passing the `info` object to `ctx.state.json`, which we can then access using the corresponding route + `.debug.json`.
29+
30+
## debug.html
31+
32+
In order to quickly test if the `description` in `ctx.state.data` is correct, you can use the `.debug.html` file suffix to obtain the HTML of the corresponding entry. The link can be directly opened in the browser to preview the rendering result.
33+
34+
Usage: Access the corresponding route + `.{index}.debug.html`, where `{index}` is the item number (starting from 0) in your `ctx.state.data.item`. And the data corresponds to the `ctx.state.data.item[index].description` information will be returned as route result.

docs/en/parameter.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ E.g.
148148
- JSON Feed - [https://rsshub.app/twitter/user/DIYgod.json](https://rsshub.app/twitter/user/DIYgod.json)
149149
- Apply filters or URL query - [https://rsshub.app/dribbble/popular.atom?filterout=Blue|Yellow|Black](https://rsshub.app/dribbble/popular.atom?filterout=Blue|Yellow|Black)
150150

151-
### Debug
151+
### debug.json
152152

153153
If the RSSHub instance is running with `debugInfo=true` enabled, suffixing a route with `.debug.json` will result in the value of `ctx.state.json` being returned.
154154

@@ -158,6 +158,15 @@ For example:
158158

159159
- `/furstar/characters/cn.debug.json`
160160

161+
### debug.html
162+
163+
By adding `.{index}.debug.html` (where `{index}` is a number starting from 0) at the end of the route and running the instance with `debugInfo=true`, RSSHub will return the content set in the plugin's `ctx.state.data.item[index].description`. You can access this page with a browser to quickly view the extracted information.
164+
165+
Example:
166+
167+
- `/furstar/characters/cn.0.debug.html`
168+
169+
161170
## Brief introduction
162171

163172
Set the parameter `brief` to generate a brief pure-text introduction with a limited number of characters ( ≥ `100`).

docs/install/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,11 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行
783783
- `MASTODON_API_ACCESS_TOKEN`: 用户 access token, 申请应用后,在应用配置页可以看到申请者的 access token
784784
- `MASTODON_API_ACCT_DOMAIN`: 该实例本地用户 acct 标识的域名
785785

786+
- Medium 相关路由:打开控制台,复制 Cookie(理论上只需要 uid 和 sid 即可)
787+
788+
- `MEDIUM_ARTICLE_COOKIE`:请求全文时使用的 Cookie,存在活跃的 Member 订阅时可获取付费内容全文
789+
- `MEDIUM_COOKIE_{username}`:对应 username 的用户的 Cookie,个性推荐相关路由需要
790+
786791
- MiniFlux 全部路由:
787792

788793
- `MINIFLUX_INSTANCE`: 用户所用的实例,默认为 MiniFlux 官方提供的 [付费服务地址](https://reader.miniflux.app)

docs/joinus/debug.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ sidebarDepth: 0
33
---
44
# 调试
55

6-
当调试代码时,除了使用 `console.log` 或将 node 进程附加到调试器,您还可以将自定义对象提供给 `ctx.state.json` 来进行调试。
6+
当调试代码时,除了使用 `console.log` 或将 node 进程附加到调试器,您还可以使用如下方式进行调试。
7+
8+
注意:需要实例运行在 `debugInfo=true` 的情况下以下方式才有效
79

810
## 使用 `ctx.state.json`
911

@@ -24,3 +26,9 @@ ctx.state.json = {
2426
```
2527

2628
在上面的示例中,我们将 `info` 对象传递给 `ctx.state.json`,然后可以使用相应的路由 + `.debug.json` 来访问它。
29+
30+
## debug.html
31+
32+
为了快速测试 `ctx.state.data` 中的 description 是否正确,你可以利用 `debug.html` 机制来获取相关条目的 HTML,该链接可以直接在浏览器中打开以预览渲染结果。
33+
34+
使用方式:访问相应的路由 + `.{index}.debug.html`,其中 `{index}` 为你的 `ctx.state.data.item` 中的项目序号(从 0 开始),即返回对应路由结果中的 `ctx.state.data.item[index].description` 信息。

docs/parameter.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ RSSHub 同时支持 RSS 2.0、Atom 和 JSON Feed 输出格式,在路由末尾
147147
- JSON Feed - <https://rsshub.app/twitter/user/DIYgod.json>
148148
- 和 filter 或其他 URL query 一起使用 - `https://rsshub.app/bilibili/user/coin/2267573.atom?filter=微小微|赤九玖|暴走大事件`
149149

150-
### debug
150+
### debug.json
151151

152152
在路由末尾添加 `.debug.json`且实例运行在`debugInfo=true`的情况下,RSShub 将会返回插件设置在`ctx.state.json`的内容
153153

@@ -157,6 +157,14 @@ RSSHub 同时支持 RSS 2.0、Atom 和 JSON Feed 输出格式,在路由末尾
157157

158158
- `/furstar/characters/cn.debug.json`
159159

160+
### debug.html
161+
162+
在路由末尾添加 `.{index}.debug.html``{index}` 为数字,为从 0 开始的下标)且实例运行在 `debugInfo=true` 的情况下,RSShub 将会返回插件设置在 `ctx.state.data.item[index].description` 的内容,你可用浏览器访问该页面来快速查看提取的信息的展示结果。
163+
164+
举例:
165+
166+
- `/furstar/characters/cn.0.debug.html`
167+
160168
## 输出简讯
161169

162170
可以使用 `brief` 参数输出特定字数 ( ≥ `100` 字 ) 的纯文本内容

docs/university.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,3 +3750,17 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
37503750
### 数据科学与计算机学院动态
37513751

37523752
<Route author="Neutrino3316 MegrezZhu nczitzk" example="/sysu/cse" path="/sysu/cse"/>
3753+
3754+
### 粤港澳发展研究院
3755+
3756+
<Route author="TonyRL" example="/sysu/ygafz" path="/sysu/ygafz/:type?" :paramsDesc="['分类,见下表,默认为 `notice`']" radar="1" puppeteer="1">
3757+
3758+
| 人才招聘 | 人才培养 | 新闻动态 | 通知公告 | 专家观点 |
3759+
| ---------- | ------------- | -------- | -------- | -------- |
3760+
| jobopening | personnelplan | news | notice | opinion |
3761+
3762+
| 研究成果 | 研究论文 | 学术著作 | 形势政策 |
3763+
| -------- | -------- | -------- | -------- |
3764+
| results | papers | writings | policy |
3765+
3766+
</Route>

lib/config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const calculateValue = () => {
99
const twitter_tokens = {};
1010
const email_config = {};
1111
const discuz_cookies = {};
12+
const medium_cookies = {};
1213

1314
for (const name in envs) {
1415
if (name.startsWith('BILIBILI_COOKIE_')) {
@@ -23,6 +24,9 @@ const calculateValue = () => {
2324
} else if (name.startsWith('DISCUZ_COOKIE_')) {
2425
const cid = name.slice(14);
2526
discuz_cookies[cid] = envs[name];
27+
} else if (name.startsWith('MEDIUM_COOKIE_')) {
28+
const username = name.slice(14).toLowerCase();
29+
medium_cookies[username] = envs[name];
2630
}
2731
}
2832

@@ -208,6 +212,10 @@ const calculateValue = () => {
208212
accessToken: envs.MASTODON_API_ACCESS_TOKEN,
209213
acctDomain: envs.MASTODON_API_ACCT_DOMAIN,
210214
},
215+
medium: {
216+
cookies: medium_cookies,
217+
articleCookie: envs.MEDIUM_ARTICLE_COOKIE || '',
218+
},
211219
miniflux: {
212220
instance: envs.MINIFLUX_INSTANCE || 'https://reader.miniflux.app',
213221
token: envs.MINIFLUX_TOKEN || '',

0 commit comments

Comments
 (0)