rsshub 1.0.0-master.fe4f650 → 1.0.0-master.fe560d2

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 (335) hide show
  1. package/README.md +3 -3
  2. package/lib/config.js +1 -1
  3. package/lib/middleware/parameter.js +3 -3
  4. package/lib/radar-rules.js +0 -46
  5. package/lib/router.js +28 -28
  6. package/lib/routes/v2ex/post.js +3 -0
  7. package/lib/utils/puppeteer-utils.js +63 -0
  8. package/lib/utils/puppeteer.js +13 -8
  9. package/lib/utils/request-wrapper.js +38 -100
  10. package/lib/utils/unify-proxy.js +116 -0
  11. package/lib/utils/wechat-mp.js +2 -0
  12. package/lib/v2/18comic/utils.js +2 -2
  13. package/lib/v2/36kr/index.js +29 -24
  14. package/lib/v2/agora0/maintainer.js +1 -0
  15. package/lib/v2/agora0/pen0.js +43 -0
  16. package/lib/v2/agora0/radar.js +12 -1
  17. package/lib/v2/agora0/router.js +1 -0
  18. package/lib/v2/aiea/index.js +39 -0
  19. package/lib/v2/aiea/maintainer.js +3 -0
  20. package/lib/v2/aiea/radar.js +13 -0
  21. package/lib/v2/aiea/router.js +3 -0
  22. package/lib/v2/baidu/radar.js +6 -6
  23. package/lib/v2/bangumi/online/online.js +4 -2
  24. package/lib/v2/bangumi/tv/group/reply.js +13 -1
  25. package/lib/v2/bangumi/tv/group/topic.js +22 -9
  26. package/lib/v2/bilibili/cache.js +34 -1
  27. package/lib/v2/bilibili/userCollection.js +1 -2
  28. package/lib/v2/bilibili/utils.js +10 -0
  29. package/lib/v2/bilibili/video-all.js +5 -2
  30. package/lib/v2/bilibili/video.js +3 -1
  31. package/lib/v2/bytes/bytes.js +25 -0
  32. package/lib/v2/bytes/maintainer.js +4 -0
  33. package/lib/v2/bytes/radar.js +13 -0
  34. package/lib/v2/bytes/router.js +3 -0
  35. package/lib/v2/caijing/maintainer.js +3 -0
  36. package/lib/v2/caijing/radar.js +13 -0
  37. package/lib/v2/caijing/roll.js +46 -0
  38. package/lib/v2/caijing/router.js +3 -0
  39. package/lib/v2/cdzjryb/maintainer.js +3 -0
  40. package/lib/v2/cdzjryb/projectList.js +49 -0
  41. package/lib/v2/cdzjryb/radar.js +13 -0
  42. package/lib/v2/cdzjryb/router.js +3 -0
  43. package/lib/v2/cdzjryb/templates/projectList.art +23 -0
  44. package/lib/v2/chsi/kydt.js +51 -0
  45. package/lib/v2/chsi/maintainer.js +3 -0
  46. package/lib/v2/chsi/radar.js +13 -0
  47. package/lib/v2/chsi/router.js +3 -0
  48. package/lib/v2/cnbeta/radar.js +6 -6
  49. package/lib/v2/cnbeta/router.js +1 -1
  50. package/lib/v2/cnbeta/type.js +6 -12
  51. package/lib/v2/cnbeta/utils.js +5 -8
  52. package/lib/v2/cngal/entry.js +25 -0
  53. package/lib/v2/cngal/maintainer.js +4 -0
  54. package/lib/v2/cngal/radar.js +19 -0
  55. package/lib/v2/cngal/router.js +4 -0
  56. package/lib/v2/cngal/templates/entry-description.art +4 -0
  57. package/lib/v2/cngal/templates/weekly-description.art +4 -0
  58. package/lib/v2/cngal/weekly.js +20 -0
  59. package/lib/v2/cnki/author.js +45 -0
  60. package/lib/v2/cnki/journals.js +2 -23
  61. package/lib/v2/cnki/maintainer.js +1 -0
  62. package/lib/v2/cnki/radar.js +8 -0
  63. package/lib/v2/cnki/router.js +1 -0
  64. package/lib/v2/cnki/utils.js +26 -0
  65. package/lib/v2/codeforces/maintainer.js +1 -0
  66. package/lib/v2/codeforces/radar.js +8 -0
  67. package/lib/v2/codeforces/recent_actions.js +47 -0
  68. package/lib/v2/codeforces/router.js +1 -0
  69. package/lib/v2/curius/links.js +43 -0
  70. package/lib/v2/curius/maintainer.js +3 -0
  71. package/lib/v2/curius/radar.js +13 -0
  72. package/lib/v2/curius/router.js +3 -0
  73. package/lib/v2/curius/templates/description.art +16 -0
  74. package/lib/v2/douyin/hashtag.js +20 -19
  75. package/lib/v2/douyin/live.js +2 -21
  76. package/lib/v2/douyin/user.js +2 -17
  77. package/lib/v2/douyin/utils.js +85 -0
  78. package/lib/v2/{acm-ecnu → ecnu}/contest.js +1 -4
  79. package/lib/v2/ecnu/maintainer.js +4 -0
  80. package/lib/v2/ecnu/radar.js +30 -0
  81. package/lib/v2/ecnu/router.js +4 -0
  82. package/lib/v2/{acm-ecnu → ecnu}/templates/description.art +0 -0
  83. package/lib/v2/ecnu/yjs.js +37 -0
  84. package/lib/v2/ehentai/ehapi.js +23 -12
  85. package/lib/v2/foresightnews/index.js +8 -11
  86. package/lib/v2/foreverblog/feeds.js +36 -0
  87. package/lib/v2/foreverblog/maintainer.js +3 -0
  88. package/lib/v2/foreverblog/radar.js +13 -0
  89. package/lib/v2/foreverblog/router.js +3 -0
  90. package/lib/v2/freewechat/maintainer.js +3 -0
  91. package/lib/v2/freewechat/profile.js +61 -0
  92. package/lib/v2/freewechat/radar.js +13 -0
  93. package/lib/v2/freewechat/router.js +3 -0
  94. package/lib/v2/gcores/category.js +16 -6
  95. package/lib/v2/good/index.js +15 -14
  96. package/lib/v2/gov/customs/list.js +1 -1
  97. package/lib/v2/gov/dianbai/dianbai.js +18 -0
  98. package/lib/v2/gov/gaozhou/gaozhou.js +19 -0
  99. package/lib/v2/gov/general/general.js +250 -0
  100. package/lib/v2/gov/general/templates/zcjdpt.art +128 -0
  101. package/lib/v2/gov/gz/index.js +38 -0
  102. package/lib/v2/gov/huazhou/huazhou.js +19 -0
  103. package/lib/v2/gov/hunan/changsha/major-email.js +52 -0
  104. package/lib/v2/gov/maintainer.js +19 -2
  105. package/lib/v2/gov/maoming/maoming.js +417 -0
  106. package/lib/v2/gov/maonan/maonan.js +100 -0
  107. package/lib/v2/gov/mgs/mgs.js +19 -0
  108. package/lib/v2/gov/mmht/mmht.js +19 -0
  109. package/lib/v2/gov/nmpa/generic.js +1 -1
  110. package/lib/v2/gov/radar.js +197 -0
  111. package/lib/v2/gov/router.js +18 -2
  112. package/lib/v2/gov/sasac/generic.js +42 -0
  113. package/lib/v2/gov/sdb/sdb.js +19 -0
  114. package/lib/v2/gov/shanghai/yjj/index.js +3 -1
  115. package/lib/v2/gov/xinyi/xinyi.js +19 -0
  116. package/lib/v2/gov/zhengce/govall.js +55 -0
  117. package/lib/v2/gov/zhengce/wenjian.js +47 -0
  118. package/lib/v2/gov/zhengce/zhengceku.js +22 -0
  119. package/lib/v2/gov/zhengce/zuixin.js +39 -0
  120. package/lib/v2/guanhai/index.js +47 -0
  121. package/lib/v2/guanhai/maintainer.js +4 -0
  122. package/lib/v2/guanhai/radar.js +13 -0
  123. package/lib/v2/guanhai/router.js +3 -0
  124. package/lib/v2/hackernews/index.js +6 -0
  125. package/lib/v2/hellogithub/volume.js +15 -32
  126. package/lib/v2/{heu → hrbeu}/gx/card.js +5 -10
  127. package/lib/v2/{heu → hrbeu}/gx/list.js +12 -20
  128. package/lib/v2/hrbeu/job/bigemploy.js +25 -0
  129. package/lib/v2/{heu → hrbeu}/job/calendar.js +8 -16
  130. package/lib/v2/{heu → hrbeu}/job/list.js +11 -16
  131. package/lib/v2/{heu → hrbeu}/maintainer.js +2 -1
  132. package/lib/v2/{heu → hrbeu}/radar.js +18 -10
  133. package/lib/v2/{heu → hrbeu}/router.js +3 -2
  134. package/lib/v2/{heu → hrbeu}/uae/list.js +12 -17
  135. package/lib/v2/hrbeu/ugs/news.js +98 -0
  136. package/lib/v2/{heu → hrbeu}/yjsy/list.js +8 -16
  137. package/lib/v2/ieee-security/maintainer.js +3 -0
  138. package/lib/v2/ieee-security/radar.js +13 -0
  139. package/lib/v2/ieee-security/router.js +3 -0
  140. package/lib/v2/ieee-security/sp.js +36 -0
  141. package/lib/v2/javbus/index.js +8 -2
  142. package/lib/v2/javbus/templates/description.art +12 -1
  143. package/lib/v2/jike/user.js +1 -0
  144. package/lib/v2/lang/maintainer.js +3 -0
  145. package/lib/v2/lang/radar.js +13 -0
  146. package/lib/v2/lang/room.js +40 -0
  147. package/lib/v2/lang/router.js +3 -0
  148. package/lib/v2/lang/templates/room.art +1 -0
  149. package/lib/v2/liulinblog/utils.js +7 -4
  150. package/lib/v2/luogu/daily.js +1 -1
  151. package/lib/v2/mangadex/index.js +73 -0
  152. package/lib/v2/mangadex/maintainer.js +3 -0
  153. package/lib/v2/mangadex/radar.js +13 -0
  154. package/lib/v2/mangadex/router.js +3 -0
  155. package/lib/v2/mihoyo/ys/news.js +3 -2
  156. package/lib/v2/mirror/index.js +15 -8
  157. package/lib/v2/mrdx/daily.js +79 -0
  158. package/lib/v2/mrdx/maintainer.js +3 -0
  159. package/lib/v2/mrdx/radar.js +13 -0
  160. package/lib/v2/mrdx/router.js +3 -0
  161. package/lib/v2/mrdx/utils.js +17 -0
  162. package/lib/v2/mtime/news.js +1 -1
  163. package/lib/v2/nautil/maintainer.js +3 -0
  164. package/lib/v2/nautil/radar.js +13 -0
  165. package/lib/v2/nautil/router.js +3 -0
  166. package/lib/v2/nautil/templates/description.art +6 -0
  167. package/lib/v2/nautil/topics.js +57 -0
  168. package/lib/v2/ndss-symposium/maintainer.js +3 -0
  169. package/lib/v2/ndss-symposium/ndss.js +80 -0
  170. package/lib/v2/ndss-symposium/radar.js +13 -0
  171. package/lib/v2/ndss-symposium/router.js +3 -0
  172. package/lib/v2/nextapple/realtime.js +1 -1
  173. package/lib/v2/nintendo/direct.js +31 -0
  174. package/lib/v2/nintendo/eshop_cn.js +44 -0
  175. package/lib/v2/nintendo/eshop_hk.js +79 -0
  176. package/lib/v2/nintendo/eshop_jp.js +34 -0
  177. package/lib/v2/nintendo/eshop_us.js +32 -0
  178. package/lib/v2/nintendo/maintainer.js +7 -0
  179. package/lib/v2/nintendo/news.js +23 -0
  180. package/lib/v2/nintendo/news_china.js +35 -0
  181. package/lib/v2/nintendo/radar.js +70 -0
  182. package/lib/v2/nintendo/router.js +10 -0
  183. package/lib/{routes → v2}/nintendo/system-update.js +2 -2
  184. package/lib/v2/nintendo/templates/direct.art +6 -0
  185. package/lib/v2/nintendo/templates/eshop_cn.art +21 -0
  186. package/lib/v2/nintendo/templates/eshop_hk.art +61 -0
  187. package/lib/v2/nintendo/templates/eshop_jp.art +3 -0
  188. package/lib/v2/nintendo/templates/eshop_us.art +24 -0
  189. package/lib/{routes → v2}/nintendo/utils.js +34 -50
  190. package/lib/v2/njxzc/home.js +13 -9
  191. package/lib/v2/nmtv/column.js +53 -0
  192. package/lib/v2/nmtv/maintainer.js +3 -0
  193. package/lib/v2/nmtv/radar.js +13 -0
  194. package/lib/v2/nmtv/router.js +3 -0
  195. package/lib/v2/nmtv/templates/description.art +9 -0
  196. package/lib/v2/nua/lib.js +39 -0
  197. package/lib/v2/nua/maintainer.js +1 -0
  198. package/lib/v2/nua/radar.js +8 -0
  199. package/lib/v2/nua/router.js +1 -0
  200. package/lib/v2/nua/utils.js +7 -12
  201. package/lib/v2/nuaa/utils/pypasswaf.js +3 -2
  202. package/lib/v2/nyaa/main.js +16 -23
  203. package/lib/v2/nyaa/maintainer.js +7 -4
  204. package/lib/v2/nyaa/radar.js +27 -29
  205. package/lib/v2/nyaa/router.js +4 -2
  206. package/lib/v2/odaily/post.js +15 -20
  207. package/lib/v2/odaily/utils.js +1 -1
  208. package/lib/v2/paradigm/maintainer.js +3 -0
  209. package/lib/v2/paradigm/radar.js +13 -0
  210. package/lib/v2/paradigm/router.js +3 -0
  211. package/lib/v2/paradigm/writing.js +44 -0
  212. package/lib/v2/picuki/maintainer.js +1 -1
  213. package/lib/v2/picuki/profile.js +10 -8
  214. package/lib/v2/picuki/utils.js +21 -0
  215. package/lib/v2/pixiv/api/getRanking.js +1 -1
  216. package/lib/v2/pixiv/ranking.js +3 -0
  217. package/lib/v2/producthunt/templates/descImg.art +2 -2
  218. package/lib/v2/qlu/maintainer.js +3 -0
  219. package/lib/v2/qlu/notice.js +54 -0
  220. package/lib/v2/qlu/radar.js +13 -0
  221. package/lib/v2/qlu/router.js +3 -0
  222. package/lib/v2/reactnewsletter/maintainer.js +4 -0
  223. package/lib/v2/reactnewsletter/radar.js +13 -0
  224. package/lib/v2/reactnewsletter/reactnewsletter.js +25 -0
  225. package/lib/v2/reactnewsletter/router.js +3 -0
  226. package/lib/v2/researchgate/maintainer.js +3 -0
  227. package/lib/v2/researchgate/publications.js +70 -0
  228. package/lib/v2/researchgate/radar.js +13 -0
  229. package/lib/v2/researchgate/router.js +3 -0
  230. package/lib/v2/saraba1st/digest.js +79 -0
  231. package/lib/v2/saraba1st/maintainer.js +1 -0
  232. package/lib/v2/saraba1st/radar.js +12 -3
  233. package/lib/v2/saraba1st/router.js +1 -0
  234. package/lib/v2/saraba1st/templates/digest.art +5 -0
  235. package/lib/v2/sctv/maintainer.js +1 -1
  236. package/lib/v2/sctv/programme.js +39 -17
  237. package/lib/v2/sctv/router.js +1 -1
  238. package/lib/v2/shmtu/jwc.js +57 -0
  239. package/lib/v2/shmtu/maintainer.js +5 -0
  240. package/lib/v2/shmtu/portal.js +81 -0
  241. package/lib/v2/shmtu/radar.js +29 -0
  242. package/lib/v2/shmtu/router.js +5 -0
  243. package/lib/v2/shmtu/templates/portal.art +30 -0
  244. package/lib/v2/shmtu/www.js +58 -0
  245. package/lib/v2/sigsac/ccs.js +57 -0
  246. package/lib/v2/sigsac/maintainer.js +3 -0
  247. package/lib/v2/sigsac/radar.js +13 -0
  248. package/lib/v2/sigsac/router.js +3 -0
  249. package/lib/v2/simpleinfo/index.js +50 -0
  250. package/lib/v2/simpleinfo/maintainer.js +3 -0
  251. package/lib/v2/simpleinfo/radar.js +19 -0
  252. package/lib/v2/simpleinfo/router.js +3 -0
  253. package/lib/v2/simpleinfo/templates/description.art +6 -0
  254. package/lib/v2/sse/maintainer.js +1 -1
  255. package/lib/v2/telegram/channel.js +54 -38
  256. package/lib/v2/tencent/maintainer.js +2 -0
  257. package/lib/v2/tencent/news/coronavirus/data.js +71 -0
  258. package/lib/v2/tencent/news/coronavirus/total.js +34 -0
  259. package/lib/v2/tencent/news/coronavirus/utils.js +17 -0
  260. package/lib/v2/tencent/radar.js +8 -0
  261. package/lib/v2/tencent/router.js +2 -0
  262. package/lib/v2/tencent/templates/coronavirus/chinaTotal.art +6 -0
  263. package/lib/v2/tencent/templates/coronavirus/data.art +4 -0
  264. package/lib/v2/test/index.js +8 -0
  265. package/lib/v2/theverge/index.js +9 -1
  266. package/lib/v2/theverge/maintainer.js +1 -1
  267. package/lib/v2/theverge/radar.js +2 -2
  268. package/lib/v2/theverge/router.js +1 -1
  269. package/lib/v2/tingshuitz/changsha.js +43 -0
  270. package/lib/v2/tingshuitz/maintainer.js +1 -0
  271. package/lib/v2/tingshuitz/radar.js +10 -0
  272. package/lib/v2/tingshuitz/router.js +1 -0
  273. package/lib/v2/twitter/web-api/twitter-api.js +19 -15
  274. package/lib/v2/twreporter/category.js +17 -8
  275. package/lib/v2/uber/blog.js +59 -0
  276. package/lib/v2/uber/maintainer.js +3 -0
  277. package/lib/v2/uber/radar.js +13 -0
  278. package/lib/v2/uber/router.js +3 -0
  279. package/lib/v2/usenix/maintainer.js +3 -0
  280. package/lib/v2/usenix/radar.js +13 -0
  281. package/lib/v2/usenix/router.js +3 -0
  282. package/lib/v2/usenix/usenix.js +63 -0
  283. package/lib/v2/usepanda/index.js +26 -0
  284. package/lib/v2/usepanda/maintainer.js +3 -0
  285. package/lib/v2/usepanda/radar.js +11 -0
  286. package/lib/v2/usepanda/router.js +3 -0
  287. package/lib/v2/uw/gix/news.js +67 -0
  288. package/lib/v2/uw/maintainer.js +3 -0
  289. package/lib/v2/uw/radar.js +13 -0
  290. package/lib/v2/uw/router.js +3 -0
  291. package/lib/v2/verse/articles.js +42 -0
  292. package/lib/v2/verse/maintainer.js +3 -0
  293. package/lib/v2/verse/radar.js +13 -0
  294. package/lib/v2/verse/router.js +3 -0
  295. package/lib/{routes → v2}/weibo/keyword.js +2 -2
  296. package/lib/v2/weibo/maintainer.js +8 -0
  297. package/lib/v2/weibo/oasis/user.js +20 -0
  298. package/lib/v2/weibo/radar.js +48 -0
  299. package/lib/v2/weibo/router.js +8 -0
  300. package/lib/{routes → v2}/weibo/search/hot.js +2 -0
  301. package/lib/{routes → v2}/weibo/super_index.js +2 -2
  302. package/lib/{routes → v2}/weibo/timeline.js +2 -2
  303. package/lib/{routes → v2}/weibo/user.js +2 -2
  304. package/lib/{routes → v2}/weibo/utils.js +49 -14
  305. package/lib/v2/ymgal/article.js +61 -0
  306. package/lib/v2/ymgal/game.js +41 -0
  307. package/lib/v2/ymgal/maintainer.js +4 -0
  308. package/lib/v2/ymgal/radar.js +31 -0
  309. package/lib/v2/ymgal/router.js +4 -0
  310. package/lib/v2/ymgal/templates/description.art +7 -0
  311. package/lib/v2/zhihu/pin/utils.js +49 -41
  312. package/package.json +26 -27
  313. package/lib/routes/blogs/foreverblog.js +0 -33
  314. package/lib/routes/gov/zhengce/govall.js +0 -59
  315. package/lib/routes/gov/zhengce/wenjian.js +0 -53
  316. package/lib/routes/gov/zhengce/zuixin.js +0 -42
  317. package/lib/routes/langlive/room.js +0 -33
  318. package/lib/routes/nautilus/topics.js +0 -45
  319. package/lib/routes/nintendo/direct.js +0 -34
  320. package/lib/routes/nintendo/eshop_cn.js +0 -51
  321. package/lib/routes/nintendo/eshop_hk.js +0 -26
  322. package/lib/routes/nintendo/eshop_jp.js +0 -20
  323. package/lib/routes/nintendo/eshop_us.js +0 -36
  324. package/lib/routes/nintendo/news.js +0 -25
  325. package/lib/routes/nintendo/news_china.js +0 -41
  326. package/lib/routes/researchgate/publications.js +0 -60
  327. package/lib/routes/universities/ecnuyjs/ecnuyjs.js +0 -23
  328. package/lib/routes/universities/shmtu/jwc.js +0 -75
  329. package/lib/routes/universities/shmtu/www.js +0 -61
  330. package/lib/routes/weibo/oasis/user.js +0 -17
  331. package/lib/v2/acm-ecnu/maintainer.js +0 -3
  332. package/lib/v2/acm-ecnu/radar.js +0 -19
  333. package/lib/v2/acm-ecnu/router.js +0 -3
  334. package/lib/v2/cnbeta/index.js +0 -16
  335. package/lib/v2/heu/job/bigemploy.js +0 -42
@@ -0,0 +1,57 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const timezone = require('@/utils/timezone');
5
+ const host = 'https://jwc.shmtu.edu.cn';
6
+
7
+ async function load(link) {
8
+ const response = await got(link, { https: { rejectUnauthorized: false } });
9
+ const $ = cheerio.load(response.data);
10
+
11
+ return $('.wp_articlecontent').html();
12
+ }
13
+
14
+ const ProcessFeed = (list, caches) =>
15
+ Promise.all(
16
+ list.map((item) =>
17
+ caches.tryGet(item.link, async () => {
18
+ item.description = await load(item.link);
19
+ return item;
20
+ })
21
+ )
22
+ );
23
+
24
+ module.exports = async (ctx) => {
25
+ const type = ctx.params.type;
26
+ const info = type === 'jwgg' ? '教务公告' : '教务新闻';
27
+
28
+ const response = await got(`${host}/${type}/list.htm`, {
29
+ headers: {
30
+ Referer: host,
31
+ },
32
+ https: { rejectUnauthorized: false },
33
+ });
34
+
35
+ const $ = cheerio.load(response.data);
36
+ const list = $('tbody tr')
37
+ .toArray()
38
+ .map((item) => {
39
+ item = $(item);
40
+ return {
41
+ title: item.find('.views-field-nothing a').attr('title').trim(),
42
+ link: new URL(item.find('a').attr('href'), host).href,
43
+ pubDate: timezone(parseDate(item.find('.pubdate').text()), 8),
44
+ category: item.find('.views-field-field-xxlb').text(),
45
+ author: item.find('.views-field-field-xxly').text(),
46
+ };
47
+ });
48
+
49
+ const result = await ProcessFeed(list, ctx.cache);
50
+
51
+ ctx.state.data = {
52
+ title: `上海海事大学 ${info}`,
53
+ link: `${host}/${type}`,
54
+ description: '上海海事大学 教务信息',
55
+ item: result,
56
+ };
57
+ };
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ '/jwc/:type': ['imbytecat', 'simonsmh'],
3
+ '/portal/:type': ['imbytecat'],
4
+ '/www/:type': ['imbytecat', 'simonsmh'],
5
+ };
@@ -0,0 +1,81 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const timezone = require('@/utils/timezone');
5
+ const path = require('path');
6
+ const { art } = require('@/utils/render');
7
+
8
+ const bootstrapHost = 'https://weixin.shmtu.edu.cn/dynamic/shmtuHttps';
9
+ const host = 'https://portal.shmtu.edu.cn/api';
10
+
11
+ const loadDetail = async (link) => {
12
+ const response = await got.post(bootstrapHost, {
13
+ form: {
14
+ interfaceUrl: link,
15
+ },
16
+ https: { rejectUnauthorized: false },
17
+ });
18
+
19
+ return JSON.parse(response.data);
20
+ };
21
+
22
+ const processFeed = (list, caches) =>
23
+ Promise.all(
24
+ list.map((item) =>
25
+ caches.tryGet(item.link, async () => {
26
+ const detail = await loadDetail(item.link);
27
+ const files = detail.field_file;
28
+ const images = detail.field_image;
29
+ item.description = art(path.join(__dirname, 'templates/portal.art'), {
30
+ body: detail.body.und[0].safe_value,
31
+ images: images.length !== 0 && Object.keys(images).length !== 0 ? images.und : null,
32
+ files: files.length !== 0 && Object.keys(files).length !== 0 ? files.und : null,
33
+ });
34
+ item.link = detail.path;
35
+ return item;
36
+ })
37
+ )
38
+ );
39
+
40
+ module.exports = async (ctx) => {
41
+ const type = ctx.params.type;
42
+ let info;
43
+ switch (type) {
44
+ case 'bmtzgg':
45
+ info = '部门通知公告';
46
+ break;
47
+ case 'xsydxhdgg':
48
+ info = '学术与大型活动公告';
49
+ break;
50
+ case 'bmdt':
51
+ info = '部门动态';
52
+ break;
53
+ default:
54
+ info = '未知';
55
+ break;
56
+ }
57
+
58
+ const response = await got.post(bootstrapHost, {
59
+ form: {
60
+ interfaceUrl: `${host}/${type}.json?page=0`,
61
+ },
62
+ https: { rejectUnauthorized: false },
63
+ });
64
+
65
+ const list = JSON.parse(response.data).map((item) => ({
66
+ title: cheerio.load(item.title).text(),
67
+ link: `${host}/node/${item.nid}.json`,
68
+ pubDate: timezone(parseDate(item.created), 8),
69
+ category: item.field_department[0],
70
+ author: item.field_department[0],
71
+ }));
72
+
73
+ const result = await processFeed(list, ctx.cache);
74
+
75
+ ctx.state.data = {
76
+ title: `上海海事大学 ${info}`,
77
+ link: 'https://portal.shmtu.edu.cn/bumentongzhigonggao',
78
+ description: '上海海事大学 数字平台',
79
+ item: result,
80
+ };
81
+ };
@@ -0,0 +1,29 @@
1
+ module.exports = {
2
+ 'shmtu.edu.cn': {
3
+ _name: '上海海事大学',
4
+ jwc: [
5
+ {
6
+ title: '教务信息',
7
+ docs: 'https://docs.rsshub.app/university.html#shang-hai-dian-li-da-xue',
8
+ source: ['/:type'],
9
+ target: '/shmtu/jwc/:type',
10
+ },
11
+ ],
12
+ portal: [
13
+ {
14
+ title: '数字平台',
15
+ docs: 'https://docs.rsshub.app/university.html#shang-hai-dian-li-da-xue',
16
+ source: ['/:type'],
17
+ target: '/shmtu/portal/:type',
18
+ },
19
+ ],
20
+ www: [
21
+ {
22
+ title: '官网信息',
23
+ docs: 'https://docs.rsshub.app/university.html#shang-hai-dian-li-da-xue',
24
+ source: ['/:type'],
25
+ target: '/shmtu/www/:type',
26
+ },
27
+ ],
28
+ },
29
+ };
@@ -0,0 +1,5 @@
1
+ module.exports = (router) => {
2
+ router.get('/jwc/:type', require('./jwc'));
3
+ router.get('/portal/:type', require('./portal'));
4
+ router.get('/www/:type', require('./www'));
5
+ };
@@ -0,0 +1,30 @@
1
+ {{@ body}}
2
+ {{if images}}
3
+ <span style="font-size:19px">
4
+ 图片:
5
+ </span>
6
+ {{each images image}}
7
+ <figure>
8
+ <img src="https://weixin.shmtu.org/dynamic/getFile?fid={{image.fid}}"
9
+ alt="{{image.filename}}"
10
+ style="margin: 0 auto" />
11
+ <figcaption style="text-align:center;font-size:19px">
12
+ {{image.alt}}
13
+ </figcaption>
14
+ </figure>
15
+ {{/each}}
16
+ {{/if}}
17
+ {{if files}}
18
+ <span style="font-size:19px">
19
+ 附件:
20
+ </span>
21
+ {{each files file}}
22
+ <p style="text-indent:32px">
23
+ <span style="font-size:19px">
24
+ <a href="https://weixin.shmtu.org/dynamic/getFile?fid={{file.fid}}" target="_blank">
25
+ {{file.filename}}
26
+ </a>
27
+ </span>
28
+ </p>
29
+ {{/each}}
30
+ {{/if}}
@@ -0,0 +1,58 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const host = 'https://www.shmtu.edu.cn';
5
+
6
+ async function load(link) {
7
+ const response = await got.get(link, { https: { rejectUnauthorized: false } });
8
+ const $ = cheerio.load(response.data);
9
+
10
+ return $('article').html();
11
+ }
12
+
13
+ const ProcessFeed = (list, caches) =>
14
+ Promise.all(
15
+ list.map((item) =>
16
+ caches.tryGet(item.link, async () => {
17
+ item.description = await load(item.link);
18
+
19
+ return item;
20
+ })
21
+ )
22
+ );
23
+
24
+ module.exports = async (ctx) => {
25
+ const type = ctx.params.type;
26
+ const info = type === 'notes' ? '通知公告' : '学术讲座';
27
+
28
+ const response = await got(`${host}/${type}`, {
29
+ headers: {
30
+ Referer: host,
31
+ },
32
+ https: { rejectUnauthorized: false },
33
+ });
34
+
35
+ const $ = cheerio.load(response.data);
36
+ const list = $('tbody tr')
37
+ .toArray()
38
+ .map((item) => {
39
+ item = $(item);
40
+ const category = item.find('.department').text().trim();
41
+ return {
42
+ title: item.find('.title a').text().trim(),
43
+ link: new URL(item.find('a').attr('href'), host).href,
44
+ pubDate: parseDate(item.find('.date-display-single').attr('content')),
45
+ category,
46
+ author: category,
47
+ };
48
+ });
49
+
50
+ const result = await ProcessFeed(list, ctx.cache);
51
+
52
+ ctx.state.data = {
53
+ title: `上海海事大学 ${info}`,
54
+ link: `${host}/${type}`,
55
+ description: '上海海事大学 官网信息',
56
+ item: result,
57
+ };
58
+ };
@@ -0,0 +1,57 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const url = 'https://www.sigsac.org/';
4
+ const { parseDate } = require('@/utils/parse-date');
5
+ // https://www.sigsac.org/ccs/CCS2022/program/accepted-papers.html
6
+
7
+ module.exports = async (ctx) => {
8
+ const last = new Date().getFullYear() + 1;
9
+ const yearList = Array.from({ length: last - 2020 }, (_, v) => `${url}ccs/CCS${v + 2020}/`);
10
+ const yearResponses = await got.all(yearList.map((url) => got(url)));
11
+
12
+ const urlList = yearResponses.map((response) => {
13
+ const $ = cheerio.load(response.data);
14
+ return new URL($('a:contains("Accepted Papers")').attr('href'), response.url).href;
15
+ });
16
+
17
+ const responses = await got.all(urlList.map((url) => got(url)));
18
+
19
+ const items = responses.map((response) => {
20
+ const $ = cheerio.load(response.data);
21
+ const link = response.url;
22
+ const paperSection = $('div.papers-item')
23
+ .toArray()
24
+ .map((item) => {
25
+ item = $(item);
26
+ const title = item.find('b').text().trim();
27
+ return {
28
+ title,
29
+ author: item.find('p').text().trim().replaceAll('\n', '').replace(/\s+/g, ' '),
30
+ link: `${link}#${title}`,
31
+ pubDate: parseDate(link.match(/CCS(\d{4})/)[1], 'YYYY'),
32
+ };
33
+ });
34
+ const paperTable = $('tbody tr')
35
+ .toArray()
36
+ .slice(1) // skip table header
37
+ .map((item) => {
38
+ item = $(item);
39
+ const title = item.find('td').eq(0).text().trim();
40
+ return {
41
+ title,
42
+ author: item.find('td').eq(1).text().trim().replaceAll('\n', '').replace(/\s+/g, ' '),
43
+ link: `${link}#${title}`,
44
+ pubDate: parseDate(link.match(/CCS(\d{4})/)[1], 'YYYY'),
45
+ };
46
+ });
47
+ return paperSection.length ? paperSection : paperTable;
48
+ });
49
+
50
+ ctx.state.data = {
51
+ title: 'ACM CCS',
52
+ link: url,
53
+ description: 'The ACM Conference on Computer and Communications Security (CCS) Accepted Papers',
54
+ allowEmpty: true,
55
+ item: items.flat(),
56
+ };
57
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/ccs/': ['ZeddYu'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'sigsac.org': {
3
+ _name: 'ACM Special Interest Group on Security Audit and Control',
4
+ '.': [
5
+ {
6
+ title: 'ACM Conference on Computer and Communications Security',
7
+ docs: 'https://docs.rsshub.app/journal.html#acm-special-interest-group-on-security-audit-and-control',
8
+ source: ['/ccs.html', '/'],
9
+ target: '/sigsac/ccs',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/ccs', require('./ccs'));
3
+ };
@@ -0,0 +1,50 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const timezone = require('@/utils/timezone');
4
+ const path = require('path');
5
+ const { art } = require('@/utils/render');
6
+ const { parseDate } = require('@/utils/parse-date');
7
+
8
+ module.exports = async (ctx) => {
9
+ const { category } = ctx.params;
10
+ const rootUrl = 'https://blog.simpleinfo.cc';
11
+ const link = `${rootUrl}${category ? (category === 'work' || category === 'talk' ? `/blog/${category}` : `/shasha77?category=${category}`) : '/shasha77'}`;
12
+ const response = await got(link);
13
+ const $ = cheerio.load(response.data);
14
+ const title = `${$('.-active').text()} - 簡訊設計`;
15
+ $('.-ad').remove();
16
+
17
+ const list = $('.article-item')
18
+ .map((_, item) => {
19
+ item = $(item);
20
+ return {
21
+ title: item.find('.title').text(),
22
+ link: item.find('a').first().attr('href'),
23
+ category: item.find('.category').text(),
24
+ };
25
+ })
26
+ .get();
27
+
28
+ const items = await Promise.all(
29
+ list.map((item) =>
30
+ ctx.cache.tryGet(item.link, async () => {
31
+ const result = await got(item.link);
32
+ const content = cheerio.load(result.data);
33
+ item.author = content('meta[property="article:author"]').attr('content');
34
+ item.pubDate = timezone(parseDate(content('meta[property="article:published_time"]').attr('content')), +8);
35
+ item.description = art(path.join(__dirname, 'templates/description.art'), {
36
+ image: content('meta[property="og:image"]').attr('content'),
37
+ description: content('.article-content').first().html(),
38
+ });
39
+ return item;
40
+ })
41
+ )
42
+ );
43
+
44
+ ctx.state.data = {
45
+ title,
46
+ link,
47
+ language: 'zh-tw',
48
+ item: items,
49
+ };
50
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/:category?': ['haukeng'],
3
+ };
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ 'blog.simpleinfo.cc': {
3
+ _name: '簡訊設計',
4
+ '.': [
5
+ {
6
+ title: '志祺七七',
7
+ docs: 'https://docs.rsshub.app/new-media.html#jian-xun-she-ji',
8
+ source: '/shasha77',
9
+ target: (_, url) => `/simpleinfo/${new URL(url).searchParams.get('category')}`,
10
+ },
11
+ {
12
+ title: '夥伴聊聊 / 專案作品',
13
+ docs: 'https://docs.rsshub.app/new-media.html#jian-xun-she-ji',
14
+ source: '/blog/:category',
15
+ target: '/simpleinfo/:category',
16
+ },
17
+ ],
18
+ },
19
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/:category?', require('./index'));
3
+ };
@@ -0,0 +1,6 @@
1
+ {{ if image }}
2
+ <img src="{{ image }}">
3
+ {{ /if }}
4
+ {{ if description }}
5
+ {{@ description }}
6
+ {{ /if }}
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  '/convert/:query?': ['kt286'],
3
- '/disclosure/:query?': ['alienmao'],
3
+ '/disclosure/:query?': ['harveyqiu'],
4
4
  '/inquire': ['Jeason0228'],
5
5
  '/lawandrules/:slug?': ['nczitzk'],
6
6
  '/renewal': ['Jeason0228'],
@@ -25,6 +25,7 @@ const STICKER = 'STICKER';
25
25
  const ANIMATED_STICKER = 'ANIMATED_STICKER';
26
26
  // const VIDEO_STICKER = 'VIDEO_STICKER'; // not supported yet by t.me
27
27
  const UNSUPPORTED = 'UNSUPPORTED';
28
+ const PARTIALLY_UNSUPPORTED = 'PARTIALLY_UNSUPPORTED';
28
29
 
29
30
  /* message media tag dict */
30
31
  const mediaTagDict = {
@@ -45,6 +46,7 @@ const mediaTagDict = {
45
46
  ANIMATED_STICKER: ['[Animated Sticker]', '[Animated Sticker]'],
46
47
  // VIDEO_STICKER: ['[Video Sticker]', '[Video Sticker]'], // not supported yet by t.me
47
48
  UNSUPPORTED: ['[Unsupported]', '🚫'],
49
+ PARTIALLY_UNSUPPORTED: ['', ''],
48
50
  };
49
51
 
50
52
  module.exports = async (ctx) => {
@@ -120,7 +122,7 @@ module.exports = async (ctx) => {
120
122
  item = $(item);
121
123
 
122
124
  /* message types */
123
- const msgTypes = [];
125
+ let msgTypes = [];
124
126
  if (item.find('.service_message').length) {
125
127
  // service message can have an image (avatar changed)
126
128
  msgTypes.push(SERVICE);
@@ -157,10 +159,14 @@ module.exports = async (ctx) => {
157
159
  if (item.find('.tgme_widget_message_tgsticker').length) {
158
160
  msgTypes.push(ANIMATED_STICKER);
159
161
  }
160
- if (msgTypes.length === 0 && item.find('.message_media_not_supported').length) {
161
- msgTypes.unshift(UNSUPPORTED);
162
- if (!includeUnsupportedMsg) {
163
- return null; // drop unsupported message
162
+ if (item.find('.message_media_not_supported').length) {
163
+ if (item.find('.media_supported_cont').length) {
164
+ msgTypes.unshift(PARTIALLY_UNSUPPORTED);
165
+ } else {
166
+ if (msgTypes.length === 0 && !includeUnsupportedMsg) {
167
+ return null; // drop unsupported message
168
+ }
169
+ msgTypes.unshift(UNSUPPORTED);
164
170
  }
165
171
  }
166
172
  // all other types above cannot be mixed
@@ -183,16 +189,6 @@ module.exports = async (ctx) => {
183
189
  }
184
190
  }
185
191
 
186
- /* media tag */
187
- let mediaTag = '';
188
- if (showMediaTagInTitle) {
189
- msgTypes.forEach((type) => {
190
- if (type !== REPLY || type !== FORWARDED || type !== VIA_BOT || (type === REPLY && showReplyTo) || (type === FORWARDED && showFwdFrom) || (type === VIA_BOT && showViaBot)) {
191
- mediaTag += showMediaTagAsEmoji ? mediaTagDict[type][1] : mediaTagDict[type][0];
192
- }
193
- });
194
- }
195
-
196
192
  /* fix emoji */
197
193
  item.find('.emoji').each((_, emoji) => {
198
194
  emoji = $(emoji);
@@ -267,11 +263,12 @@ module.exports = async (ctx) => {
267
263
  if (!nodes.length) {
268
264
  return '';
269
265
  }
270
- let tag_media = '';
266
+ let tag_media_all = '';
271
267
  const pictureNodes = nodes.find('picture');
272
268
  const imgNodes = nodes.find('img');
273
269
  nodes.each((_, node) => {
274
270
  const $node = $(node);
271
+ let tag_media = '';
275
272
  if (node.attribs && node.attribs.class && node.attribs.class.search(/(^|\s)tgme_widget_message_video_player(\s|$)/) !== -1) {
276
273
  // video
277
274
  const videoLink = $node.find('.tgme_widget_message_video').attr('src');
@@ -306,13 +303,11 @@ module.exports = async (ctx) => {
306
303
  });
307
304
  tag_media += '</picture>';
308
305
  });
309
- return tag_media;
310
306
  } else if (imgNodes.length) {
311
307
  // service message
312
308
  imgNodes.each((_, img) => {
313
309
  tag_media += $(img).toString();
314
310
  });
315
- return tag_media;
316
311
  } else {
317
312
  // image message, location
318
313
  const background = $node.css('background-image');
@@ -320,8 +315,12 @@ module.exports = async (ctx) => {
320
315
  const backgroundUrlSrc = backgroundUrl && backgroundUrl[1];
321
316
  tag_media += backgroundUrlSrc ? `<img src="${backgroundUrlSrc}">` : '';
322
317
  }
318
+ if (tag_media) {
319
+ tag_media_all += tag_media;
320
+ $node.find('.message_media_not_supported').remove();
321
+ }
323
322
  });
324
- return tag_media;
323
+ return tag_media_all;
325
324
  };
326
325
  // ordinary message photos, service message photos, stickers, animated stickers, video
327
326
  const messageMedia = generateMedia('.tgme_widget_message_photo_wrap,.tgme_widget_message_service_photo,.tgme_widget_message_sticker,.tgme_widget_message_tgsticker,.tgme_widget_message_video_player');
@@ -373,24 +372,6 @@ module.exports = async (ctx) => {
373
372
  }
374
373
  };
375
374
 
376
- /* unsupported */
377
- let unsupportedHtml = '';
378
- let unsupportedTitle = '';
379
- const unsupportedNodes = item.find('.message_media_not_supported');
380
- if (msgTypes.indexOf(UNSUPPORTED) !== -1 && unsupportedNodes.length) {
381
- unsupportedHtml += '<blockquote>';
382
- unsupportedNodes.find('.message_media_not_supported_label').each(function () {
383
- const $this = $(this);
384
- unsupportedTitle += $this.text();
385
- unsupportedHtml += `<p>${$this.text()}</p>`;
386
- });
387
- unsupportedNodes.find('.message_media_view_in_telegram').each(function () {
388
- const $this = $(this);
389
- unsupportedHtml += $this.attr('href') ? `<p><a href="${$this.attr('href')}">${$this.text()}</a></p>` : `<p>${$this.text()}</p>`;
390
- });
391
- unsupportedHtml += '</blockquote>';
392
- }
393
-
394
375
  /* link preview */
395
376
  const linkPreview = () => {
396
377
  const linkPreviewSiteObj = item.find('.link_preview_site_name');
@@ -492,11 +473,46 @@ module.exports = async (ctx) => {
492
473
  inlineButtons += '</tr></tbody></table>';
493
474
  }
494
475
 
476
+ /* unsupported */
477
+ let unsupportedHtml = '';
478
+ let unsupportedTitle = '';
479
+ const unsupportedNodes = item.find('.message_media_not_supported');
480
+ if (msgTypes.includes(UNSUPPORTED)) {
481
+ if (unsupportedNodes.length) {
482
+ unsupportedHtml += '<blockquote>';
483
+ unsupportedNodes.find('.message_media_not_supported_label').each(function () {
484
+ const $this = $(this);
485
+ unsupportedTitle += $this.text();
486
+ unsupportedHtml += `<p>${$this.text()}</p>`;
487
+ });
488
+ unsupportedNodes.find('.message_media_view_in_telegram').each(function () {
489
+ const $this = $(this);
490
+ unsupportedHtml += $this.attr('href') ? `<p><a href="${$this.attr('href')}">${$this.text()}</a></p>` : `<p>${$this.text()}</p>`;
491
+ });
492
+ unsupportedHtml += '</blockquote>';
493
+ } else {
494
+ // remove unsupported type, previous parsing has proved that it is not unsupported
495
+ msgTypes = msgTypes.filter((type) => type !== UNSUPPORTED);
496
+ }
497
+ }
498
+
495
499
  /* pubDate */
496
500
  const pubDate = parseDate(item.find('.tgme_widget_message_date time').attr('datetime'));
497
501
 
502
+ /* ----- finished parsing ----- */
503
+
504
+ /* media tag */
505
+ let mediaTag = '';
506
+ if (showMediaTagInTitle) {
507
+ msgTypes.forEach((type) => {
508
+ if (type !== REPLY || type !== FORWARDED || type !== VIA_BOT || (type === REPLY && showReplyTo) || (type === FORWARDED && showFwdFrom) || (type === VIA_BOT && showViaBot)) {
509
+ mediaTag += showMediaTagAsEmoji ? mediaTagDict[type][1] : mediaTagDict[type][0];
510
+ }
511
+ });
512
+ }
513
+
498
514
  /* message text & title */
499
- const messageTextObj = item.find('.tgme_widget_message_bubble > .tgme_widget_message_text');
515
+ const messageTextObj = item.find(`.${msgTypes.includes(PARTIALLY_UNSUPPORTED) ? 'media_supported_cont' : 'tgme_widget_message_bubble'} > .tgme_widget_message_text`);
500
516
  let messageHtml = '',
501
517
  messageTitle = '';
502
518
 
@@ -1,5 +1,7 @@
1
1
  module.exports = {
2
2
  '/cloud/column/:id?/:tag?': ['nczitzk'],
3
+ '/news/coronavirus/data/:province?/:city?': ['CaoMeiYouRen'],
4
+ '/news/coronavirus/total': ['CaoMeiYouRen'],
3
5
  '/pvp/newsindex/:type': ['Jeason0228', 'HenryQW'],
4
6
  '/qq/sdk/changelog/:platform': ['nuomi1'],
5
7
  };