rsshub 1.0.0-master.baeafb9 → 1.0.0-master.bafb353
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/lib/config.js +6 -1
- package/lib/middleware/cache/index.js +3 -3
- package/lib/middleware/cache/memory.js +5 -11
- package/lib/middleware/template.js +8 -2
- package/lib/router.js +44 -43
- package/lib/routes/amd/graphicsdrivers.js +1 -1
- package/lib/routes/disqus/posts.js +1 -1
- package/lib/routes/fanfou/favorites.js +1 -1
- package/lib/routes/fanfou/home_timeline.js +1 -1
- package/lib/routes/fanfou/public_timeline.js +1 -1
- package/lib/routes/fanfou/user_timeline.js +1 -1
- package/lib/routes/instagram/utils.js +1 -1
- package/lib/routes/lastfm/loved.js +1 -1
- package/lib/routes/lastfm/recent.js +1 -1
- package/lib/routes/lastfm/top.js +1 -1
- package/lib/routes/nhentai/util.js +1 -1
- package/lib/routes/pixiv/bookmarks.js +1 -1
- package/lib/routes/pixiv/illustfollow.js +1 -1
- package/lib/routes/pixiv/ranking.js +1 -1
- package/lib/routes/pixiv/search.js +1 -1
- package/lib/routes/pixiv/user.js +1 -1
- package/lib/routes/tencent/wechat/_README +1 -0
- package/lib/routes/tencent/wechat/ce.js +45 -16
- package/lib/routes/tencent/wechat/ershcimi.js +11 -19
- package/lib/routes/tencent/wechat/feeds.js +8 -32
- package/lib/routes/tencent/wechat/mp.js +8 -26
- package/lib/routes/tencent/wechat/msgalbum.js +7 -25
- package/lib/routes/tencent/wechat/tgchannel.js +6 -26
- package/lib/routes/twitter/keyword.js +9 -4
- package/lib/routes/twitter/likes.js +1 -1
- package/lib/routes/twitter/list.js +1 -1
- package/lib/routes/twitter/trends.js +1 -1
- package/lib/routes/twitter/user.js +9 -4
- package/lib/routes/twitter/web-api/media.js +5 -2
- package/lib/routes/twitter/web-api/twitter-api.js +105 -20
- package/lib/routes/twitter/web-api/twitter-got.js +4 -0
- package/lib/routes/twitter/web-api/user.js +5 -4
- package/lib/routes/weibo/keyword.js +18 -10
- package/lib/routes/weibo/super_index.js +24 -15
- package/lib/routes/weibo/timeline.js +38 -19
- package/lib/routes/weibo/user.js +47 -21
- package/lib/routes/weibo/utils.js +81 -12
- package/lib/routes/youtube/channel.js +1 -1
- package/lib/routes/youtube/playlist.js +1 -1
- package/lib/routes/youtube/user.js +1 -1
- package/lib/utils/common-config.js +4 -0
- package/lib/utils/common-utils.js +14 -0
- package/lib/utils/parse-date.js +172 -17
- package/lib/utils/rand-user-agent.js +29 -0
- package/lib/utils/torrent.js +9 -1
- package/lib/utils/wechat-mp.js +209 -0
- package/lib/v2/asus/bios.js +38 -0
- package/lib/v2/asus/maintainer.js +3 -0
- package/lib/v2/asus/radar.js +13 -0
- package/lib/v2/asus/router.js +3 -0
- package/lib/v2/asus/templates/bios.art +6 -0
- package/lib/v2/bilibili/liveArea.js +2 -12
- package/lib/v2/bookfere/category.js +36 -0
- package/lib/v2/bookfere/maintainer.js +3 -0
- package/lib/v2/bookfere/radar.js +11 -0
- package/lib/v2/bookfere/router.js +3 -0
- package/lib/v2/brooklynmuseum/exhibitions.js +27 -0
- package/lib/v2/brooklynmuseum/maintainer.js +3 -0
- package/lib/v2/brooklynmuseum/radar.js +11 -0
- package/lib/v2/brooklynmuseum/router.js +3 -0
- package/lib/v2/douban/people/status.js +10 -2
- package/lib/v2/douban/people/wish.js +55 -43
- package/lib/v2/dut/defaults.js +53 -0
- package/lib/v2/dut/index.js +78 -0
- package/lib/v2/dut/maintainer.js +14 -0
- package/lib/v2/dut/radar.js +109 -0
- package/lib/v2/dut/router.js +4 -0
- package/lib/v2/dut/shortcuts.js +77 -0
- package/lib/v2/fortunechina/index.js +3 -3
- package/lib/{routes → v2}/gamer/gnn_index.js +6 -7
- package/lib/v2/gamer/maintainer.js +1 -0
- package/lib/v2/gamer/radar.js +16 -0
- package/lib/v2/gamer/router.js +1 -0
- package/lib/v2/gaze/maintainer.js +3 -0
- package/lib/v2/gaze/radar.js +13 -0
- package/lib/v2/gaze/router.js +3 -0
- package/lib/v2/gaze/templates/update.art +4 -0
- package/lib/v2/gaze/update.js +27 -0
- package/lib/v2/github/issue.js +6 -2
- package/lib/v2/github/pulls.js +1 -1
- package/lib/v2/gov/anhui/kjt.js +56 -0
- package/lib/v2/gov/maintainer.js +2 -1
- package/lib/v2/gov/radar.js +90 -76
- package/lib/v2/gov/router.js +2 -1
- package/lib/v2/gov/sichuan/deyang/govpulicinfo.js +54 -74
- package/lib/v2/gov/sichuan/deyang/templates/govPublicInfo.art +1 -0
- package/lib/v2/guangdiu/cheaps.js +28 -0
- package/lib/v2/guangdiu/index.js +44 -0
- package/lib/v2/guangdiu/maintainer.js +5 -0
- package/lib/v2/guangdiu/radar.js +25 -0
- package/lib/v2/guangdiu/rank.js +38 -0
- package/lib/v2/guangdiu/router.js +5 -0
- package/lib/v2/guggenheim/exhibitions.js +29 -0
- package/lib/v2/guggenheim/maintainer.js +3 -0
- package/lib/v2/guggenheim/radar.js +11 -0
- package/lib/v2/guggenheim/router.js +3 -0
- package/lib/v2/gzh360/_README +1 -0
- package/lib/v2/gzh360/category.js +8 -0
- package/lib/v2/gzh360/gzh.js +18 -0
- package/lib/v2/gzh360/maintainer.js +4 -0
- package/lib/v2/gzh360/radar.js +19 -0
- package/lib/v2/gzh360/router.js +4 -0
- package/lib/v2/gzh360/universal.js +53 -0
- package/lib/v2/gzh360/utils.js +62 -0
- package/lib/v2/hameln/chapter.js +59 -0
- package/lib/v2/hameln/maintainer.js +3 -0
- package/lib/v2/hameln/radar.js +13 -0
- package/lib/v2/hameln/router.js +1 -0
- package/lib/v2/hnrb/index.js +85 -0
- package/lib/v2/hnrb/maintainer.js +3 -0
- package/lib/v2/hnrb/radar.js +13 -0
- package/lib/v2/hnrb/router.js +3 -0
- package/lib/v2/hupu/all.js +73 -0
- package/lib/v2/hupu/bbs.js +64 -0
- package/lib/v2/hupu/index.js +72 -0
- package/lib/v2/hupu/maintainer.js +7 -0
- package/lib/v2/hupu/radar.js +35 -0
- package/lib/v2/hupu/router.js +7 -0
- package/lib/v2/hupu/templates/description.art +6 -0
- package/lib/v2/hyqss/index.js +89 -0
- package/lib/v2/hyqss/maintainer.js +4 -0
- package/lib/v2/hyqss/radar.js +22 -0
- package/lib/v2/hyqss/router.js +3 -0
- package/lib/{routes → v2}/ifeng/feng.js +7 -5
- package/lib/v2/ifeng/maintainer.js +3 -0
- package/lib/v2/ifeng/radar.js +11 -0
- package/lib/v2/ifeng/router.js +3 -0
- package/lib/{routes → v2}/ifeng/utils.js +0 -0
- package/lib/v2/jewishmuseum/exhibitions.js +16 -0
- package/lib/v2/jewishmuseum/maintainer.js +3 -0
- package/lib/v2/jewishmuseum/radar.js +11 -0
- package/lib/v2/jewishmuseum/router.js +3 -0
- package/lib/v2/kakuyomu/episode.js +54 -0
- package/lib/v2/kakuyomu/maintainer.js +3 -0
- package/lib/v2/kakuyomu/radar.js +13 -0
- package/lib/v2/kakuyomu/router.js +1 -0
- package/lib/v2/kyodonews/index.js +123 -0
- package/lib/v2/kyodonews/maintainer.js +3 -0
- package/lib/v2/kyodonews/radar.js +33 -0
- package/lib/v2/kyodonews/router.js +3 -0
- package/lib/v2/kyodonews/templates/article.art +4 -0
- package/lib/v2/mcachicago/exhibitions.js +17 -0
- package/lib/v2/mcachicago/maintainer.js +3 -0
- package/lib/v2/mcachicago/radar.js +11 -0
- package/lib/v2/mcachicago/router.js +3 -0
- package/lib/v2/metmuseum/exhibitions.js +31 -0
- package/lib/v2/metmuseum/maintainer.js +3 -0
- package/lib/v2/metmuseum/radar.js +11 -0
- package/lib/v2/metmuseum/router.js +3 -0
- package/lib/v2/mihoyo/bbs.js +62 -0
- package/lib/v2/mihoyo/maintainer.js +3 -0
- package/lib/v2/mihoyo/radar.js +31 -0
- package/lib/v2/mihoyo/router.js +3 -0
- package/lib/v2/mihoyo/templates/description.art +6 -0
- package/lib/v2/miris/blog.js +19 -0
- package/lib/v2/miris/maintainer.js +3 -0
- package/lib/v2/miris/radar.js +11 -0
- package/lib/v2/miris/router.js +3 -0
- package/lib/{routes → v2}/mpaypass/main.js +23 -27
- package/lib/v2/mpaypass/maintainer.js +4 -0
- package/lib/v2/mpaypass/news.js +39 -0
- package/lib/v2/mpaypass/radar.js +19 -0
- package/lib/v2/mpaypass/router.js +4 -0
- package/lib/v2/mtime/maintainer.js +3 -0
- package/lib/v2/mtime/news.js +48 -0
- package/lib/v2/mtime/radar.js +13 -0
- package/lib/v2/mtime/router.js +3 -0
- package/lib/v2/natgeo/dailyphoto.js +32 -0
- package/lib/v2/natgeo/dailyselection.js +41 -0
- package/lib/v2/natgeo/maintainer.js +5 -0
- package/lib/{routes → v2}/natgeo/natgeo.js +18 -32
- package/lib/v2/natgeo/radar.js +24 -0
- package/lib/v2/natgeo/router.js +5 -0
- package/lib/v2/natgeo/templates/dailyPhoto.art +5 -0
- package/lib/v2/newmuseum/exhibitions.js +27 -0
- package/lib/v2/newmuseum/maintainer.js +3 -0
- package/lib/v2/newmuseum/radar.js +11 -0
- package/lib/v2/newmuseum/router.js +3 -0
- package/lib/v2/npm/maintainer.js +3 -0
- package/lib/v2/npm/package.js +45 -0
- package/lib/v2/npm/radar.js +13 -0
- package/lib/v2/npm/router.js +3 -0
- package/lib/v2/npm/templates/package.art +10 -0
- package/lib/v2/nuaa/cs/index.js +87 -0
- package/lib/v2/nuaa/jwc/jwc.js +82 -0
- package/lib/v2/nuaa/maintainer.js +5 -0
- package/lib/v2/nuaa/radar.js +23 -0
- package/lib/v2/nuaa/router.js +5 -0
- package/lib/{routes/universities → v2}/nuaa/utils/pypasswaf.js +1 -1
- package/lib/{routes/universities → v2}/nuaa/yjsy/yjsy.js +16 -22
- package/lib/v2/picuki/profile.js +12 -3
- package/lib/v2/pubmed/maintainer.js +3 -0
- package/lib/v2/pubmed/radar.js +13 -0
- package/lib/v2/pubmed/router.js +3 -0
- package/lib/v2/pubmed/templates/description.art +7 -0
- package/lib/v2/pubmed/trending.js +58 -0
- package/lib/v2/qbittorrent/maintainer.js +3 -0
- package/lib/v2/qbittorrent/news.js +53 -0
- package/lib/v2/qbittorrent/radar.js +13 -0
- package/lib/v2/qbittorrent/router.js +3 -0
- package/lib/v2/quicker/maintainer.js +7 -0
- package/lib/v2/quicker/qa.js +65 -0
- package/lib/v2/quicker/radar.js +31 -0
- package/lib/v2/quicker/router.js +7 -0
- package/lib/v2/quicker/share.js +61 -0
- package/lib/v2/quicker/user.js +62 -0
- package/lib/v2/quicker/versions.js +36 -0
- package/lib/v2/qweather/3days.js +46 -0
- package/lib/v2/qweather/maintainer.js +4 -0
- package/lib/v2/qweather/now.js +46 -0
- package/lib/v2/qweather/router.js +4 -0
- package/lib/v2/qweather/util/3days.art +20 -0
- package/lib/v2/qweather/util/now.art +16 -0
- package/lib/v2/rsshub/sponsors.js +1 -0
- package/lib/{routes → v2}/sciencenet/blog.js +17 -12
- package/lib/v2/sciencenet/maintainer.js +4 -0
- package/lib/v2/sciencenet/radar.js +19 -0
- package/lib/v2/sciencenet/router.js +4 -0
- package/lib/v2/sciencenet/user.js +65 -0
- package/lib/v2/stratechery/index.js +20 -0
- package/lib/v2/stratechery/maintainer.js +3 -0
- package/lib/v2/stratechery/radar.js +11 -0
- package/lib/v2/stratechery/router.js +3 -0
- package/lib/v2/telegram/channel.js +10 -6
- package/lib/v2/telegram/stickerpack.js +1 -1
- package/lib/v2/test/index.js +1 -1
- package/lib/{routes → v2}/thepaper/839studio/category.js +0 -0
- package/lib/{routes → v2}/thepaper/839studio/studio.js +0 -0
- package/lib/{routes → v2}/thepaper/channel.js +0 -0
- package/lib/v2/thepaper/factpaper.js +61 -0
- package/lib/{routes → v2}/thepaper/featured.js +0 -0
- package/lib/{routes → v2}/thepaper/list.js +0 -0
- package/lib/v2/thepaper/maintainer.js +8 -0
- package/lib/v2/thepaper/radar.js +42 -0
- package/lib/v2/thepaper/router.js +8 -0
- package/lib/v2/thepaper/templates/factpaper.art +12 -0
- package/lib/v2/thepaper/utils.js +55 -0
- package/lib/{routes → v2}/twreporter/category.js +7 -12
- package/lib/{routes → v2}/twreporter/fetch_article.js +5 -4
- package/lib/v2/twreporter/maintainer.js +5 -0
- package/lib/{routes → v2}/twreporter/newest.js +8 -13
- package/lib/v2/twreporter/photography.js +46 -0
- package/lib/v2/twreporter/radar.js +25 -0
- package/lib/v2/twreporter/router.js +5 -0
- package/lib/v2/wechat/_README +1 -0
- package/lib/v2/wechat/feeddd.js +3 -46
- package/lib/{routes → v2}/xueqiu/favorite.js +2 -1
- package/lib/v2/xueqiu/fund.js +50 -0
- package/lib/{routes → v2}/xueqiu/hots.js +2 -1
- package/lib/v2/xueqiu/maintainer.js +10 -0
- package/lib/v2/xueqiu/radar.js +60 -0
- package/lib/v2/xueqiu/router.js +10 -0
- package/lib/{routes → v2}/xueqiu/snb.js +2 -1
- package/lib/{routes → v2}/xueqiu/stock_comments.js +4 -20
- package/lib/{routes → v2}/xueqiu/stock_info.js +2 -1
- package/lib/v2/xueqiu/templates/comments_description.art +10 -0
- package/lib/{routes → v2}/xueqiu/user.js +2 -1
- package/lib/{routes → v2}/xueqiu/user_stock.js +3 -2
- package/lib/v2/zooTeam/blog.js +32 -0
- package/lib/v2/zooTeam/maintainer.js +4 -0
- package/lib/v2/zooTeam/radar.js +21 -0
- package/lib/v2/zooTeam/router.js +4 -0
- package/lib/v2/zooTeam/weekly.js +34 -0
- package/lib/views/atom.art +4 -2
- package/package.json +17 -14
- package/lib/routes/hupu/all.js +0 -53
- package/lib/routes/hupu/bbs.js +0 -83
- package/lib/routes/hupu/dept.js +0 -66
- package/lib/routes/mpaypass/news.js +0 -43
- package/lib/routes/natgeo/dailyphoto.js +0 -27
- package/lib/routes/pubmed/trending.js +0 -65
- package/lib/routes/quicker/person.js +0 -32
- package/lib/routes/quicker/qa.js +0 -41
- package/lib/routes/quicker/update.js +0 -30
- package/lib/routes/tencent/wechat/csm.js +0 -59
- package/lib/routes/tencent/wechat/wjdn.js +0 -28
- package/lib/routes/thepaper/utils.js +0 -48
- package/lib/routes/twreporter/photography.js +0 -57
- package/lib/routes/universities/dut/index.js +0 -60
- package/lib/routes/universities/dut/subsite.js +0 -50
- package/lib/routes/universities/nuaa/cs/index.js +0 -84
- package/lib/routes/universities/nuaa/jwc/jwc.js +0 -105
- package/lib/routes/xueqiu/fund.js +0 -71
package/README.md
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
> 🍰 Everything is RSSible
|
|
7
7
|
|
|
8
|
-
[](https://t.me/rsshub)
|
|
9
|
-
[](https://t.me/rsshub)
|
|
9
|
+
[](https://www.npmjs.com/package/rsshub)
|
|
10
|
+
[](https://hub.docker.com/r/diygod/rsshub)
|
|
11
|
+
[](https://github.com/DIYgod/RSSHub/actions/workflows/test.yml?query=event%3Apush+branch%3Amaster)
|
|
11
12
|
|
|
12
13
|
## Introduction
|
|
13
14
|
|
|
@@ -37,7 +38,7 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以
|
|
|
37
38
|
|
|
38
39
|
### Sponsors
|
|
39
40
|
|
|
40
|
-
[Sayori Studio](https://t.me/SayoriStudio) . [Sion Kazama](https://blog.sion.moe) . [琚致远](https://wineso.me/) . [Rolly RSS 阅读器](https://www.coolapk.com/apk/239500) . [mokeyjay](https://www.mokeyjay.com/) . [萌开源联盟](https://www.moeunion.com) . [hooke007](https://github.com/hooke007/MPV_lazy) . [feeds.pub](https://feeds.pub)
|
|
41
|
+
[Sayori Studio](https://t.me/SayoriStudio) . [Sion Kazama](https://blog.sion.moe) . [琚致远](https://wineso.me/) . [Rolly RSS 阅读器](https://www.coolapk.com/apk/239500) . [mokeyjay](https://www.mokeyjay.com/) . [萌开源联盟](https://www.moeunion.com) . [hooke007](https://github.com/hooke007/MPV_lazy) . [feeds.pub](https://feeds.pub) . [KINGX@安全引擎](http://cve.today/)
|
|
41
42
|
|
|
42
43
|
[](https://docs.rsshub.app/en/support/)
|
|
43
44
|
|
package/lib/config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require('dotenv').config();
|
|
2
|
+
const randUserAgent = require('@/utils/rand-user-agent');
|
|
2
3
|
let envs = process.env;
|
|
3
4
|
let value;
|
|
4
5
|
|
|
@@ -39,7 +40,7 @@ const calculateValue = () => {
|
|
|
39
40
|
listenInaddrAny: envs.LISTEN_INADDR_ANY || 1, // 是否允许公网连接,取值 0 1
|
|
40
41
|
requestRetry: parseInt(envs.REQUEST_RETRY) || 2, // 请求失败重试次数
|
|
41
42
|
requestTimeout: parseInt(envs.REQUEST_TIMEOUT) || 30000, // Milliseconds to wait for the server to end the response before aborting the request
|
|
42
|
-
ua: envs.UA ||
|
|
43
|
+
ua: envs.UA || randUserAgent({ browser: 'chrome', os: 'mac os', device: 'desktop' }),
|
|
43
44
|
// cors request
|
|
44
45
|
allowOrigin: envs.ALLOW_ORIGIN,
|
|
45
46
|
// cache
|
|
@@ -149,6 +150,10 @@ const calculateValue = () => {
|
|
|
149
150
|
google: {
|
|
150
151
|
fontsApiKey: envs.GOOGLE_FONTS_API_KEY,
|
|
151
152
|
},
|
|
153
|
+
hefeng: {
|
|
154
|
+
// weather
|
|
155
|
+
key: envs.HEFENG_KEY,
|
|
156
|
+
},
|
|
152
157
|
infzm: {
|
|
153
158
|
cookie: envs.INFZM_COOKIE,
|
|
154
159
|
},
|
|
@@ -27,10 +27,10 @@ if (config.cache.type === 'redis') {
|
|
|
27
27
|
globalCache.set = cacheModule.set;
|
|
28
28
|
} else if (config.cache.type === 'memory') {
|
|
29
29
|
cacheModule = require('./memory');
|
|
30
|
-
const {
|
|
30
|
+
const { memoryCache } = cacheModule.clients;
|
|
31
31
|
globalCache.get = (key) => {
|
|
32
32
|
if (key && cacheModule.status.available) {
|
|
33
|
-
return
|
|
33
|
+
return memoryCache.get(key, { updateAgeOnGet: false });
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
globalCache.set = (key, value, maxAge) => {
|
|
@@ -41,7 +41,7 @@ if (config.cache.type === 'redis') {
|
|
|
41
41
|
value = JSON.stringify(value);
|
|
42
42
|
}
|
|
43
43
|
if (key) {
|
|
44
|
-
return
|
|
44
|
+
return memoryCache.set(key, value, { ttl: maxAge * 1000 });
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
} else {
|
|
@@ -3,30 +3,24 @@ const config = require('@/config').value;
|
|
|
3
3
|
|
|
4
4
|
const status = { available: false };
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const memoryCache = new Lru({
|
|
7
7
|
ttl: config.cache.routeExpire * 1000,
|
|
8
8
|
max: config.memory.max,
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const routeCache = new Lru({
|
|
12
|
-
ttl: config.cache.routeExpire * 1000,
|
|
13
|
-
max: config.memory.max,
|
|
14
|
-
updateAgeOnGet: true,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
11
|
status.available = true;
|
|
18
12
|
|
|
19
13
|
module.exports = {
|
|
20
14
|
get: (key, refresh = true) => {
|
|
21
15
|
if (key && status.available) {
|
|
22
|
-
let value = (
|
|
16
|
+
let value = memoryCache.get(key, { updateAgeOnGet: refresh });
|
|
23
17
|
if (value) {
|
|
24
18
|
value = value + '';
|
|
25
19
|
}
|
|
26
20
|
return value;
|
|
27
21
|
}
|
|
28
22
|
},
|
|
29
|
-
set: (key, value, maxAge = config.cache.contentExpire
|
|
23
|
+
set: (key, value, maxAge = config.cache.contentExpire) => {
|
|
30
24
|
if (!value || value === 'undefined') {
|
|
31
25
|
value = '';
|
|
32
26
|
}
|
|
@@ -34,9 +28,9 @@ module.exports = {
|
|
|
34
28
|
value = JSON.stringify(value);
|
|
35
29
|
}
|
|
36
30
|
if (key && status.available) {
|
|
37
|
-
return
|
|
31
|
+
return memoryCache.set(key, value, { ttl: maxAge * 1000 });
|
|
38
32
|
}
|
|
39
33
|
},
|
|
40
|
-
clients: {
|
|
34
|
+
clients: { memoryCache },
|
|
41
35
|
status,
|
|
42
36
|
};
|
|
@@ -2,7 +2,7 @@ const art = require('art-template');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const config = require('@/config').value;
|
|
4
4
|
const typeRegex = /\.(atom|rss|debug\.json)$/;
|
|
5
|
-
const { collapseWhitespace } = require('@/utils/common-utils');
|
|
5
|
+
const { collapseWhitespace, convertDateToISO8601 } = require('@/utils/common-utils');
|
|
6
6
|
|
|
7
7
|
module.exports = async (ctx, next) => {
|
|
8
8
|
if (ctx.headers['user-agent'] && ctx.headers['user-agent'].includes('Reeder')) {
|
|
@@ -28,7 +28,8 @@ module.exports = async (ctx, next) => {
|
|
|
28
28
|
if (!ctx.body) {
|
|
29
29
|
let template;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const outputType = ctx.state.type[1];
|
|
32
|
+
switch (outputType) {
|
|
32
33
|
case 'atom':
|
|
33
34
|
template = path.resolve(__dirname, '../views/atom.art');
|
|
34
35
|
break;
|
|
@@ -66,6 +67,11 @@ module.exports = async (ctx, next) => {
|
|
|
66
67
|
item.itunes_duration =
|
|
67
68
|
Math.floor(item.itunes_duration / 3600) + ':' + (Math.floor((item.itunes_duration % 3600) / 60) / 100).toFixed(2).slice(-2) + ':' + (((item.itunes_duration % 3600) % 60) / 100).toFixed(2).slice(-2);
|
|
68
69
|
}
|
|
70
|
+
|
|
71
|
+
if (outputType === 'atom') {
|
|
72
|
+
item.pubDate = convertDateToISO8601(item.pubDate);
|
|
73
|
+
item.updated = convertDateToISO8601(item.updated);
|
|
74
|
+
}
|
|
69
75
|
});
|
|
70
76
|
}
|
|
71
77
|
|
package/lib/router.js
CHANGED
|
@@ -25,10 +25,10 @@ const lazyloadRouteHandler = (routeHandlerPath) => (ctx) => {
|
|
|
25
25
|
router.get('/1draw', lazyloadRouteHandler('./routes/1draw/index'));
|
|
26
26
|
|
|
27
27
|
// quicker
|
|
28
|
-
router.get('/quicker/qa', lazyloadRouteHandler('./routes/quicker/qa.js'));
|
|
29
|
-
router.get('/quicker/update', lazyloadRouteHandler('./routes/quicker/update.js'));
|
|
30
|
-
router.get('/quicker/user/action/:uid/:person', lazyloadRouteHandler('./routes/quicker/person.js'));
|
|
31
|
-
router.get('/quicker/user/:uid/:person', lazyloadRouteHandler('./routes/quicker/person.js'));
|
|
28
|
+
// router.get('/quicker/qa', lazyloadRouteHandler('./routes/quicker/qa.js'));
|
|
29
|
+
// router.get('/quicker/update', lazyloadRouteHandler('./routes/quicker/update.js'));
|
|
30
|
+
// router.get('/quicker/user/action/:uid/:person', lazyloadRouteHandler('./routes/quicker/person.js'));
|
|
31
|
+
// router.get('/quicker/user/:uid/:person', lazyloadRouteHandler('./routes/quicker/person.js'));
|
|
32
32
|
|
|
33
33
|
// Benedict Evans
|
|
34
34
|
router.get('/benedictevans', lazyloadRouteHandler('./routes/benedictevans/recent.js'));
|
|
@@ -42,10 +42,10 @@ router.get('/bangumi/group/:id', lazyloadRouteHandler('./routes/bangumi/group/to
|
|
|
42
42
|
router.get('/bangumi/subject/:id', lazyloadRouteHandler('./routes/bangumi/subject'));
|
|
43
43
|
router.get('/bangumi/user/blog/:id', lazyloadRouteHandler('./routes/bangumi/user/blog'));
|
|
44
44
|
|
|
45
|
-
// 報導者
|
|
46
|
-
router.get('/twreporter/newest', lazyloadRouteHandler('./routes/twreporter/newest'));
|
|
47
|
-
router.get('/twreporter/photography', lazyloadRouteHandler('./routes/twreporter/photography'));
|
|
48
|
-
router.get('/twreporter/category/:cid', lazyloadRouteHandler('./routes/twreporter/category'));
|
|
45
|
+
// 報導者 migrated to v2
|
|
46
|
+
// router.get('/twreporter/newest', lazyloadRouteHandler('./routes/twreporter/newest'));
|
|
47
|
+
// router.get('/twreporter/photography', lazyloadRouteHandler('./routes/twreporter/photography'));
|
|
48
|
+
// router.get('/twreporter/category/:cid', lazyloadRouteHandler('./routes/twreporter/category'));
|
|
49
49
|
|
|
50
50
|
// 微博
|
|
51
51
|
router.get('/weibo/user/:uid/:routeParams?', lazyloadRouteHandler('./routes/weibo/user'));
|
|
@@ -301,9 +301,10 @@ router.get('/t66y/:id/:type?', lazyloadRouteHandler('./routes/t66y/index'));
|
|
|
301
301
|
// 色中色
|
|
302
302
|
router.get('/sexinsex/:id/:type?', lazyloadRouteHandler('./routes/sexinsex/index'));
|
|
303
303
|
|
|
304
|
-
// 国家地理
|
|
305
|
-
router.get('/natgeo/
|
|
306
|
-
router.get('/natgeo
|
|
304
|
+
// 国家地理 migrated to v2
|
|
305
|
+
// router.get('/natgeo/dailyselection', lazyloadRouteHandler('./routes/natgeo/dailyselection'));
|
|
306
|
+
// router.get('/natgeo/dailyphoto', lazyloadRouteHandler('./routes/natgeo/dailyphoto'));
|
|
307
|
+
// router.get('/natgeo/:cat/:type?', lazyloadRouteHandler('./routes/natgeo/natgeo'));
|
|
307
308
|
|
|
308
309
|
// 一个
|
|
309
310
|
router.get('/one', lazyloadRouteHandler('./routes/one/index'));
|
|
@@ -376,15 +377,15 @@ router.get('/egsea/flash', lazyloadRouteHandler('./routes/egsea/flash'));
|
|
|
376
377
|
// 选股宝
|
|
377
378
|
router.get('/xuangubao/subject/:subject_id', lazyloadRouteHandler('./routes/xuangubao/subject'));
|
|
378
379
|
|
|
379
|
-
// 雪球
|
|
380
|
-
router.get('/xueqiu/user/:id/:type?', lazyloadRouteHandler('./routes/xueqiu/user'));
|
|
381
|
-
router.get('/xueqiu/favorite/:id', lazyloadRouteHandler('./routes/xueqiu/favorite'));
|
|
382
|
-
router.get('/xueqiu/user_stock/:id', lazyloadRouteHandler('./routes/xueqiu/user_stock'));
|
|
383
|
-
router.get('/xueqiu/fund/:id', lazyloadRouteHandler('./routes/xueqiu/fund'));
|
|
384
|
-
router.get('/xueqiu/stock_info/:id/:type?', lazyloadRouteHandler('./routes/xueqiu/stock_info'));
|
|
385
|
-
router.get('/xueqiu/snb/:id', lazyloadRouteHandler('./routes/xueqiu/snb'));
|
|
386
|
-
router.get('/xueqiu/hots', lazyloadRouteHandler('./routes/xueqiu/hots'));
|
|
387
|
-
router.get('/xueqiu/stock_comments/:id/:titleLength?', lazyloadRouteHandler('./routes/xueqiu/stock_comments'));
|
|
380
|
+
// 雪球 migrated to v2
|
|
381
|
+
// router.get('/xueqiu/user/:id/:type?', lazyloadRouteHandler('./routes/xueqiu/user'));
|
|
382
|
+
// router.get('/xueqiu/favorite/:id', lazyloadRouteHandler('./routes/xueqiu/favorite'));
|
|
383
|
+
// router.get('/xueqiu/user_stock/:id', lazyloadRouteHandler('./routes/xueqiu/user_stock'));
|
|
384
|
+
// router.get('/xueqiu/fund/:id', lazyloadRouteHandler('./routes/xueqiu/fund'));
|
|
385
|
+
// router.get('/xueqiu/stock_info/:id/:type?', lazyloadRouteHandler('./routes/xueqiu/stock_info'));
|
|
386
|
+
// router.get('/xueqiu/snb/:id', lazyloadRouteHandler('./routes/xueqiu/snb'));
|
|
387
|
+
// router.get('/xueqiu/hots', lazyloadRouteHandler('./routes/xueqiu/hots'));
|
|
388
|
+
// router.get('/xueqiu/stock_comments/:id/:titleLength?', lazyloadRouteHandler('./routes/xueqiu/stock_comments'));
|
|
388
389
|
|
|
389
390
|
// Greasy Fork
|
|
390
391
|
router.get('/greasyfork/:language/:domain?', lazyloadRouteHandler('./routes/greasyfork/scripts'));
|
|
@@ -509,7 +510,7 @@ router.get('/dpu/jiaowu/news/:type?', lazyloadRouteHandler('./routes/universitie
|
|
|
509
510
|
router.get('/dpu/wlfw/news/:type?', lazyloadRouteHandler('./routes/universities/dpu/wlfw/news'));
|
|
510
511
|
|
|
511
512
|
// 大连理工大学
|
|
512
|
-
router.get('/dut/:subsite/:type', lazyloadRouteHandler('./routes/universities/dut/index'));
|
|
513
|
+
// router.get('/dut/:subsite/:type', lazyloadRouteHandler('./routes/universities/dut/index'));
|
|
513
514
|
|
|
514
515
|
// 东南大学
|
|
515
516
|
router.get('/seu/radio/academic', lazyloadRouteHandler('./routes/universities/seu/radio/academic'));
|
|
@@ -519,10 +520,10 @@ router.get('/seu/cse/:type?', lazyloadRouteHandler('./routes/universities/seu/cs
|
|
|
519
520
|
// 南京工业大学
|
|
520
521
|
router.get('/njtech/jwc', lazyloadRouteHandler('./routes/universities/njtech/jwc'));
|
|
521
522
|
|
|
522
|
-
// 南京航空航天大学
|
|
523
|
-
router.get('/nuaa/jwc/:type?', lazyloadRouteHandler('./routes/universities/nuaa/jwc/jwc'));
|
|
524
|
-
router.get('/nuaa/cs/:type?', lazyloadRouteHandler('./routes/universities/nuaa/cs/index'));
|
|
525
|
-
router.get('/nuaa/yjsy/:type?', lazyloadRouteHandler('./routes/universities/nuaa/yjsy/yjsy'));
|
|
523
|
+
// 南京航空航天大学 migrated to v2
|
|
524
|
+
// router.get('/nuaa/jwc/:type/:getDescription?', lazyloadRouteHandler('./routes/universities/nuaa/jwc/jwc'));
|
|
525
|
+
// router.get('/nuaa/cs/:type/:getDescription?', lazyloadRouteHandler('./routes/universities/nuaa/cs/index'));
|
|
526
|
+
// router.get('/nuaa/yjsy/:type?', lazyloadRouteHandler('./routes/universities/nuaa/yjsy/yjsy'));
|
|
526
527
|
|
|
527
528
|
// 河海大学
|
|
528
529
|
router.get('/hhu/libNews', lazyloadRouteHandler('./routes/universities/hhu/libNews'));
|
|
@@ -848,13 +849,13 @@ router.get('/xclient/app/:name', lazyloadRouteHandler('./routes/xclient/app'));
|
|
|
848
849
|
router.get('/embassy/:country/:city?', lazyloadRouteHandler('./routes/embassy/index'));
|
|
849
850
|
|
|
850
851
|
// 澎湃新闻
|
|
851
|
-
router.get('/thepaper/featured', lazyloadRouteHandler('./routes/thepaper/featured'));
|
|
852
|
-
router.get('/thepaper/channel/:id', lazyloadRouteHandler('./routes/thepaper/channel'));
|
|
853
|
-
router.get('/thepaper/list/:id', lazyloadRouteHandler('./routes/thepaper/list'));
|
|
852
|
+
// router.get('/thepaper/featured', lazyloadRouteHandler('./routes/thepaper/featured'));
|
|
853
|
+
// router.get('/thepaper/channel/:id', lazyloadRouteHandler('./routes/thepaper/channel'));
|
|
854
|
+
// router.get('/thepaper/list/:id', lazyloadRouteHandler('./routes/thepaper/list'));
|
|
854
855
|
|
|
855
856
|
// 澎湃美数课
|
|
856
|
-
router.get('/thepaper/839studio', lazyloadRouteHandler('./routes/thepaper/839studio/studio.js'));
|
|
857
|
-
router.get('/thepaper/839studio/:id', lazyloadRouteHandler('./routes/thepaper/839studio/category.js'));
|
|
857
|
+
// router.get('/thepaper/839studio', lazyloadRouteHandler('./routes/thepaper/839studio/studio.js'));
|
|
858
|
+
// router.get('/thepaper/839studio/:id', lazyloadRouteHandler('./routes/thepaper/839studio/category.js'));
|
|
858
859
|
|
|
859
860
|
// 电影首发站
|
|
860
861
|
router.get('/dysfz', lazyloadRouteHandler('./routes/dysfz/index'));
|
|
@@ -1264,9 +1265,9 @@ router.get('/xiaoheihe/discount/:platform?', lazyloadRouteHandler('./routes/xiao
|
|
|
1264
1265
|
// 惠誉评级
|
|
1265
1266
|
router.get('/fitchratings/site/:type', lazyloadRouteHandler('./routes/fitchratings/site'));
|
|
1266
1267
|
|
|
1267
|
-
// 移动支付
|
|
1268
|
-
router.get('/mpaypass/news', lazyloadRouteHandler('./routes/mpaypass/news'));
|
|
1269
|
-
router.get('/mpaypass/main/:type?', lazyloadRouteHandler('./routes/mpaypass/main'));
|
|
1268
|
+
// 移动支付 migrated to v2
|
|
1269
|
+
// router.get('/mpaypass/news', lazyloadRouteHandler('./routes/mpaypass/news'));
|
|
1270
|
+
// router.get('/mpaypass/main/:type?', lazyloadRouteHandler('./routes/mpaypass/main'));
|
|
1270
1271
|
|
|
1271
1272
|
// 新浪科技探索
|
|
1272
1273
|
router.get('/sina/discovery/:type', lazyloadRouteHandler('./routes/sina/discovery'));
|
|
@@ -1332,10 +1333,10 @@ router.get('/leetcode/submission/us/:user', lazyloadRouteHandler('./routes/leetc
|
|
|
1332
1333
|
router.get('/leetcode/submission/cn/:user', lazyloadRouteHandler('./routes/leetcode/check-cn'));
|
|
1333
1334
|
|
|
1334
1335
|
// 虎扑
|
|
1335
|
-
router.get('/hupu/bxj/:id/:order?', lazyloadRouteHandler('./routes/hupu/bbs'));
|
|
1336
|
-
router.get('/hupu/bbs/:id/:order?', lazyloadRouteHandler('./routes/hupu/bbs'));
|
|
1337
|
-
router.get('/hupu/all/:caty', lazyloadRouteHandler('./routes/hupu/all'));
|
|
1338
|
-
router.get('/hupu/dept/:dept', lazyloadRouteHandler('./routes/hupu/dept'));
|
|
1336
|
+
// router.get('/hupu/bxj/:id/:order?', lazyloadRouteHandler('./routes/hupu/bbs'));
|
|
1337
|
+
// router.get('/hupu/bbs/:id/:order?', lazyloadRouteHandler('./routes/hupu/bbs'));
|
|
1338
|
+
// router.get('/hupu/all/:caty', lazyloadRouteHandler('./routes/hupu/all'));
|
|
1339
|
+
// router.get('/hupu/dept/:dept', lazyloadRouteHandler('./routes/hupu/dept'));
|
|
1339
1340
|
|
|
1340
1341
|
// 牛客网 migrated to v2
|
|
1341
1342
|
// router.get('/nowcoder/discuss/:type/:order', lazyloadRouteHandler('./routes/nowcoder/discuss'));
|
|
@@ -2181,7 +2182,7 @@ router.get('/kaggle/competitions/:category?', lazyloadRouteHandler('./routes/kag
|
|
|
2181
2182
|
router.get('/kaggle/user/:user', lazyloadRouteHandler('./routes/kaggle/user'));
|
|
2182
2183
|
|
|
2183
2184
|
// PubMed Trending
|
|
2184
|
-
router.get('/pubmed/trending', lazyloadRouteHandler('./routes/pubmed/trending'));
|
|
2185
|
+
// router.get('/pubmed/trending', lazyloadRouteHandler('./routes/pubmed/trending'));
|
|
2185
2186
|
|
|
2186
2187
|
// 领科 (linkresearcher.com)
|
|
2187
2188
|
router.get('/linkresearcher/:params', lazyloadRouteHandler('./routes/linkresearcher/index'));
|
|
@@ -2457,8 +2458,8 @@ router.get('/lastfm/top/:country?', lazyloadRouteHandler('./routes/lastfm/top'))
|
|
|
2457
2458
|
router.get('/piapro/user/:pid', lazyloadRouteHandler('./routes/piapro/user'));
|
|
2458
2459
|
router.get('/piapro/public/:type/:tag?/:category?', lazyloadRouteHandler('./routes/piapro/public'));
|
|
2459
2460
|
|
|
2460
|
-
// 凤凰网
|
|
2461
|
-
router.get('/ifeng/feng/:id/:type', lazyloadRouteHandler('./routes/ifeng/feng'));
|
|
2461
|
+
// 凤凰网 migrated to v2
|
|
2462
|
+
// router.get('/ifeng/feng/:id/:type', lazyloadRouteHandler('./routes/ifeng/feng'));
|
|
2462
2463
|
|
|
2463
2464
|
// 第一版主
|
|
2464
2465
|
router.get('/novel/d1bz/:category/:id', lazyloadRouteHandler('./routes/d1bz/novel'));
|
|
@@ -3302,8 +3303,8 @@ router.get('/gov/taiwan/mnd', lazyloadRouteHandler('./routes/gov/taiwan/mnd'));
|
|
|
3302
3303
|
router.get('/yomiuri/:category', lazyloadRouteHandler('./routes/yomiuri/news'));
|
|
3303
3304
|
|
|
3304
3305
|
// 巴哈姆特
|
|
3305
|
-
// GNN新闻
|
|
3306
|
-
router.get('/gamer/gnn/:category?', lazyloadRouteHandler('./routes/gamer/gnn_index'));
|
|
3306
|
+
// GNN新闻 migrated to v2
|
|
3307
|
+
// router.get('/gamer/gnn/:category?', lazyloadRouteHandler('./routes/gamer/gnn_index'));
|
|
3307
3308
|
|
|
3308
3309
|
// 中国人大网
|
|
3309
3310
|
router.get('/npc/:caty', lazyloadRouteHandler('./routes/npc/index'));
|
|
@@ -3654,7 +3655,7 @@ router.get('/yicas/blog', lazyloadRouteHandler('./routes/yicas/blog'));
|
|
|
3654
3655
|
router.get('/93/:category?', lazyloadRouteHandler('./routes/93/index'));
|
|
3655
3656
|
|
|
3656
3657
|
// 科学网
|
|
3657
|
-
router.get('/sciencenet/blog/:type?/:time?/:sort?', lazyloadRouteHandler('./routes/sciencenet/blog'));
|
|
3658
|
+
// router.get('/sciencenet/blog/:type?/:time?/:sort?', lazyloadRouteHandler('./routes/sciencenet/blog'));
|
|
3658
3659
|
|
|
3659
3660
|
// DailyArt
|
|
3660
3661
|
router.get('/dailyart/:language?', lazyloadRouteHandler('./routes/dailyart/index'));
|
|
@@ -27,7 +27,7 @@ module.exports = async (ctx) => {
|
|
|
27
27
|
if (!data) {
|
|
28
28
|
const res = await got.get(url);
|
|
29
29
|
data = res.data;
|
|
30
|
-
ctx.cache.set(url, data, config.cache.contentExpire
|
|
30
|
+
ctx.cache.set(url, data, config.cache.contentExpire);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const $ = cheerio.load(data, { xmlMode: true });
|
|
@@ -3,7 +3,7 @@ const config = require('@/config').value;
|
|
|
3
3
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
if (!config.disqus || !config.disqus.api_key) {
|
|
6
|
-
throw 'Disqus RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install
|
|
6
|
+
throw 'Disqus RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
7
7
|
}
|
|
8
8
|
const forum = ctx.params.forum;
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ const utils = require('./utils');
|
|
|
3
3
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
if (!config.fanfou || !config.fanfou.consumer_key || !config.fanfou.consumer_secret || !config.fanfou.username || !config.fanfou.password) {
|
|
6
|
-
throw 'Fanfou RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
6
|
+
throw 'Fanfou RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const uid = ctx.params.uid;
|
|
@@ -3,7 +3,7 @@ const utils = require('./utils');
|
|
|
3
3
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
if (!config.fanfou || !config.fanfou.consumer_key || !config.fanfou.consumer_secret || !config.fanfou.username || !config.fanfou.password) {
|
|
6
|
-
throw 'Fanfou RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
6
|
+
throw 'Fanfou RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const fanfou = await utils.getFanfou();
|
|
@@ -3,7 +3,7 @@ const utils = require('./utils');
|
|
|
3
3
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
if (!config.fanfou || !config.fanfou.consumer_key || !config.fanfou.consumer_secret || !config.fanfou.username || !config.fanfou.password) {
|
|
6
|
-
throw 'Fanfou RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
6
|
+
throw 'Fanfou RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const keyword = ctx.params.keyword;
|
|
@@ -3,7 +3,7 @@ const utils = require('./utils');
|
|
|
3
3
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
if (!config.fanfou || !config.fanfou.consumer_key || !config.fanfou.consumer_secret || !config.fanfou.username || !config.fanfou.password) {
|
|
6
|
-
throw 'Fanfou RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
6
|
+
throw 'Fanfou RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const uid = ctx.params.uid;
|
|
@@ -21,7 +21,7 @@ async function login(ig) {
|
|
|
21
21
|
logger.error('Instagram login fail: ' + error);
|
|
22
22
|
}
|
|
23
23
|
} else {
|
|
24
|
-
throw Error('Instagram
|
|
24
|
+
throw Error('Instagram RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>');
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -3,7 +3,7 @@ const config = require('@/config').value;
|
|
|
3
3
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
if (!config.lastfm || !config.lastfm.api_key) {
|
|
6
|
-
throw 'Last.fm RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
6
|
+
throw 'Last.fm RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const user = ctx.params.user;
|
|
@@ -3,7 +3,7 @@ const config = require('@/config').value;
|
|
|
3
3
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
if (!config.lastfm || !config.lastfm.api_key) {
|
|
6
|
-
throw 'Last.fm RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
6
|
+
throw 'Last.fm RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const user = ctx.params.user;
|
package/lib/routes/lastfm/top.js
CHANGED
|
@@ -3,7 +3,7 @@ const config = require('@/config').value;
|
|
|
3
3
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
if (!config.lastfm || !config.lastfm.api_key) {
|
|
6
|
-
throw 'Last.fm RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
6
|
+
throw 'Last.fm RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const country = ctx.params.country;
|
|
@@ -77,7 +77,7 @@ exports.getDetails = (cache, simples) => Promise.all(simples.slice(0, MAX_DETAIL
|
|
|
77
77
|
const MAX_TORRENT = 5;
|
|
78
78
|
exports.getTorrents = async (cache, simples) => {
|
|
79
79
|
if (!config.nhentai || !config.nhentai.username || !config.nhentai.password) {
|
|
80
|
-
throw 'nhentai RSS with torrents is disabled due to the lack of <a href="https://docs.rsshub.app/install/#bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
80
|
+
throw 'nhentai RSS with torrents is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
81
81
|
}
|
|
82
82
|
const cookie = await getCookie(config.nhentai.username, config.nhentai.password, cache);
|
|
83
83
|
if (!cookie) {
|
|
@@ -6,7 +6,7 @@ const pixivUtils = require('./utils');
|
|
|
6
6
|
|
|
7
7
|
module.exports = async (ctx) => {
|
|
8
8
|
if (!config.pixiv || !config.pixiv.refreshToken) {
|
|
9
|
-
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install
|
|
9
|
+
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const id = ctx.params.id;
|
|
@@ -5,7 +5,7 @@ const pixivUtils = require('./utils');
|
|
|
5
5
|
|
|
6
6
|
module.exports = async (ctx) => {
|
|
7
7
|
if (!config.pixiv || !config.pixiv.refreshToken) {
|
|
8
|
-
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install
|
|
8
|
+
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const token = await getToken();
|
|
@@ -50,7 +50,7 @@ const alias = {
|
|
|
50
50
|
|
|
51
51
|
module.exports = async (ctx) => {
|
|
52
52
|
if (!config.pixiv || !config.pixiv.refreshToken) {
|
|
53
|
-
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install
|
|
53
|
+
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const mode = alias[ctx.params.mode] ? alias[ctx.params.mode] : ctx.params.mode;
|
|
@@ -6,7 +6,7 @@ const pixivUtils = require('./utils');
|
|
|
6
6
|
|
|
7
7
|
module.exports = async (ctx) => {
|
|
8
8
|
if (!config.pixiv || !config.pixiv.refreshToken) {
|
|
9
|
-
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install
|
|
9
|
+
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const keyword = ctx.params.keyword;
|
package/lib/routes/pixiv/user.js
CHANGED
|
@@ -5,7 +5,7 @@ const pixivUtils = require('./utils');
|
|
|
5
5
|
|
|
6
6
|
module.exports = async (ctx) => {
|
|
7
7
|
if (!config.pixiv || !config.pixiv.refreshToken) {
|
|
8
|
-
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install
|
|
8
|
+
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const id = ctx.params.id;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Make sure you read lib/utils/wechat-mp.js before adding a new route.
|
|
@@ -1,33 +1,62 @@
|
|
|
1
1
|
const parser = require('@/utils/rss-parser');
|
|
2
2
|
const got = require('@/utils/got');
|
|
3
3
|
const cheerio = require('cheerio');
|
|
4
|
+
const { fixArticleContent } = require('@/utils/wechat-mp');
|
|
5
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
6
|
+
|
|
7
|
+
// any UA containing "RSS" can pass the check
|
|
8
|
+
// mark the UA as a desktop UA with "(X11; Linux x86_64)"
|
|
9
|
+
const UA = 'Mozilla/5.0 (X11; Linux x86_64) RSS Reader';
|
|
4
10
|
|
|
5
11
|
module.exports = async (ctx) => {
|
|
6
12
|
const { id } = ctx.params;
|
|
7
13
|
|
|
8
|
-
const feed = await parser.
|
|
14
|
+
const feed = await parser.parseString(
|
|
15
|
+
await got
|
|
16
|
+
.get(`https://posts.careerengine.us/author/${id}/rss`, {
|
|
17
|
+
headers: {
|
|
18
|
+
'User-Agent': UA,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
.then((_) => _.data)
|
|
22
|
+
);
|
|
9
23
|
|
|
10
24
|
const items = await Promise.all(
|
|
11
25
|
feed.items.splice(0, 10).map(async (item) => {
|
|
12
|
-
|
|
26
|
+
// generally speaking, changing `item.link` of an existing route could potentially break `item.guid`
|
|
27
|
+
// but since the route has been down for at least 8 months, it's probably safe
|
|
28
|
+
item.link = item.link.replace(/^http:\/\//, 'https://');
|
|
29
|
+
return await ctx.cache.tryGet(item.link, async () => {
|
|
30
|
+
const response = await got.get(item.link, {
|
|
31
|
+
headers: {
|
|
32
|
+
'User-Agent': UA,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const $ = cheerio.load(response.data);
|
|
13
37
|
|
|
14
|
-
|
|
15
|
-
const post = $('.post');
|
|
38
|
+
const description = fixArticleContent($('.post'));
|
|
16
39
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
$(
|
|
40
|
+
let pubDate = item.pubDate;
|
|
41
|
+
if (!pubDate || pubDate === 'Invalid Date') {
|
|
42
|
+
// sometimes the pubDate is not available in the official feed
|
|
43
|
+
const postDate = $('.post-date')
|
|
44
|
+
.text()
|
|
45
|
+
.replace(/\s+|发表/g, '');
|
|
46
|
+
// the date format is "发表 YYYY年MM月DD日 "
|
|
47
|
+
// following the official feed behavior: imprecise date is in UTC
|
|
48
|
+
// `<pubDate>Mon, 04 Apr 2022 00:00:00 GMT</pubDate>`
|
|
49
|
+
pubDate = parseDate(postDate, 'YYYY年MM月DD日');
|
|
50
|
+
pubDate = new Date(pubDate.getTime() - pubDate.getTimezoneOffset() * 60 * 1000);
|
|
21
51
|
}
|
|
22
|
-
});
|
|
23
52
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
53
|
+
return {
|
|
54
|
+
title: item.title,
|
|
55
|
+
description,
|
|
56
|
+
pubDate,
|
|
57
|
+
link: item.link,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
31
60
|
})
|
|
32
61
|
);
|
|
33
62
|
|