rsshub 1.0.0-master.e1347b3 → 1.0.0-master.e1ee282

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 (138) hide show
  1. package/lib/config.js +4 -1
  2. package/lib/middleware/onerror.js +2 -1
  3. package/lib/middleware/parameter.js +11 -3
  4. package/lib/radar-rules.js +0 -37
  5. package/lib/router.js +25 -37
  6. package/lib/routes/index.js +1 -1
  7. package/lib/routes/weibo/user.js +28 -27
  8. package/lib/utils/wechat-mp.js +1 -0
  9. package/lib/v2/7mmtv/index.js +86 -0
  10. package/lib/v2/7mmtv/maintainer.js +4 -0
  11. package/lib/v2/7mmtv/radar.js +19 -0
  12. package/lib/v2/7mmtv/router.js +3 -0
  13. package/lib/v2/7mmtv/templates/description.art +11 -0
  14. package/lib/v2/behance/maintainer.js +3 -0
  15. package/lib/v2/behance/radar.js +26 -0
  16. package/lib/v2/behance/router.js +3 -0
  17. package/lib/v2/behance/user.js +67 -0
  18. package/lib/v2/caareviews/book.js +14 -0
  19. package/lib/v2/caareviews/essay.js +14 -0
  20. package/lib/v2/caareviews/exhibition.js +14 -0
  21. package/lib/v2/caareviews/maintainer.js +5 -0
  22. package/lib/v2/caareviews/radar.js +25 -0
  23. package/lib/v2/caareviews/router.js +5 -0
  24. package/lib/v2/caareviews/templates/utils.art +2 -0
  25. package/lib/v2/caareviews/utils.js +49 -0
  26. package/lib/v2/chinanews/index.js +4 -3
  27. package/lib/v2/cntheory/maintainer.js +3 -0
  28. package/lib/v2/cntheory/paper.js +93 -0
  29. package/lib/v2/cntheory/radar.js +13 -0
  30. package/lib/v2/cntheory/router.js +3 -0
  31. package/lib/v2/cntheory/templates/description.art +2 -0
  32. package/lib/v2/epicgames/index.js +45 -11
  33. package/lib/v2/fx-markets/channel.js +56 -0
  34. package/lib/v2/fx-markets/maintainer.js +3 -0
  35. package/lib/v2/fx-markets/radar.js +31 -0
  36. package/lib/v2/fx-markets/router.js +3 -0
  37. package/lib/v2/gumroad/index.js +35 -0
  38. package/lib/v2/gumroad/maintainer.js +3 -0
  39. package/lib/v2/gumroad/radar.js +17 -0
  40. package/lib/v2/gumroad/router.js +3 -0
  41. package/lib/v2/gumroad/templates/products.art +7 -0
  42. package/lib/{routes → v2}/huxiu/article.js +1 -1
  43. package/lib/{routes → v2}/huxiu/author.js +18 -6
  44. package/lib/{routes → v2}/huxiu/collection.js +1 -2
  45. package/lib/v2/huxiu/maintainer.js +7 -0
  46. package/lib/v2/huxiu/radar.js +35 -0
  47. package/lib/v2/huxiu/router.js +7 -0
  48. package/lib/{routes → v2}/huxiu/search.js +0 -0
  49. package/lib/{routes → v2}/huxiu/tag.js +0 -0
  50. package/lib/{routes → v2}/huxiu/utils.js +3 -4
  51. package/lib/v2/ielts/index.js +28 -27
  52. package/lib/v2/jike/utils.js +23 -1
  53. package/lib/v2/kcna/maintainer.js +3 -0
  54. package/lib/v2/kcna/news.js +81 -0
  55. package/lib/v2/kcna/radar.js +61 -0
  56. package/lib/v2/kcna/router.js +3 -0
  57. package/lib/v2/kcna/templates/news.art +9 -0
  58. package/lib/v2/kcna/utils.js +64 -0
  59. package/lib/v2/laohu8/maintainer.js +3 -0
  60. package/lib/v2/laohu8/personal.js +32 -0
  61. package/lib/v2/laohu8/radar.js +13 -0
  62. package/lib/v2/laohu8/router.js +3 -0
  63. package/lib/v2/lever/index.js +28 -0
  64. package/lib/v2/lever/maintainer.js +3 -0
  65. package/lib/v2/lever/radar.js +13 -0
  66. package/lib/v2/lever/router.js +3 -0
  67. package/lib/v2/mihoyo/bbs.js +1 -0
  68. package/lib/v2/mihoyo/radar.js +2 -2
  69. package/lib/v2/panewslab/{column.js → author.js} +11 -23
  70. package/lib/v2/panewslab/index.js +24 -17
  71. package/lib/v2/panewslab/maintainer.js +3 -1
  72. package/lib/v2/panewslab/news.js +28 -0
  73. package/lib/v2/panewslab/radar.js +2 -2
  74. package/lib/v2/panewslab/router.js +4 -2
  75. package/lib/v2/panewslab/topic.js +7 -14
  76. package/lib/v2/pku/maintainer.js +1 -0
  77. package/lib/v2/pku/nsd.js +69 -0
  78. package/lib/v2/pku/radar.js +8 -0
  79. package/lib/v2/pku/router.js +1 -0
  80. package/lib/v2/qipamaijia/index.js +26 -0
  81. package/lib/v2/qipamaijia/maintainer.js +3 -0
  82. package/lib/v2/qipamaijia/radar.js +13 -0
  83. package/lib/v2/qipamaijia/router.js +3 -0
  84. package/lib/v2/reuters/common.js +54 -0
  85. package/lib/v2/reuters/investigates.js +39 -0
  86. package/lib/v2/reuters/maintainer.js +6 -0
  87. package/lib/v2/reuters/migration_prompt.js +3 -0
  88. package/lib/v2/reuters/radar.js +19 -0
  89. package/lib/v2/reuters/router.js +6 -0
  90. package/lib/{routes → v2}/sobooks/date.js +1 -1
  91. package/lib/{routes → v2}/sobooks/index.js +1 -1
  92. package/lib/v2/sobooks/maintainer.js +5 -0
  93. package/lib/v2/sobooks/radar.js +25 -0
  94. package/lib/v2/sobooks/router.js +5 -0
  95. package/lib/{routes → v2}/sobooks/tag.js +1 -1
  96. package/lib/{routes → v2}/sobooks/utils.js +3 -2
  97. package/lib/v2/test/index.js +7 -1
  98. package/lib/v2/tingshuitz/dalian.js +29 -0
  99. package/lib/{routes → v2}/tingshuitz/dongguan.js +2 -1
  100. package/lib/{routes → v2}/tingshuitz/guangzhou.js +0 -0
  101. package/lib/{routes → v2}/tingshuitz/hangzhou.js +0 -0
  102. package/lib/v2/tingshuitz/maintainer.js +11 -0
  103. package/lib/{routes → v2}/tingshuitz/nanjing.js +9 -11
  104. package/lib/v2/tingshuitz/radar.js +68 -0
  105. package/lib/v2/tingshuitz/router.js +11 -0
  106. package/lib/v2/tingshuitz/wuhan.js +32 -0
  107. package/lib/{routes → v2}/tingshuitz/xian.js +1 -1
  108. package/lib/{routes → v2}/tingshuitz/xiaoshan.js +0 -0
  109. package/lib/{routes → v2}/tingshuitz/yangjiang.js +6 -8
  110. package/lib/v2/wallpaperhub/index.js +28 -0
  111. package/lib/v2/wallpaperhub/maintainer.js +3 -0
  112. package/lib/v2/wallpaperhub/radar.js +13 -0
  113. package/lib/v2/wallpaperhub/router.js +3 -0
  114. package/lib/v2/wallpaperhub/templates/description.art +1 -0
  115. package/lib/v2/xiaozhuanlan/column.js +52 -0
  116. package/lib/v2/xiaozhuanlan/maintainer.js +3 -0
  117. package/lib/v2/xiaozhuanlan/radar.js +13 -0
  118. package/lib/v2/xiaozhuanlan/router.js +3 -0
  119. package/lib/{routes → v2}/youtube/channel.js +9 -5
  120. package/lib/v2/youtube/maintainer.js +6 -0
  121. package/lib/{routes → v2}/youtube/playlist.js +6 -10
  122. package/lib/v2/youtube/radar.js +31 -0
  123. package/lib/v2/youtube/router.js +6 -0
  124. package/lib/v2/youtube/subscriptions.js +56 -0
  125. package/lib/v2/youtube/templates/description.art +7 -0
  126. package/lib/{routes → v2}/youtube/user.js +4 -5
  127. package/lib/v2/youtube/utils.js +141 -0
  128. package/package.json +7 -7
  129. package/lib/routes/behance/index.js +0 -58
  130. package/lib/routes/reuters/channel.js +0 -155
  131. package/lib/routes/reuters/theWire.js +0 -45
  132. package/lib/routes/reuters/utils.js +0 -72
  133. package/lib/routes/tingshuitz/dalian.js +0 -34
  134. package/lib/routes/tingshuitz/wuhan.js +0 -34
  135. package/lib/routes/waijiedanao/article.js +0 -78
  136. package/lib/routes/wallpaperhub/index.js +0 -22
  137. package/lib/routes/youtube/utils.js +0 -90
  138. package/lib/v2/panewslab/newsflash.js +0 -35
package/lib/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  require('dotenv').config();
2
- const randUserAgent = require('@/utils/rand-user-agent');
2
+ const randUserAgent = require('./utils/rand-user-agent');
3
3
  let envs = process.env;
4
4
  let value;
5
5
  const calculateValue = () => {
@@ -251,6 +251,9 @@ const calculateValue = () => {
251
251
  },
252
252
  youtube: {
253
253
  key: envs.YOUTUBE_KEY,
254
+ clientId: envs.YOUTUBE_CLIENT_ID,
255
+ clientSecret: envs.YOUTUBE_CLIENT_SECRET,
256
+ refreshToken: envs.YOUTUBE_REFRESH_TOKEN,
254
257
  },
255
258
  yuque: {
256
259
  token: envs.YUQUE_TOKEN,
@@ -23,7 +23,7 @@ if (config.sentry.dsn) {
23
23
  try {
24
24
  gitHash = require('git-rev-sync').short();
25
25
  } catch (e) {
26
- gitHash = (process.env.HEROKU_SLUG_COMMIT && process.env.HEROKU_SLUG_COMMIT.slice(0, 7)) || (process.env.VERCEL_GITHUB_COMMIT_SHA && process.env.VERCEL_GITHUB_COMMIT_SHA.slice(0, 7)) || 'unknown';
26
+ gitHash = (process.env.HEROKU_SLUG_COMMIT && process.env.HEROKU_SLUG_COMMIT.slice(0, 7)) || (process.env.VERCEL_GIT_COMMIT_SHA && process.env.VERCEL_GIT_COMMIT_SHA.slice(0, 7)) || 'unknown';
27
27
  }
28
28
 
29
29
  module.exports = async (ctx, next) => {
@@ -62,6 +62,7 @@ module.exports = async (ctx, next) => {
62
62
  if (err instanceof RequestInProgressError) {
63
63
  ctx.status = 503;
64
64
  message = err.message;
65
+ ctx.set('Cache-Control', `public, max-age=${config.cache.requestTimeout}`);
65
66
  } else if (ctx.status === 403) {
66
67
  message = err.message;
67
68
  } else {
@@ -10,9 +10,17 @@ module.exports = async (ctx, next) => {
10
10
  await next();
11
11
 
12
12
  if (!ctx.state.data && !ctx._matchedRoute) {
13
- ctx.set({
14
- 'Cache-Control': `public, max-age=${config.cache.routeExpire * 100}`,
15
- });
13
+ // Given that the official demo has a cache TTL of 2h, a "wrong path" page will be cached by CloudFlare for
14
+ // 200h (8.33d).
15
+ // What makes it worse is that the documentation contains status badges to detect the availability of routes,
16
+ // but the documentation is updated more timely than the official demo, so the every example path of every
17
+ // new route will probably have a "wrong path" page cached for at least 200h soon after accepted. That is to
18
+ // say, the example paths of a new route will probably be unavailable on the public demo in the first 200h
19
+ // after accepted.
20
+ // As a conclusion, the next 3 lines has been commented out. (exactly the same behavior as any internal error)
21
+ // ctx.set({
22
+ // 'Cache-Control': `public, max-age=${config.cache.routeExpire * 100}`,
23
+ // });
16
24
  throw Error('wrong path');
17
25
  }
18
26
 
@@ -131,29 +131,6 @@ module.exports = {
131
131
  },
132
132
  ],
133
133
  },
134
- 'youtube.com': {
135
- _name: 'YouTube',
136
- www: [
137
- {
138
- title: '用户',
139
- docs: 'https://docs.rsshub.app/social-media.html#youtube',
140
- source: '/user/:username',
141
- target: '/youtube/user/:username',
142
- },
143
- {
144
- title: '频道',
145
- docs: 'https://docs.rsshub.app/social-media.html#youtube',
146
- source: '/channel/:id',
147
- target: '/youtube/channel/:id',
148
- },
149
- {
150
- title: '播放列表',
151
- docs: 'https://docs.rsshub.app/social-media.html#youtube',
152
- source: '/playlist',
153
- target: (params, url) => `/youtube/playlist/${new URL(url).searchParams.get('list')}`,
154
- },
155
- ],
156
- },
157
134
  'smzdm.com': {
158
135
  _name: '什么值得买',
159
136
  www: [
@@ -1696,20 +1673,6 @@ module.exports = {
1696
1673
  },
1697
1674
  ],
1698
1675
  },
1699
- 'behance.net': {
1700
- _name: 'Behance',
1701
- www: [
1702
- {
1703
- title: 'User',
1704
- docs: 'https://docs.rsshub.app/design.html#behance-user-works',
1705
- source: ['/:user'],
1706
- target: (params, url, document) => {
1707
- const uid1 = document && document.querySelector('html').innerHTML.match(/([^/]+)\/insights/)[1];
1708
- return `/behance/${uid1}`;
1709
- },
1710
- },
1711
- ],
1712
- },
1713
1676
  'jjmhw.cc': {
1714
1677
  _name: '漫小肆',
1715
1678
  www: [
package/lib/router.js CHANGED
@@ -160,10 +160,10 @@ router.get('/twitter/keyword/:keyword/:routeParams?/:limit?', lazyloadRouteHandl
160
160
  router.get('/twitter/trends/:woeid?', lazyloadRouteHandler('./routes/twitter/trends'));
161
161
  router.get('/twitter/media/:id/:routeParams?', lazyloadRouteHandler('./routes/twitter/media'));
162
162
 
163
- // YouTube
164
- router.get('/youtube/user/:username/:embed?', lazyloadRouteHandler('./routes/youtube/user'));
165
- router.get('/youtube/channel/:id/:embed?', lazyloadRouteHandler('./routes/youtube/channel'));
166
- router.get('/youtube/playlist/:id/:embed?', lazyloadRouteHandler('./routes/youtube/playlist'));
163
+ // YouTube migrated to v2
164
+ // router.get('/youtube/user/:username/:embed?', lazyloadRouteHandler('./routes/youtube/user'));
165
+ // router.get('/youtube/channel/:id/:embed?', lazyloadRouteHandler('./routes/youtube/channel'));
166
+ // router.get('/youtube/playlist/:id/:embed?', lazyloadRouteHandler('./routes/youtube/playlist'));
167
167
 
168
168
  // 极客时间
169
169
  router.get('/geektime/column/:cid', lazyloadRouteHandler('./routes/geektime/column'));
@@ -264,16 +264,16 @@ router.get('/smzdm/baoliao/:uid', lazyloadRouteHandler('./routes/smzdm/baoliao')
264
264
  router.get('/bjnews/:cat', lazyloadRouteHandler('./routes/bjnews/news'));
265
265
  router.get('/bjnews/epaper/:cat', lazyloadRouteHandler('./routes/bjnews/epaper'));
266
266
 
267
- // 停水通知
268
- router.get('/tingshuitz/hangzhou', lazyloadRouteHandler('./routes/tingshuitz/hangzhou'));
269
- router.get('/tingshuitz/xiaoshan', lazyloadRouteHandler('./routes/tingshuitz/xiaoshan'));
270
- router.get('/tingshuitz/dalian', lazyloadRouteHandler('./routes/tingshuitz/dalian'));
271
- router.get('/tingshuitz/guangzhou', lazyloadRouteHandler('./routes/tingshuitz/guangzhou'));
272
- router.get('/tingshuitz/dongguan', lazyloadRouteHandler('./routes/tingshuitz/dongguan'));
273
- router.get('/tingshuitz/xian', lazyloadRouteHandler('./routes/tingshuitz/xian'));
274
- router.get('/tingshuitz/yangjiang', lazyloadRouteHandler('./routes/tingshuitz/yangjiang'));
275
- router.get('/tingshuitz/nanjing', lazyloadRouteHandler('./routes/tingshuitz/nanjing'));
276
- router.get('/tingshuitz/wuhan', lazyloadRouteHandler('./routes/tingshuitz/wuhan'));
267
+ // 停水通知 migrated to v2
268
+ // router.get('/tingshuitz/hangzhou', lazyloadRouteHandler('./routes/tingshuitz/hangzhou'));
269
+ // router.get('/tingshuitz/xiaoshan', lazyloadRouteHandler('./routes/tingshuitz/xiaoshan'));
270
+ // router.get('/tingshuitz/dalian', lazyloadRouteHandler('./routes/tingshuitz/dalian'));
271
+ // router.get('/tingshuitz/guangzhou', lazyloadRouteHandler('./routes/tingshuitz/guangzhou'));
272
+ // router.get('/tingshuitz/dongguan', lazyloadRouteHandler('./routes/tingshuitz/dongguan'));
273
+ // router.get('/tingshuitz/xian', lazyloadRouteHandler('./routes/tingshuitz/xian'));
274
+ // router.get('/tingshuitz/yangjiang', lazyloadRouteHandler('./routes/tingshuitz/yangjiang'));
275
+ // router.get('/tingshuitz/nanjing', lazyloadRouteHandler('./routes/tingshuitz/nanjing'));
276
+ // router.get('/tingshuitz/wuhan', lazyloadRouteHandler('./routes/tingshuitz/wuhan'));
277
277
 
278
278
  // 米哈游
279
279
  router.get('/mihoyo/bh3/:type', lazyloadRouteHandler('./routes/mihoyo/bh3'));
@@ -1111,12 +1111,12 @@ router.get('/zimuku/:type?', lazyloadRouteHandler('./routes/zimuku/index'));
1111
1111
  // SubHD.tv
1112
1112
  // router.get('/subhd/newest', lazyloadRouteHandler('./routes/subhd/newest'));
1113
1113
 
1114
- // 虎嗅
1115
- router.get('/huxiu/tag/:id', lazyloadRouteHandler('./routes/huxiu/tag'));
1116
- router.get('/huxiu/search/:keyword', lazyloadRouteHandler('./routes/huxiu/search'));
1117
- router.get('/huxiu/author/:id', lazyloadRouteHandler('./routes/huxiu/author'));
1118
- router.get('/huxiu/article', lazyloadRouteHandler('./routes/huxiu/article'));
1119
- router.get('/huxiu/collection/:id', lazyloadRouteHandler('./routes/huxiu/collection'));
1114
+ // 虎嗅 migrated to v2
1115
+ // router.get('/huxiu/tag/:id', lazyloadRouteHandler('./routes/huxiu/tag'));
1116
+ // router.get('/huxiu/search/:keyword', lazyloadRouteHandler('./routes/huxiu/search'));
1117
+ // router.get('/huxiu/author/:id', lazyloadRouteHandler('./routes/huxiu/author'));
1118
+ // router.get('/huxiu/article', lazyloadRouteHandler('./routes/huxiu/article'));
1119
+ // router.get('/huxiu/collection/:id', lazyloadRouteHandler('./routes/huxiu/collection'));
1120
1120
 
1121
1121
  // Steam
1122
1122
  router.get('/steam/search/:params', lazyloadRouteHandler('./routes/steam/search'));
@@ -2085,9 +2085,6 @@ router.get('/cug/gcxy/:type?', lazyloadRouteHandler('./routes/universities/cug/g
2085
2085
  // 海猫吧
2086
2086
  router.get('/haimaoba/:id?', lazyloadRouteHandler('./routes/haimaoba/comics'));
2087
2087
 
2088
- // 路透社
2089
- router.get('/reuters/channel/:site/:channel', lazyloadRouteHandler('./routes/reuters/channel'));
2090
-
2091
2088
  // 蒲公英
2092
2089
  router.get('/pgyer/:app?', lazyloadRouteHandler('./routes/pgyer/app'));
2093
2090
 
@@ -2899,9 +2896,6 @@ router.get('/lizhi/user/:id', lazyloadRouteHandler('./routes/lizhi/user'));
2899
2896
  // 富途牛牛
2900
2897
  router.get('/futunn/highlights', lazyloadRouteHandler('./routes/futunn/highlights'));
2901
2898
 
2902
- // 外接大脑
2903
- router.get('/waijiedanao/article/:caty', lazyloadRouteHandler('./routes/waijiedanao/article'));
2904
-
2905
2899
  // 即刻 migrated to v2
2906
2900
  // router.get('/jike/topic/:id', lazyloadRouteHandler('./routes/jike/topic'));
2907
2901
  // router.get('/jike/topic/text/:id', lazyloadRouteHandler('./routes/jike/topicText'));
@@ -2976,9 +2970,6 @@ router.get('/dsb/area/:area', lazyloadRouteHandler('./routes/dsb/area'));
2976
2970
  // 靠谱新闻
2977
2971
  router.get('/kaopunews/:language?', lazyloadRouteHandler('./routes/kaopunews'));
2978
2972
 
2979
- // Reuters
2980
- router.get('/reuters/theWire', lazyloadRouteHandler('./routes/reuters/theWire'));
2981
-
2982
2973
  // 格隆汇
2983
2974
  router.get('/gelonghui/user/:id', lazyloadRouteHandler('./routes/gelonghui/user'));
2984
2975
  router.get('/gelonghui/subject/:id', lazyloadRouteHandler('./routes/gelonghui/subject'));
@@ -3022,9 +3013,6 @@ router.get('/touhougarakuta/:language/:type', lazyloadRouteHandler('./routes/tou
3022
3013
  // 猎趣TV
3023
3014
  router.get('/liequtv/room/:id', lazyloadRouteHandler('./routes/liequtv/room'));
3024
3015
 
3025
- // Behance
3026
- router.get('/behance/:user/:type?', lazyloadRouteHandler('./routes/behance/index'));
3027
-
3028
3016
  // 北京物资学院
3029
3017
  router.get('/bwu/news', lazyloadRouteHandler('./routes/universities/bwu/news'));
3030
3018
 
@@ -3083,8 +3071,8 @@ router.get('/kotaku/story/:type', lazyloadRouteHandler('./routes/kotaku/story'))
3083
3071
  // 梅斯医学
3084
3072
  router.get('/medsci/recommend', lazyloadRouteHandler('./routes/medsci/recommend'));
3085
3073
 
3086
- // Wallpaperhub
3087
- router.get('/wallpaperhub', lazyloadRouteHandler('./routes/wallpaperhub/index'));
3074
+ // Wallpaperhub migrated to v2
3075
+ // router.get('/wallpaperhub', lazyloadRouteHandler('./routes/wallpaperhub/index'));
3088
3076
 
3089
3077
  // 悟空问答
3090
3078
  router.get('/wukong/user/:id/:type?', lazyloadRouteHandler('./routes/wukong/user'));
@@ -3474,9 +3462,9 @@ router.get('/matataki/tags/:tagId/:tagName/posts/:ipfsFlag?', lazyloadRouteHandl
3474
3462
  router.get('/matataki/users/:userId/favorites/:favoriteListId/posts/:ipfsFlag?', lazyloadRouteHandler('./routes/matataki/site/posts/favorite'));
3475
3463
 
3476
3464
  // SoBooks
3477
- router.get('/sobooks/tag/:id?', lazyloadRouteHandler('./routes/sobooks/tag'));
3478
- router.get('/sobooks/date/:date?', lazyloadRouteHandler('./routes/sobooks/date'));
3479
- router.get('/sobooks/:category?', lazyloadRouteHandler('./routes/sobooks/index'));
3465
+ // router.get('/sobooks/tag/:id?', lazyloadRouteHandler('./routes/sobooks/tag'));
3466
+ // router.get('/sobooks/date/:date?', lazyloadRouteHandler('./routes/sobooks/date'));
3467
+ // router.get('/sobooks/:category?', lazyloadRouteHandler('./routes/sobooks/index'));
3480
3468
 
3481
3469
  // Zhimap 知识导图社区
3482
3470
  router.get('/zhimap/:categoryUuid?/:recommend?', lazyloadRouteHandler('./routes/zhimap/index'));
@@ -7,7 +7,7 @@ let gitHash;
7
7
  try {
8
8
  gitHash = require('git-rev-sync').short();
9
9
  } catch (e) {
10
- gitHash = (process.env.HEROKU_SLUG_COMMIT && process.env.HEROKU_SLUG_COMMIT.slice(0, 7)) || (process.env.VERCEL_GITHUB_COMMIT_SHA && process.env.VERCEL_GITHUB_COMMIT_SHA.slice(0, 7)) || 'unknown';
10
+ gitHash = (process.env.HEROKU_SLUG_COMMIT && process.env.HEROKU_SLUG_COMMIT.slice(0, 7)) || (process.env.VERCEL_GIT_COMMIT_SHA && process.env.VERCEL_GIT_COMMIT_SHA.slice(0, 7)) || 'unknown';
11
11
  }
12
12
 
13
13
  module.exports = async (ctx) => {
@@ -1,4 +1,4 @@
1
- const querystring = require('querystring');
1
+ const querystring = require('query-string');
2
2
  const got = require('@/utils/got');
3
3
  const weiboUtils = require('./utils');
4
4
  const config = require('@/config').value;
@@ -62,22 +62,14 @@ module.exports = async (ctx) => {
62
62
  false
63
63
  );
64
64
 
65
- let earliestDate;
66
-
67
65
  const resultItem = await Promise.all(
68
66
  cards
69
- .reverse() // reverse first to ensure the pinned card will be processed lastly
67
+ .filter((item) => item.mblog)
70
68
  .map(async (item) => {
71
- if (!item.mblog && item.card_group && Array.isArray(item.card_group) && item.card_group.length > 0) {
72
- // w/o `mblog`, it may have a `card_group` containing only 1 card
73
- // only get the 1st card because we haven't observed that there can be multiple cards in it
74
- item = item.card_group[0];
75
- }
76
-
77
- if (!item.mblog) {
78
- return; // drop
79
- }
80
-
69
+ // TODO: unify cache key and let weiboUtils.getShowData() handle the cache? It seems safe to do so.
70
+ // Need more investigation, pending for now since the current version works fine.
71
+ // TODO: getShowData() on demand? The API seems to return most things we need since 2022/05/21.
72
+ // Need more investigation, pending for now since the current version works fine.
81
73
  const key = 'weibo:user:' + item.mblog.bid;
82
74
  const data = await ctx.cache.tryGet(key, () => weiboUtils.getShowData(uid, item.mblog.bid));
83
75
 
@@ -92,20 +84,10 @@ module.exports = async (ctx) => {
92
84
  item.mblog.created_at = timezone(item.mblog.created_at, +8);
93
85
  }
94
86
 
95
- // drop too old pinned weibo, otherwise preserve it
96
- if (!item.mblog.title || item.mblog.title.text !== '置顶') {
97
- if (!earliestDate || (item.mblog.created_at && earliestDate > item.mblog.created_at)) {
98
- earliestDate = item.mblog.created_at;
99
- }
100
- } else {
101
- if (earliestDate && item.mblog.created_at && earliestDate > item.mblog.created_at) {
102
- return;
103
- }
104
- }
105
-
106
87
  // 转发的长微博处理
107
88
  const retweet = item.mblog.retweeted_status;
108
89
  if (retweet && retweet.isLongText) {
90
+ // TODO: unify cache key and ...
109
91
  const retweetData = await ctx.cache.tryGet(`weibo:retweeted:${retweet.user.id}:${retweet.bid}`, () => weiboUtils.getShowData(retweet.user.id, retweet.bid));
110
92
  if (retweetData !== undefined && retweetData.text) {
111
93
  item.mblog.retweeted_status.text = retweetData.text;
@@ -153,11 +135,30 @@ module.exports = async (ctx) => {
153
135
  })
154
136
  );
155
137
 
138
+ // remove pinned weibo if it is too old (older than all rest weibo).
139
+ // if pinned weibo exists, it will always be the first item and the total item count will be 11 (otherwise 10).
140
+ // if < 11, either there is no pinned weibo or the user sent < 11 weibo in total, no need to remove anything.
141
+ // there is still another characteristic of a pinned weibo: card.profile_type_id.startsWith('proweibotop'),
142
+ // but it can be changed in the future, so here we do not rely on it.
143
+ if (
144
+ resultItem.length >= 11 &&
145
+ resultItem[0].pubDate &&
146
+ resultItem[0].pubDate <
147
+ Math.min(
148
+ ...resultItem
149
+ .slice(1)
150
+ .map((item) => item.pubDate)
151
+ .filter((item) => item)
152
+ )
153
+ ) {
154
+ resultItem.shift();
155
+ }
156
+
156
157
  ctx.state.data = {
157
158
  title: `${name}的微博`,
158
- link: `http://weibo.com/${uid}/`,
159
+ link: `https://weibo.com/${uid}/`,
159
160
  description,
160
161
  image: profileImageUrl,
161
- item: resultItem.filter((item) => item).reverse(),
162
+ item: resultItem,
162
163
  };
163
164
  };
@@ -4,6 +4,7 @@
4
4
  * There are at least three folders which are relevant with WeChat MP (Official Account Platform / Media Platform):
5
5
  * lib/v2/wechat
6
6
  * lib/v2/gzh360
7
+ * lib/v2/pku/nsd/gd
7
8
  * lib/v2/sdu/cs
8
9
  *
9
10
  * If your new route is not in the above folders, please add it to the list.
@@ -0,0 +1,86 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const { art } = require('@/utils/render');
5
+ const path = require('path');
6
+
7
+ module.exports = async (ctx) => {
8
+ const language = ctx.params.language ?? 'en';
9
+ const category = ctx.params.category ?? 'censored_list';
10
+ const type = ctx.params.type ?? 'all';
11
+
12
+ const rootUrl = 'https://7mmtv.tv';
13
+ const currentUrl = `${rootUrl}/${language}/${category}/${type}/1.html`;
14
+
15
+ const response = await got({
16
+ method: 'get',
17
+ url: currentUrl,
18
+ });
19
+
20
+ const $ = cheerio.load(response.data);
21
+
22
+ $('.pull-left p a').remove();
23
+
24
+ let items = $('.latest-korean-box-text a')
25
+ .toArray()
26
+ .map((item) => {
27
+ item = $(item);
28
+
29
+ const video = item.parent().parent().find('video');
30
+
31
+ return {
32
+ title: item.text(),
33
+ author: item.parent().find('.pull-left').text(),
34
+ pubDate: parseDate(item.parent().find('.date-part').text()),
35
+ link: `${item.attr('href').match(/^(http.*_content\/\d+)/)[1]}/index.html`,
36
+ poster: video.attr('poster'),
37
+ video: video.attr('srcmv'),
38
+ };
39
+ });
40
+
41
+ items = await Promise.all(
42
+ items.map((item) =>
43
+ ctx.cache.tryGet(item.link, async () => {
44
+ const detailResponse = await got({
45
+ method: 'get',
46
+ url: item.link,
47
+ });
48
+
49
+ const content = cheerio.load(detailResponse.data);
50
+
51
+ item.description = art(path.join(__dirname, 'templates/description.art'), {
52
+ cover: content('.post-inner-details-img img').attr('src'),
53
+ images: content('.video-introduction-images-list-row')
54
+ .find('img')
55
+ .toArray()
56
+ .map((i) => content(i).attr('src')),
57
+ poster: item.poster,
58
+ video: item.video,
59
+ });
60
+
61
+ item.category = content('.actor-right-images-part p')
62
+ .toArray()
63
+ .map((a) => content(a).text())
64
+ .concat(
65
+ content('.posts-inner-details-text-under ul .posts-message span')
66
+ .toArray()
67
+ .map((c) => content(c).text())
68
+ );
69
+
70
+ delete item.poster;
71
+ delete item.video;
72
+
73
+ return item;
74
+ })
75
+ )
76
+ );
77
+
78
+ ctx.state.data = {
79
+ title: $('title')
80
+ .text()
81
+ .replace(/ - Watch JAV Online/, ''),
82
+ link: currentUrl,
83
+ item: items,
84
+ description: $('meta[name="description"]').attr('content'),
85
+ };
86
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ '/:language?/:category?/:type?': ['nczitzk'],
3
+ '/:language?/:category?/:id?': ['nczitzk'],
4
+ };
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ '7mmtv.tv': {
3
+ _name: '7mmtv.tv',
4
+ '.': [
5
+ {
6
+ title: '分类',
7
+ docs: 'https://docs.rsshub.app/multimedia.html#7mmtv-fen-lei',
8
+ source: ['/'],
9
+ target: (params, url) => `/7mmtv/${new URL(url).toString().match(/\/(en|ja|ko|zh)\/([\w\d-]+\/){0,2}/)[1]}`,
10
+ },
11
+ {
12
+ title: '制作商',
13
+ docs: 'https://docs.rsshub.app/multimedia.html#7mmtv-zhi-zuo-shang',
14
+ source: ['/'],
15
+ target: (params, url) => `/7mmtv/${new URL(url).toString().match(/\/(en|ja|ko|zh)\/([\w\d-]+\/){0,2}/)[1]}`,
16
+ },
17
+ ],
18
+ },
19
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = function (router) {
2
+ router.get('/:language?/:category?/:type?', require('./index'));
3
+ };
@@ -0,0 +1,11 @@
1
+ {{ if cover }}
2
+ <img src="{{ cover }}">
3
+ {{ /if }}
4
+ {{ if video }}
5
+ <br>
6
+ <video mute loop="loop" autoplay="autoplay" poster="{{ poster }}"><source src="{{ video }}"></video>
7
+ <br>
8
+ {{ /if }}
9
+ {{ each images }}
10
+ <img src="{{ $value }}">
11
+ {{ /each }}
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/:user/:type?': ['MisteryMonster'],
3
+ };
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ 'behance.net': {
3
+ _name: 'Behance',
4
+ www: [
5
+ {
6
+ title: 'User',
7
+ docs: 'https://docs.rsshub.app/design.html#behance-yong-hu-zuo-pin',
8
+ source: ['/:user', '/:user/:types', '/gallery/:galleryid/:galleryname'],
9
+ target: (params, url, document) => {
10
+ let uid;
11
+ let type = '';
12
+ if (params.types && params.types.match('appreciated')) {
13
+ type = '/appreciated';
14
+ }
15
+ if (url.match(/gallery\/\d+/)) {
16
+ uid = document && document.querySelector('.e2e-project-avatar').childNodes[0].attributes[1].value.match(/behance.net\/(.*)/)[1];
17
+ } else {
18
+ uid = document && document.querySelector('html').innerHTML.match(/([^/]+)\/insights/)[1];
19
+ }
20
+
21
+ return `/behance/${uid}${type}`;
22
+ },
23
+ },
24
+ ],
25
+ },
26
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/:user/:type?', require('./user'));
3
+ };
@@ -0,0 +1,67 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ module.exports = async (ctx) => {
6
+ const user = ctx.params.user ?? '';
7
+ const type = ctx.params.type ?? 'projects';
8
+
9
+ const response = await got({
10
+ method: 'get',
11
+ url: `https://www.behance.net/${user}/${type}`, // 接口只获取12个项目
12
+ headers: {
13
+ 'X-Requested-With': 'XMLHttpRequest',
14
+ },
15
+ });
16
+ const data = response.data;
17
+ let list;
18
+ if (type === 'projects') {
19
+ list = data.profile.activeSection.work.projects.slice(0, 12);
20
+ }
21
+ if (type === 'appreciated') {
22
+ list = data.profile.activeSection.appreciations.appreciations.slice(0, 12);
23
+ }
24
+ const articledata = await Promise.all(
25
+ list.map(async (item) => {
26
+ if (type === 'appreciated') {
27
+ item = item.project;
28
+ }
29
+ const url = `${item.url}?ilo0=1`;
30
+ const description = await ctx.cache.tryGet(url, async () => {
31
+ const response2 = await got({
32
+ method: 'get',
33
+ url,
34
+ });
35
+ const articleHtml = response2.data;
36
+ const $2 = cheerio.load(articleHtml);
37
+ $2('.ImageElement-root-kir').remove();
38
+ $2('.embed-dimensions').remove();
39
+ $2('script.js-lightbox-slide-content').each((_, elem) => {
40
+ elem = $2(elem);
41
+ elem.replaceWith(elem.html());
42
+ });
43
+ const content = $2('div.project-styles').html();
44
+ const single = {
45
+ content,
46
+ };
47
+ return single;
48
+ });
49
+ return description;
50
+ })
51
+ );
52
+ ctx.state.data = {
53
+ title: `${data.profile.owner.first_name} ${data.profile.owner.last_name}'s ${type}`,
54
+ link: data.profile.owner.url,
55
+ item: list.map((item, index) => {
56
+ if (type === 'appreciated') {
57
+ item = item.project;
58
+ }
59
+ return {
60
+ title: item.name,
61
+ description: articledata[index].content,
62
+ link: item.url,
63
+ pubDate: parseDate(item.published_on * 1000),
64
+ };
65
+ }),
66
+ };
67
+ };
@@ -0,0 +1,14 @@
1
+ const { rootUrl, getList, getItems } = require('./utils');
2
+
3
+ module.exports = async (ctx) => {
4
+ const url = `${rootUrl}/reviews/book`;
5
+
6
+ const list = await getList(url);
7
+ const items = await getItems(ctx, list);
8
+
9
+ ctx.state.data = {
10
+ title: 'Book Reviews',
11
+ link: url,
12
+ item: items,
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ const { rootUrl, getList, getItems } = require('./utils');
2
+
3
+ module.exports = async (ctx) => {
4
+ const url = `${rootUrl}/reviews/essay`;
5
+
6
+ const list = await getList(url);
7
+ const items = await getItems(ctx, list);
8
+
9
+ ctx.state.data = {
10
+ title: 'Essays',
11
+ link: url,
12
+ item: items,
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ const { rootUrl, getList, getItems } = require('./utils');
2
+
3
+ module.exports = async (ctx) => {
4
+ const url = `${rootUrl}/reviews/exhibition`;
5
+
6
+ const list = await getList(url);
7
+ const items = await getItems(ctx, list);
8
+
9
+ ctx.state.data = {
10
+ title: 'Exhibition Reviews',
11
+ link: url,
12
+ item: items,
13
+ };
14
+ };
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ '/book': ['Fatpandac'],
3
+ '/essay': ['Fatpandac'],
4
+ '/exhibition': ['Fatpandac'],
5
+ };