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.
Files changed (289) hide show
  1. package/README.md +5 -4
  2. package/lib/config.js +6 -1
  3. package/lib/middleware/cache/index.js +3 -3
  4. package/lib/middleware/cache/memory.js +5 -11
  5. package/lib/middleware/template.js +8 -2
  6. package/lib/router.js +44 -43
  7. package/lib/routes/amd/graphicsdrivers.js +1 -1
  8. package/lib/routes/disqus/posts.js +1 -1
  9. package/lib/routes/fanfou/favorites.js +1 -1
  10. package/lib/routes/fanfou/home_timeline.js +1 -1
  11. package/lib/routes/fanfou/public_timeline.js +1 -1
  12. package/lib/routes/fanfou/user_timeline.js +1 -1
  13. package/lib/routes/instagram/utils.js +1 -1
  14. package/lib/routes/lastfm/loved.js +1 -1
  15. package/lib/routes/lastfm/recent.js +1 -1
  16. package/lib/routes/lastfm/top.js +1 -1
  17. package/lib/routes/nhentai/util.js +1 -1
  18. package/lib/routes/pixiv/bookmarks.js +1 -1
  19. package/lib/routes/pixiv/illustfollow.js +1 -1
  20. package/lib/routes/pixiv/ranking.js +1 -1
  21. package/lib/routes/pixiv/search.js +1 -1
  22. package/lib/routes/pixiv/user.js +1 -1
  23. package/lib/routes/tencent/wechat/_README +1 -0
  24. package/lib/routes/tencent/wechat/ce.js +45 -16
  25. package/lib/routes/tencent/wechat/ershcimi.js +11 -19
  26. package/lib/routes/tencent/wechat/feeds.js +8 -32
  27. package/lib/routes/tencent/wechat/mp.js +8 -26
  28. package/lib/routes/tencent/wechat/msgalbum.js +7 -25
  29. package/lib/routes/tencent/wechat/tgchannel.js +6 -26
  30. package/lib/routes/twitter/keyword.js +9 -4
  31. package/lib/routes/twitter/likes.js +1 -1
  32. package/lib/routes/twitter/list.js +1 -1
  33. package/lib/routes/twitter/trends.js +1 -1
  34. package/lib/routes/twitter/user.js +9 -4
  35. package/lib/routes/twitter/web-api/media.js +5 -2
  36. package/lib/routes/twitter/web-api/twitter-api.js +105 -20
  37. package/lib/routes/twitter/web-api/twitter-got.js +4 -0
  38. package/lib/routes/twitter/web-api/user.js +5 -4
  39. package/lib/routes/weibo/keyword.js +18 -10
  40. package/lib/routes/weibo/super_index.js +24 -15
  41. package/lib/routes/weibo/timeline.js +38 -19
  42. package/lib/routes/weibo/user.js +47 -21
  43. package/lib/routes/weibo/utils.js +81 -12
  44. package/lib/routes/youtube/channel.js +1 -1
  45. package/lib/routes/youtube/playlist.js +1 -1
  46. package/lib/routes/youtube/user.js +1 -1
  47. package/lib/utils/common-config.js +4 -0
  48. package/lib/utils/common-utils.js +14 -0
  49. package/lib/utils/parse-date.js +172 -17
  50. package/lib/utils/rand-user-agent.js +29 -0
  51. package/lib/utils/torrent.js +9 -1
  52. package/lib/utils/wechat-mp.js +209 -0
  53. package/lib/v2/asus/bios.js +38 -0
  54. package/lib/v2/asus/maintainer.js +3 -0
  55. package/lib/v2/asus/radar.js +13 -0
  56. package/lib/v2/asus/router.js +3 -0
  57. package/lib/v2/asus/templates/bios.art +6 -0
  58. package/lib/v2/bilibili/liveArea.js +2 -12
  59. package/lib/v2/bookfere/category.js +36 -0
  60. package/lib/v2/bookfere/maintainer.js +3 -0
  61. package/lib/v2/bookfere/radar.js +11 -0
  62. package/lib/v2/bookfere/router.js +3 -0
  63. package/lib/v2/brooklynmuseum/exhibitions.js +27 -0
  64. package/lib/v2/brooklynmuseum/maintainer.js +3 -0
  65. package/lib/v2/brooklynmuseum/radar.js +11 -0
  66. package/lib/v2/brooklynmuseum/router.js +3 -0
  67. package/lib/v2/douban/people/status.js +10 -2
  68. package/lib/v2/douban/people/wish.js +55 -43
  69. package/lib/v2/dut/defaults.js +53 -0
  70. package/lib/v2/dut/index.js +78 -0
  71. package/lib/v2/dut/maintainer.js +14 -0
  72. package/lib/v2/dut/radar.js +109 -0
  73. package/lib/v2/dut/router.js +4 -0
  74. package/lib/v2/dut/shortcuts.js +77 -0
  75. package/lib/v2/fortunechina/index.js +3 -3
  76. package/lib/{routes → v2}/gamer/gnn_index.js +6 -7
  77. package/lib/v2/gamer/maintainer.js +1 -0
  78. package/lib/v2/gamer/radar.js +16 -0
  79. package/lib/v2/gamer/router.js +1 -0
  80. package/lib/v2/gaze/maintainer.js +3 -0
  81. package/lib/v2/gaze/radar.js +13 -0
  82. package/lib/v2/gaze/router.js +3 -0
  83. package/lib/v2/gaze/templates/update.art +4 -0
  84. package/lib/v2/gaze/update.js +27 -0
  85. package/lib/v2/github/issue.js +6 -2
  86. package/lib/v2/github/pulls.js +1 -1
  87. package/lib/v2/gov/anhui/kjt.js +56 -0
  88. package/lib/v2/gov/maintainer.js +2 -1
  89. package/lib/v2/gov/radar.js +90 -76
  90. package/lib/v2/gov/router.js +2 -1
  91. package/lib/v2/gov/sichuan/deyang/govpulicinfo.js +54 -74
  92. package/lib/v2/gov/sichuan/deyang/templates/govPublicInfo.art +1 -0
  93. package/lib/v2/guangdiu/cheaps.js +28 -0
  94. package/lib/v2/guangdiu/index.js +44 -0
  95. package/lib/v2/guangdiu/maintainer.js +5 -0
  96. package/lib/v2/guangdiu/radar.js +25 -0
  97. package/lib/v2/guangdiu/rank.js +38 -0
  98. package/lib/v2/guangdiu/router.js +5 -0
  99. package/lib/v2/guggenheim/exhibitions.js +29 -0
  100. package/lib/v2/guggenheim/maintainer.js +3 -0
  101. package/lib/v2/guggenheim/radar.js +11 -0
  102. package/lib/v2/guggenheim/router.js +3 -0
  103. package/lib/v2/gzh360/_README +1 -0
  104. package/lib/v2/gzh360/category.js +8 -0
  105. package/lib/v2/gzh360/gzh.js +18 -0
  106. package/lib/v2/gzh360/maintainer.js +4 -0
  107. package/lib/v2/gzh360/radar.js +19 -0
  108. package/lib/v2/gzh360/router.js +4 -0
  109. package/lib/v2/gzh360/universal.js +53 -0
  110. package/lib/v2/gzh360/utils.js +62 -0
  111. package/lib/v2/hameln/chapter.js +59 -0
  112. package/lib/v2/hameln/maintainer.js +3 -0
  113. package/lib/v2/hameln/radar.js +13 -0
  114. package/lib/v2/hameln/router.js +1 -0
  115. package/lib/v2/hnrb/index.js +85 -0
  116. package/lib/v2/hnrb/maintainer.js +3 -0
  117. package/lib/v2/hnrb/radar.js +13 -0
  118. package/lib/v2/hnrb/router.js +3 -0
  119. package/lib/v2/hupu/all.js +73 -0
  120. package/lib/v2/hupu/bbs.js +64 -0
  121. package/lib/v2/hupu/index.js +72 -0
  122. package/lib/v2/hupu/maintainer.js +7 -0
  123. package/lib/v2/hupu/radar.js +35 -0
  124. package/lib/v2/hupu/router.js +7 -0
  125. package/lib/v2/hupu/templates/description.art +6 -0
  126. package/lib/v2/hyqss/index.js +89 -0
  127. package/lib/v2/hyqss/maintainer.js +4 -0
  128. package/lib/v2/hyqss/radar.js +22 -0
  129. package/lib/v2/hyqss/router.js +3 -0
  130. package/lib/{routes → v2}/ifeng/feng.js +7 -5
  131. package/lib/v2/ifeng/maintainer.js +3 -0
  132. package/lib/v2/ifeng/radar.js +11 -0
  133. package/lib/v2/ifeng/router.js +3 -0
  134. package/lib/{routes → v2}/ifeng/utils.js +0 -0
  135. package/lib/v2/jewishmuseum/exhibitions.js +16 -0
  136. package/lib/v2/jewishmuseum/maintainer.js +3 -0
  137. package/lib/v2/jewishmuseum/radar.js +11 -0
  138. package/lib/v2/jewishmuseum/router.js +3 -0
  139. package/lib/v2/kakuyomu/episode.js +54 -0
  140. package/lib/v2/kakuyomu/maintainer.js +3 -0
  141. package/lib/v2/kakuyomu/radar.js +13 -0
  142. package/lib/v2/kakuyomu/router.js +1 -0
  143. package/lib/v2/kyodonews/index.js +123 -0
  144. package/lib/v2/kyodonews/maintainer.js +3 -0
  145. package/lib/v2/kyodonews/radar.js +33 -0
  146. package/lib/v2/kyodonews/router.js +3 -0
  147. package/lib/v2/kyodonews/templates/article.art +4 -0
  148. package/lib/v2/mcachicago/exhibitions.js +17 -0
  149. package/lib/v2/mcachicago/maintainer.js +3 -0
  150. package/lib/v2/mcachicago/radar.js +11 -0
  151. package/lib/v2/mcachicago/router.js +3 -0
  152. package/lib/v2/metmuseum/exhibitions.js +31 -0
  153. package/lib/v2/metmuseum/maintainer.js +3 -0
  154. package/lib/v2/metmuseum/radar.js +11 -0
  155. package/lib/v2/metmuseum/router.js +3 -0
  156. package/lib/v2/mihoyo/bbs.js +62 -0
  157. package/lib/v2/mihoyo/maintainer.js +3 -0
  158. package/lib/v2/mihoyo/radar.js +31 -0
  159. package/lib/v2/mihoyo/router.js +3 -0
  160. package/lib/v2/mihoyo/templates/description.art +6 -0
  161. package/lib/v2/miris/blog.js +19 -0
  162. package/lib/v2/miris/maintainer.js +3 -0
  163. package/lib/v2/miris/radar.js +11 -0
  164. package/lib/v2/miris/router.js +3 -0
  165. package/lib/{routes → v2}/mpaypass/main.js +23 -27
  166. package/lib/v2/mpaypass/maintainer.js +4 -0
  167. package/lib/v2/mpaypass/news.js +39 -0
  168. package/lib/v2/mpaypass/radar.js +19 -0
  169. package/lib/v2/mpaypass/router.js +4 -0
  170. package/lib/v2/mtime/maintainer.js +3 -0
  171. package/lib/v2/mtime/news.js +48 -0
  172. package/lib/v2/mtime/radar.js +13 -0
  173. package/lib/v2/mtime/router.js +3 -0
  174. package/lib/v2/natgeo/dailyphoto.js +32 -0
  175. package/lib/v2/natgeo/dailyselection.js +41 -0
  176. package/lib/v2/natgeo/maintainer.js +5 -0
  177. package/lib/{routes → v2}/natgeo/natgeo.js +18 -32
  178. package/lib/v2/natgeo/radar.js +24 -0
  179. package/lib/v2/natgeo/router.js +5 -0
  180. package/lib/v2/natgeo/templates/dailyPhoto.art +5 -0
  181. package/lib/v2/newmuseum/exhibitions.js +27 -0
  182. package/lib/v2/newmuseum/maintainer.js +3 -0
  183. package/lib/v2/newmuseum/radar.js +11 -0
  184. package/lib/v2/newmuseum/router.js +3 -0
  185. package/lib/v2/npm/maintainer.js +3 -0
  186. package/lib/v2/npm/package.js +45 -0
  187. package/lib/v2/npm/radar.js +13 -0
  188. package/lib/v2/npm/router.js +3 -0
  189. package/lib/v2/npm/templates/package.art +10 -0
  190. package/lib/v2/nuaa/cs/index.js +87 -0
  191. package/lib/v2/nuaa/jwc/jwc.js +82 -0
  192. package/lib/v2/nuaa/maintainer.js +5 -0
  193. package/lib/v2/nuaa/radar.js +23 -0
  194. package/lib/v2/nuaa/router.js +5 -0
  195. package/lib/{routes/universities → v2}/nuaa/utils/pypasswaf.js +1 -1
  196. package/lib/{routes/universities → v2}/nuaa/yjsy/yjsy.js +16 -22
  197. package/lib/v2/picuki/profile.js +12 -3
  198. package/lib/v2/pubmed/maintainer.js +3 -0
  199. package/lib/v2/pubmed/radar.js +13 -0
  200. package/lib/v2/pubmed/router.js +3 -0
  201. package/lib/v2/pubmed/templates/description.art +7 -0
  202. package/lib/v2/pubmed/trending.js +58 -0
  203. package/lib/v2/qbittorrent/maintainer.js +3 -0
  204. package/lib/v2/qbittorrent/news.js +53 -0
  205. package/lib/v2/qbittorrent/radar.js +13 -0
  206. package/lib/v2/qbittorrent/router.js +3 -0
  207. package/lib/v2/quicker/maintainer.js +7 -0
  208. package/lib/v2/quicker/qa.js +65 -0
  209. package/lib/v2/quicker/radar.js +31 -0
  210. package/lib/v2/quicker/router.js +7 -0
  211. package/lib/v2/quicker/share.js +61 -0
  212. package/lib/v2/quicker/user.js +62 -0
  213. package/lib/v2/quicker/versions.js +36 -0
  214. package/lib/v2/qweather/3days.js +46 -0
  215. package/lib/v2/qweather/maintainer.js +4 -0
  216. package/lib/v2/qweather/now.js +46 -0
  217. package/lib/v2/qweather/router.js +4 -0
  218. package/lib/v2/qweather/util/3days.art +20 -0
  219. package/lib/v2/qweather/util/now.art +16 -0
  220. package/lib/v2/rsshub/sponsors.js +1 -0
  221. package/lib/{routes → v2}/sciencenet/blog.js +17 -12
  222. package/lib/v2/sciencenet/maintainer.js +4 -0
  223. package/lib/v2/sciencenet/radar.js +19 -0
  224. package/lib/v2/sciencenet/router.js +4 -0
  225. package/lib/v2/sciencenet/user.js +65 -0
  226. package/lib/v2/stratechery/index.js +20 -0
  227. package/lib/v2/stratechery/maintainer.js +3 -0
  228. package/lib/v2/stratechery/radar.js +11 -0
  229. package/lib/v2/stratechery/router.js +3 -0
  230. package/lib/v2/telegram/channel.js +10 -6
  231. package/lib/v2/telegram/stickerpack.js +1 -1
  232. package/lib/v2/test/index.js +1 -1
  233. package/lib/{routes → v2}/thepaper/839studio/category.js +0 -0
  234. package/lib/{routes → v2}/thepaper/839studio/studio.js +0 -0
  235. package/lib/{routes → v2}/thepaper/channel.js +0 -0
  236. package/lib/v2/thepaper/factpaper.js +61 -0
  237. package/lib/{routes → v2}/thepaper/featured.js +0 -0
  238. package/lib/{routes → v2}/thepaper/list.js +0 -0
  239. package/lib/v2/thepaper/maintainer.js +8 -0
  240. package/lib/v2/thepaper/radar.js +42 -0
  241. package/lib/v2/thepaper/router.js +8 -0
  242. package/lib/v2/thepaper/templates/factpaper.art +12 -0
  243. package/lib/v2/thepaper/utils.js +55 -0
  244. package/lib/{routes → v2}/twreporter/category.js +7 -12
  245. package/lib/{routes → v2}/twreporter/fetch_article.js +5 -4
  246. package/lib/v2/twreporter/maintainer.js +5 -0
  247. package/lib/{routes → v2}/twreporter/newest.js +8 -13
  248. package/lib/v2/twreporter/photography.js +46 -0
  249. package/lib/v2/twreporter/radar.js +25 -0
  250. package/lib/v2/twreporter/router.js +5 -0
  251. package/lib/v2/wechat/_README +1 -0
  252. package/lib/v2/wechat/feeddd.js +3 -46
  253. package/lib/{routes → v2}/xueqiu/favorite.js +2 -1
  254. package/lib/v2/xueqiu/fund.js +50 -0
  255. package/lib/{routes → v2}/xueqiu/hots.js +2 -1
  256. package/lib/v2/xueqiu/maintainer.js +10 -0
  257. package/lib/v2/xueqiu/radar.js +60 -0
  258. package/lib/v2/xueqiu/router.js +10 -0
  259. package/lib/{routes → v2}/xueqiu/snb.js +2 -1
  260. package/lib/{routes → v2}/xueqiu/stock_comments.js +4 -20
  261. package/lib/{routes → v2}/xueqiu/stock_info.js +2 -1
  262. package/lib/v2/xueqiu/templates/comments_description.art +10 -0
  263. package/lib/{routes → v2}/xueqiu/user.js +2 -1
  264. package/lib/{routes → v2}/xueqiu/user_stock.js +3 -2
  265. package/lib/v2/zooTeam/blog.js +32 -0
  266. package/lib/v2/zooTeam/maintainer.js +4 -0
  267. package/lib/v2/zooTeam/radar.js +21 -0
  268. package/lib/v2/zooTeam/router.js +4 -0
  269. package/lib/v2/zooTeam/weekly.js +34 -0
  270. package/lib/views/atom.art +4 -2
  271. package/package.json +17 -14
  272. package/lib/routes/hupu/all.js +0 -53
  273. package/lib/routes/hupu/bbs.js +0 -83
  274. package/lib/routes/hupu/dept.js +0 -66
  275. package/lib/routes/mpaypass/news.js +0 -43
  276. package/lib/routes/natgeo/dailyphoto.js +0 -27
  277. package/lib/routes/pubmed/trending.js +0 -65
  278. package/lib/routes/quicker/person.js +0 -32
  279. package/lib/routes/quicker/qa.js +0 -41
  280. package/lib/routes/quicker/update.js +0 -30
  281. package/lib/routes/tencent/wechat/csm.js +0 -59
  282. package/lib/routes/tencent/wechat/wjdn.js +0 -28
  283. package/lib/routes/thepaper/utils.js +0 -48
  284. package/lib/routes/twreporter/photography.js +0 -57
  285. package/lib/routes/universities/dut/index.js +0 -60
  286. package/lib/routes/universities/dut/subsite.js +0 -50
  287. package/lib/routes/universities/nuaa/cs/index.js +0 -84
  288. package/lib/routes/universities/nuaa/jwc/jwc.js +0 -105
  289. 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
- [![telegram](https://img.shields.io/badge/chat-telegram-brightgreen.svg?style=flat-square)](https://t.me/rsshub)
9
- [![build status](https://img.shields.io/travis/DIYgod/RSSHub/master.svg?style=flat-square)](https://travis-ci.org/DIYgod/RSSHub)
10
- [![Test coverage](https://img.shields.io/codecov/c/github/DIYgod/RSSHub.svg?style=flat-square)](https://codecov.io/github/DIYgod/RSSHub?branch=master)
8
+ [![telegram](https://img.shields.io/badge/chat-telegram-brightgreen.svg?logo=telegram&style=flat-square)](https://t.me/rsshub)
9
+ [![npm publish](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/publish/master?label=npm%20publish&logo=npm&style=flat-square)](https://www.npmjs.com/package/rsshub)
10
+ [![docker publish](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/%5Bdocker%5D%20CI%20for%20releases/master?label=docker%20publish&logo=docker&style=flat-square)](https://hub.docker.com/r/diygod/rsshub)
11
+ [![test](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/test/master?label=test&logo=github&style=flat-square)](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://opencollective.com/static/images/become_sponsor.svg)](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 || 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
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 { pageCache } = cacheModule.clients;
30
+ const { memoryCache } = cacheModule.clients;
31
31
  globalCache.get = (key) => {
32
32
  if (key && cacheModule.status.available) {
33
- return pageCache.get(key);
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 pageCache.set(key, value, { ttl: maxAge * 1000 });
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 pageCache = new Lru({
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 = (refresh ? routeCache : pageCache).get(key);
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, refresh = true) => {
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 (refresh ? routeCache : pageCache).set(key, value, { ttl: maxAge * 1000 });
31
+ return memoryCache.set(key, value, { ttl: maxAge * 1000 });
38
32
  }
39
33
  },
40
- clients: { pageCache, routeCache },
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
- switch (ctx.state.type[1]) {
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/dailyphoto', lazyloadRouteHandler('./routes/natgeo/dailyphoto'));
306
- router.get('/natgeo/:cat/:type?', lazyloadRouteHandler('./routes/natgeo/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, false);
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/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
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 username and password are required to be set in the environment.');
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;
@@ -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/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
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/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
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/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
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/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
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;
@@ -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/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
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.parseURL(`https://posts.careerengine.us/author/${id}/rss`);
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
- const response = await got.get(item.link);
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
- const $ = cheerio.load(response.data);
15
- const post = $('.post');
38
+ const description = fixArticleContent($('.post'));
16
39
 
17
- post.find('img').each((_, img) => {
18
- const dataSrc = $(img).attr('data-src');
19
- if (dataSrc) {
20
- $(img).attr('src', dataSrc);
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
- const single = {
25
- title: item.title,
26
- description: post.html(),
27
- pubDate: item.pubDate,
28
- link: item.link,
29
- };
30
- return Promise.resolve(single);
53
+ return {
54
+ title: item.title,
55
+ description,
56
+ pubDate,
57
+ link: item.link,
58
+ };
59
+ });
31
60
  })
32
61
  );
33
62