rsshub 1.0.0-master.fc5a2f6 → 1.0.0-master.fc648b5

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 (292) hide show
  1. package/lib/config.js +4 -0
  2. package/lib/middleware/anti-hotlink.js +90 -22
  3. package/lib/middleware/parameter.js +65 -32
  4. package/lib/middleware/templates/iframe.art +14 -0
  5. package/lib/radar-rules.js +0 -92
  6. package/lib/router.js +22 -22
  7. package/lib/routes/agefans/update.js +1 -1
  8. package/lib/routes/novel/biqugeinfo.js +2 -2
  9. package/lib/routes/universities/uestc/sice.js +12 -33
  10. package/lib/routes/weibo/user.js +10 -19
  11. package/lib/v2/19lou/index.js +74 -0
  12. package/lib/v2/19lou/maintainer.js +3 -0
  13. package/lib/v2/19lou/radar.js +29 -0
  14. package/lib/v2/19lou/router.js +3 -0
  15. package/lib/v2/36kr/router.js +1 -1
  16. package/lib/v2/36kr/user.js +47 -22
  17. package/lib/v2/acfun/article.js +100 -0
  18. package/lib/{routes → v2}/acfun/bangumi.js +7 -7
  19. package/lib/v2/acfun/maintainer.js +5 -0
  20. package/lib/v2/acfun/radar.js +25 -0
  21. package/lib/v2/acfun/router.js +5 -0
  22. package/lib/v2/acfun/video.js +45 -0
  23. package/lib/v2/agora0/index.js +54 -0
  24. package/lib/v2/agora0/maintainer.js +3 -0
  25. package/lib/v2/agora0/radar.js +13 -0
  26. package/lib/v2/agora0/router.js +3 -0
  27. package/lib/v2/apnews/maintainer.js +3 -0
  28. package/lib/v2/apnews/radar.js +13 -0
  29. package/lib/v2/apnews/router.js +3 -0
  30. package/lib/v2/apnews/templates/description.art +14 -0
  31. package/lib/v2/apnews/topics.js +44 -0
  32. package/lib/v2/appleinsider/index.js +59 -0
  33. package/lib/v2/appleinsider/maintainer.js +3 -0
  34. package/lib/v2/appleinsider/radar.js +13 -0
  35. package/lib/v2/appleinsider/router.js +3 -0
  36. package/lib/v2/cbnweek/index.js +46 -0
  37. package/lib/v2/cbnweek/maintainer.js +3 -0
  38. package/lib/v2/cbnweek/radar.js +13 -0
  39. package/lib/v2/cbnweek/router.js +3 -0
  40. package/lib/v2/ccac/news.js +12 -3
  41. package/lib/v2/cde/index.js +2 -2
  42. package/lib/v2/cde/maintainer.js +1 -0
  43. package/lib/v2/cde/radar.js +22 -4
  44. package/lib/v2/cde/router.js +1 -0
  45. package/lib/v2/cde/templates/xxgk/breakthroughCure.art +18 -0
  46. package/lib/v2/cde/templates/xxgk/cliniCal.art +16 -0
  47. package/lib/v2/cde/templates/xxgk/priorityApproval.art +18 -0
  48. package/lib/v2/cde/utils.js +2 -2
  49. package/lib/v2/cde/xxgk.js +73 -0
  50. package/lib/v2/chinadegrees/maintainer.js +3 -0
  51. package/lib/v2/chinadegrees/province.js +66 -0
  52. package/lib/v2/chinadegrees/radar.js +13 -0
  53. package/lib/v2/chinadegrees/router.js +3 -0
  54. package/lib/v2/chinadegrees/templates/description.art +4 -0
  55. package/lib/v2/cnjxol/index.js +94 -0
  56. package/lib/v2/cnjxol/maintainer.js +4 -0
  57. package/lib/v2/cnjxol/radar.js +19 -0
  58. package/lib/v2/cnjxol/router.js +3 -0
  59. package/lib/v2/cnjxol/templates/description.art +2 -0
  60. package/lib/v2/cscse/maintainer.js +3 -0
  61. package/lib/v2/cscse/radar.js +13 -0
  62. package/lib/v2/cscse/router.js +3 -0
  63. package/lib/v2/cscse/tzgg.js +54 -0
  64. package/lib/v2/dgjyw/index.js +67 -0
  65. package/lib/v2/dgjyw/maintainer.js +3 -0
  66. package/lib/v2/dgjyw/radar.js +13 -0
  67. package/lib/v2/dgjyw/router.js +3 -0
  68. package/lib/v2/domp4/detail.js +67 -0
  69. package/lib/v2/domp4/latest.js +31 -0
  70. package/lib/v2/domp4/maintainer.js +4 -0
  71. package/lib/v2/domp4/radar.js +25 -0
  72. package/lib/v2/domp4/router.js +4 -0
  73. package/lib/v2/domp4/utils.js +72 -0
  74. package/lib/v2/douyin/hashtag.js +5 -43
  75. package/lib/v2/douyin/live.js +68 -0
  76. package/lib/v2/douyin/maintainer.js +2 -0
  77. package/lib/v2/douyin/radar.js +8 -0
  78. package/lib/v2/douyin/router.js +1 -0
  79. package/lib/v2/douyin/user.js +5 -43
  80. package/lib/v2/douyin/utils.js +50 -0
  81. package/lib/v2/economist/full.js +6 -4
  82. package/lib/v2/elsevier/issue.js +62 -0
  83. package/lib/v2/elsevier/journal.js +72 -0
  84. package/lib/v2/elsevier/maintainer.js +2 -2
  85. package/lib/v2/elsevier/radar.js +5 -5
  86. package/lib/v2/elsevier/router.js +4 -2
  87. package/lib/v2/elsevier/templates/description.art +5 -5
  88. package/lib/v2/gov/beijing/jw/tzgg.js +58 -0
  89. package/lib/v2/gov/customs/list.js +21 -17
  90. package/lib/v2/gov/customs/utils.js +9 -5
  91. package/lib/v2/gov/maintainer.js +3 -0
  92. package/lib/v2/gov/nmpa/generic.js +76 -0
  93. package/lib/v2/gov/pbc/goutongjiaoliu.js +20 -15
  94. package/lib/v2/gov/pbc/tradeAnnouncement.js +18 -14
  95. package/lib/v2/gov/radar.js +57 -27
  96. package/lib/v2/gov/router.js +3 -0
  97. package/lib/v2/gov/xuzhou/hrss.js +54 -0
  98. package/lib/v2/hackertalk/index.js +23 -0
  99. package/lib/v2/hackertalk/maintainer.js +3 -0
  100. package/lib/v2/hackertalk/radar.js +13 -0
  101. package/lib/v2/hackertalk/router.js +3 -0
  102. package/lib/v2/hashnode/blog.js +62 -0
  103. package/lib/v2/hashnode/maintainer.js +3 -0
  104. package/lib/v2/hashnode/radar.js +13 -0
  105. package/lib/v2/hashnode/router.js +3 -0
  106. package/lib/v2/hashnode/templates/description.art +2 -0
  107. package/lib/v2/hdu/cs/{index.js → notice.js} +1 -4
  108. package/lib/v2/hdu/cs/pg.js +54 -0
  109. package/lib/v2/hdu/maintainer.js +1 -0
  110. package/lib/v2/hdu/radar.js +6 -0
  111. package/lib/v2/hdu/router.js +2 -1
  112. package/lib/v2/heu/gx/list.js +2 -2
  113. package/lib/v2/heu/job/list.js +2 -2
  114. package/lib/v2/heu/uae/list.js +2 -2
  115. package/lib/v2/heu/yjsy/list.js +2 -2
  116. package/lib/v2/hk01/channel.js +40 -0
  117. package/lib/{routes → v2}/hk01/hot.js +2 -1
  118. package/lib/v2/hk01/issue.js +41 -0
  119. package/lib/v2/hk01/maintainer.js +7 -0
  120. package/lib/v2/hk01/radar.js +37 -0
  121. package/lib/v2/hk01/router.js +7 -0
  122. package/lib/{routes → v2}/hk01/tag.js +2 -1
  123. package/lib/{routes → v2}/hk01/zone.js +3 -2
  124. package/lib/v2/hotukdeals/index.js +1 -1
  125. package/lib/v2/ieee/journal.js +78 -0
  126. package/lib/v2/ieee/maintainer.js +2 -2
  127. package/lib/v2/ieee/radar.js +4 -4
  128. package/lib/v2/ieee/{latestdate.js → recent.js} +34 -42
  129. package/lib/v2/ieee/router.js +4 -2
  130. package/lib/v2/ieee/templates/description.art +5 -5
  131. package/lib/v2/ielts/index.js +7 -2
  132. package/lib/v2/keep/maintainer.js +3 -0
  133. package/lib/v2/keep/radar.js +13 -0
  134. package/lib/v2/keep/router.js +3 -0
  135. package/lib/v2/keep/templates/user.art +16 -0
  136. package/lib/{routes → v2}/keep/user.js +14 -4
  137. package/lib/v2/mdpi/journal.js +65 -0
  138. package/lib/v2/mdpi/maintainer.js +3 -0
  139. package/lib/v2/mdpi/radar.js +13 -0
  140. package/lib/v2/mdpi/router.js +3 -0
  141. package/lib/v2/mdpi/templates/description.art +12 -0
  142. package/lib/v2/mindmeister/example.js +44 -0
  143. package/lib/v2/mindmeister/maintainer.js +3 -0
  144. package/lib/v2/mindmeister/radar.js +13 -0
  145. package/lib/v2/mindmeister/router.js +3 -0
  146. package/lib/v2/mindmeister/templates/image.art +1 -0
  147. package/lib/v2/mirror/index.js +34 -0
  148. package/lib/v2/mirror/maintainer.js +3 -0
  149. package/lib/v2/mirror/radar.js +17 -0
  150. package/lib/v2/mirror/router.js +3 -0
  151. package/lib/v2/nbd/radar.js +2 -2
  152. package/lib/v2/ncwu/maintainer.js +3 -0
  153. package/lib/v2/ncwu/notice.js +27 -0
  154. package/lib/v2/ncwu/radar.js +13 -0
  155. package/lib/v2/ncwu/router.js +3 -0
  156. package/lib/v2/netease/exclusive.js +148 -0
  157. package/lib/v2/netease/maintainer.js +1 -0
  158. package/lib/v2/netease/radar.js +8 -0
  159. package/lib/v2/netease/router.js +1 -0
  160. package/lib/v2/netease/templates/exclusive.art +11 -0
  161. package/lib/v2/nju/rczp.js +34 -24
  162. package/lib/v2/njust/utils.js +4 -0
  163. package/lib/v2/nuaa/utils/pypasswaf.js +4 -5
  164. package/lib/v2/nyaa/maintainer.js +4 -0
  165. package/lib/v2/nyaa/radar.js +32 -0
  166. package/lib/v2/nyaa/router.js +4 -0
  167. package/lib/{routes → v2}/nyaa/search.js +4 -2
  168. package/lib/v2/nytimes/daily_briefing_chinese.js +47 -41
  169. package/lib/v2/nytimes/index.js +3 -3
  170. package/lib/v2/nytimes/maintainer.js +1 -1
  171. package/lib/v2/nytimes/templates/image.art +3 -0
  172. package/lib/v2/nytimes/utils.js +7 -1
  173. package/lib/v2/oceanengine/arithmeticIndex.js +145 -0
  174. package/lib/v2/oceanengine/maintainer.js +3 -0
  175. package/lib/v2/oceanengine/radar.js +13 -0
  176. package/lib/v2/oceanengine/router.js +3 -0
  177. package/lib/v2/oceanengine/templates/content.art +14 -0
  178. package/lib/v2/openwrt/maintainer.js +3 -0
  179. package/lib/v2/openwrt/radar.js +13 -0
  180. package/lib/v2/openwrt/releases.js +25 -0
  181. package/lib/v2/openwrt/router.js +3 -0
  182. package/lib/v2/pincong/utils.js +7 -1
  183. package/lib/v2/pku/maintainer.js +3 -0
  184. package/lib/v2/pku/radar.js +20 -0
  185. package/lib/v2/pku/router.js +3 -0
  186. package/lib/v2/pku/ss/admission.js +53 -0
  187. package/lib/v2/pku/ss/notice.js +53 -0
  188. package/lib/v2/pku/ss/pg_admin.js +53 -0
  189. package/lib/v2/prestige-av/maintainer.js +3 -0
  190. package/lib/v2/prestige-av/radar.js +18 -0
  191. package/lib/v2/prestige-av/router.js +3 -0
  192. package/lib/{routes → v2}/prestige-av/series.js +8 -5
  193. package/lib/v2/qq/kg/cache.js +28 -0
  194. package/lib/v2/qq/kg/reply.js +21 -0
  195. package/lib/v2/qq/kg/user.js +50 -0
  196. package/lib/v2/qq/maintainer.js +2 -0
  197. package/lib/v2/qq/radar.js +14 -0
  198. package/lib/v2/qq/router.js +2 -0
  199. package/lib/v2/samsung/maintainer.js +3 -0
  200. package/lib/v2/samsung/radar.js +13 -0
  201. package/lib/v2/samsung/research/blog.js +49 -0
  202. package/lib/v2/samsung/router.js +3 -0
  203. package/lib/v2/{jasa/latest.js → scitation/journal.js} +24 -27
  204. package/lib/v2/scitation/maintainer.js +4 -0
  205. package/lib/v2/scitation/radar.js +19 -0
  206. package/lib/v2/scitation/router.js +4 -0
  207. package/lib/v2/scitation/section.js +90 -0
  208. package/lib/v2/scitation/templates/description.art +11 -0
  209. package/lib/v2/shuiguopai/index.js +76 -0
  210. package/lib/v2/shuiguopai/maintainer.js +3 -0
  211. package/lib/v2/shuiguopai/radar.js +13 -0
  212. package/lib/v2/shuiguopai/router.js +3 -0
  213. package/lib/v2/shuiguopai/templates/description.art +6 -0
  214. package/lib/v2/springer/journal.js +72 -0
  215. package/lib/v2/springer/maintainer.js +3 -0
  216. package/lib/v2/springer/radar.js +13 -0
  217. package/lib/v2/springer/router.js +3 -0
  218. package/lib/v2/springer/templates/description.art +12 -0
  219. package/lib/v2/supchina/index.js +67 -0
  220. package/lib/v2/supchina/maintainer.js +4 -0
  221. package/lib/v2/supchina/podcasts.js +66 -0
  222. package/lib/v2/supchina/radar.js +19 -0
  223. package/lib/v2/supchina/router.js +4 -0
  224. package/lib/v2/techflow520/index.js +34 -0
  225. package/lib/v2/techflow520/maintainer.js +4 -0
  226. package/lib/v2/techflow520/newsflash.js +32 -0
  227. package/lib/v2/techflow520/radar.js +19 -0
  228. package/lib/v2/techflow520/router.js +4 -0
  229. package/lib/v2/tencent/cloud/column.js +51 -0
  230. package/lib/v2/tencent/maintainer.js +1 -0
  231. package/lib/v2/tencent/radar.js +11 -0
  232. package/lib/v2/tencent/router.js +1 -0
  233. package/lib/v2/test/index.js +16 -1
  234. package/lib/v2/tiktok/user.js +28 -38
  235. package/lib/v2/trending/allTrending.js +169 -0
  236. package/lib/v2/trending/maintainer.js +3 -0
  237. package/lib/v2/trending/radar.js +35 -0
  238. package/lib/v2/trending/router.js +3 -0
  239. package/lib/v2/trending/templates/content.art +24 -0
  240. package/lib/v2/u3c3/index.js +59 -0
  241. package/lib/v2/u3c3/maintainer.js +3 -0
  242. package/lib/v2/u3c3/radar.js +29 -0
  243. package/lib/v2/u3c3/router.js +3 -0
  244. package/lib/v2/uraaka-joshi/uraaka-joshi-user.js +7 -1
  245. package/lib/v2/uraaka-joshi/uraaka-joshi.js +8 -1
  246. package/lib/v2/vlive/index.js +71 -0
  247. package/lib/v2/vlive/maintainer.js +3 -0
  248. package/lib/v2/vlive/radar.js +13 -0
  249. package/lib/v2/vlive/router.js +3 -0
  250. package/lib/v2/vlive/templates/post.art +8 -0
  251. package/lib/v2/vlive/templates/video.art +3 -0
  252. package/lib/v2/xiaohongshu/util.js +6 -6
  253. package/lib/v2/xjtu/2yuan/news.js +61 -0
  254. package/lib/v2/xjtu/dean.js +83 -0
  255. package/lib/{routes/universities → v2}/xjtu/ee.js +5 -5
  256. package/lib/{routes/universities → v2}/xjtu/gs/tzgg.js +6 -6
  257. package/lib/v2/xjtu/international.js +51 -0
  258. package/lib/v2/xjtu/job.js +81 -0
  259. package/lib/v2/xjtu/maintainer.js +9 -0
  260. package/lib/v2/xjtu/radar.js +53 -0
  261. package/lib/v2/xjtu/router.js +9 -0
  262. package/lib/v2/xjtu/std.js +58 -0
  263. package/lib/v2/xjtu/templates/attachments.art +3 -0
  264. package/lib/v2/xjtu/templates/std.art +4 -0
  265. package/lib/v2/xueqiu/column.js +42 -0
  266. package/lib/v2/xueqiu/maintainer.js +1 -0
  267. package/lib/v2/xueqiu/radar.js +6 -0
  268. package/lib/v2/xueqiu/router.js +1 -0
  269. package/lib/v2/zhangyoubao/index.js +42 -0
  270. package/lib/v2/zhangyoubao/maintainer.js +3 -0
  271. package/lib/v2/zhangyoubao/radar.js +13 -0
  272. package/lib/v2/zhangyoubao/router.js +3 -0
  273. package/lib/v2/zhangyoubao/templates/article.art +1 -0
  274. package/package.json +20 -19
  275. package/lib/routes/acfun/video.js +0 -44
  276. package/lib/routes/apnews/topics.js +0 -43
  277. package/lib/routes/dgjyw/index.js +0 -66
  278. package/lib/routes/hk01/channel.js +0 -22
  279. package/lib/routes/hk01/issue.js +0 -22
  280. package/lib/routes/mirror/entries.js +0 -80
  281. package/lib/routes/universities/ncwu/notice.js +0 -42
  282. package/lib/routes/universities/xjtu/dean.js +0 -86
  283. package/lib/routes/universities/xjtu/international.js +0 -53
  284. package/lib/routes/universities/xjtu/job.js +0 -50
  285. package/lib/v2/elsevier/latest.js +0 -87
  286. package/lib/v2/elsevier/volume.js +0 -75
  287. package/lib/v2/ieee/latestvol.js +0 -87
  288. package/lib/v2/jasa/maintainer.js +0 -4
  289. package/lib/v2/jasa/radar.js +0 -19
  290. package/lib/v2/jasa/router.js +0 -4
  291. package/lib/v2/jasa/section.js +0 -95
  292. package/lib/v2/jasa/templates/description.art +0 -11
@@ -1,61 +1,67 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
3
  const { parseDate } = require('@/utils/parse-date');
4
+ const { art } = require('@/utils/render');
5
+ const path = require('path');
4
6
 
5
7
  module.exports = async (ctx) => {
6
- const url = 'https://www.nytimes.com/zh-hans/series/daily-briefing-chinese';
8
+ const rootUrl = 'https://www.nytimes.com';
9
+ const currentUrl = `${rootUrl}/zh-hans/series/daily-briefing-chinese`;
10
+
7
11
  const response = await got({
8
12
  method: 'get',
9
- url,
13
+ url: currentUrl,
14
+ });
15
+
16
+ const listData = JSON.parse(response.data.match(/"initialState":(.*),"config"/)[1]);
17
+
18
+ let items = [];
19
+ Object.keys(listData).forEach((key) => {
20
+ if (/^Article:/.test(key) && listData[key].url) {
21
+ const item = listData[key];
22
+ items.push({
23
+ link: item.url,
24
+ pubDate: parseDate(item.firstPublished),
25
+ });
26
+ }
10
27
  });
11
- const data = response.data;
12
- const $ = cheerio.load(data);
13
- const post = $('.css-13mho3u .css-ye6x8s')
14
- .map((index, elem) => {
15
- const $item = $(elem);
16
- const $link = $item.find('a');
17
- const $title = $item.find('h2');
18
-
19
- return {
20
- title: $title.text(),
21
- link: 'https://www.nytimes.com' + $link.attr('href'),
22
- };
23
- })
24
- .get();
25
-
26
- const items = await Promise.all(
27
- post.map((item) =>
28
+
29
+ items = await Promise.all(
30
+ items.map((item) =>
28
31
  ctx.cache.tryGet(item.link, async () => {
29
- const response = await got.get(item.link);
30
- const data = response.data;
31
- const arr = data.match(/"url":"https:\\u002F\\u002Fstatic(\S*)"articleLarge"/g);
32
- const imageLink = arr.map((e) => JSON.parse(`{${e}}`).url);
33
-
34
- const $ = cheerio.load(data);
35
- $('.css-pncxxs.etfikam0').remove();
36
- // remove 'Credit...'
37
- $('.css-1ly73wi.e1tej78p0').remove();
38
- $('.css-1xdhyk6.erfvjey0').each((i, e) => $(e).replaceWith(`<img src="${imageLink[i]}">`));
39
-
40
- $('.css-1l44abu.ewdxa0s0').each((i, e) => {
41
- const figureNote = $(e)
42
- .children()
43
- .map((i, e) => $(e).text())
44
- .get();
45
- $(e).replaceWith(`<p><small>${figureNote.join(' ')}</small><p>`);
32
+ const detailResponse = await got({
33
+ method: 'get',
34
+ url: item.link,
46
35
  });
47
- const date = $('time').attr('datetime');
48
36
 
49
- item.description = $('.meteredContent.css-1r7ky0e').html();
50
- item.pubDate = parseDate(date);
37
+ const content = cheerio.load(detailResponse.data);
38
+
39
+ // to remove ads
40
+ content('.StoryBodyCompanionColumn').last().find('p').last().remove();
41
+
42
+ const images = detailResponse.data.match(/"url":"[^{}]+","name":"articleLarge"/g).map((e) => JSON.parse(`{${e}}`).url);
43
+
44
+ let i = 0;
45
+ content('figure').each(function () {
46
+ content(this).html(
47
+ art(path.join(__dirname, 'templates/image.art'), {
48
+ url: images[i++],
49
+ })
50
+ );
51
+ });
52
+
53
+ item.title = content('meta[property="og:title"]').attr('content');
54
+ item.author = content('meta[name="byl"]').attr('content').replace(/By /, '');
55
+ item.description = content('section[name="articleBody"]').html();
56
+
51
57
  return item;
52
58
  })
53
59
  )
54
60
  );
55
61
 
56
62
  ctx.state.data = {
57
- title: '纽约时报中文网|新闻简报',
58
- link: url,
63
+ title: '新闻简报 - The New York Times',
64
+ link: currentUrl,
59
65
  item: items,
60
66
  };
61
67
  };
@@ -38,7 +38,7 @@ module.exports = async (ctx) => {
38
38
 
39
39
  try {
40
40
  response = await ctx.cache.tryGet(`nyt: ${link}`, async () => {
41
- const response = await got.get(link);
41
+ const response = await got(link);
42
42
 
43
43
  return response.data;
44
44
  });
@@ -46,14 +46,14 @@ module.exports = async (ctx) => {
46
46
  dual = true;
47
47
  } catch (error) {
48
48
  response = await ctx.cache.tryGet(`nyt: ${item.link}`, async () => {
49
- const response = await got.get(item.link);
49
+ const response = await got(item.link);
50
50
 
51
51
  return response.data;
52
52
  });
53
53
  }
54
54
  } else {
55
55
  response = await ctx.cache.tryGet(`nyt: ${item.link}`, async () => {
56
- const response = await got.get(item.link);
56
+ const response = await got(item.link);
57
57
 
58
58
  return response.data;
59
59
  });
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  '/author/:byline': ['kevinschaul'],
3
3
  '/book/:category?': ['melvinto'],
4
- '/daily_briefing_chinese': ['yueyericardo'],
4
+ '/daily_briefing_chinese': ['yueyericardo', 'nczitzk'],
5
5
  '/:lang?': ['HenryQW'],
6
6
  };
@@ -0,0 +1,3 @@
1
+ <figure>
2
+ <img src="{{ url }}">
3
+ </figure>
@@ -16,7 +16,13 @@ const ProcessImage = ($, e) => {
16
16
  const PuppeterGetter = async (ctx, browser, link) => {
17
17
  const result = await ctx.cache.tryGet(`nyt: ${link}`, async () => {
18
18
  const page = await browser.newPage();
19
- await page.goto(link);
19
+ await page.setRequestInterception(true);
20
+ page.on('request', (request) => {
21
+ request.resourceType() === 'document' ? request.continue() : request.abort();
22
+ });
23
+ await page.goto(link, {
24
+ waitUntil: 'domcontentloaded',
25
+ });
20
26
  const response = await page.evaluate(() => document.querySelector('body').innerHTML);
21
27
  return response;
22
28
  });
@@ -0,0 +1,145 @@
1
+ const dayjs = require('dayjs');
2
+ const { art } = require('@/utils/render');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const timezone = require('@/utils/timezone');
5
+ const path = require('path');
6
+ const config = require('@/config').value;
7
+
8
+ // Parameters
9
+ const CACHE_MAX_AGE = config.cache.contentExpire;
10
+ const DEFAULT_FETCH_DURATION_MONTH = 6; // fetch data 6 month from now
11
+
12
+ // Fetch Data
13
+ const getMultiKeywordHotTrend = async (page, keyword, start_date, end_date, app_name = 'aweme') => {
14
+ const e = {
15
+ url: 'https://trendinsight.oceanengine.com/api/open/index/get_multi_keyword_hot_trend',
16
+ method: 'POST',
17
+ data: JSON.stringify({ keyword_list: [keyword], start_date, end_date, app_name }),
18
+ };
19
+
20
+ const res = await page.evaluate((e) => {
21
+ function queryData() {
22
+ const p = new Promise((resolve) => {
23
+ const req = new XMLHttpRequest();
24
+ req.open(e.method, e.url, true);
25
+ req.setRequestHeader('accept', 'application/json, text/plain, */*');
26
+ req.setRequestHeader('content-type', 'application/json;charset=UTF-8');
27
+ req.setRequestHeader('tea-uid', '7054893410171930123');
28
+ req.onreadystatechange = function () {
29
+ if (req.readyState === 4 && req.status === 200) {
30
+ resolve(req.responseText);
31
+ } else {
32
+ return;
33
+ }
34
+ };
35
+ req.send(e.data);
36
+ });
37
+ return p;
38
+ }
39
+ return Promise.all([queryData()]).then((result) => result);
40
+ }, e);
41
+ return res[0];
42
+ };
43
+
44
+ // Decrypt Data
45
+ const { createDecipheriv } = require('node:crypto');
46
+ const key = 'anN2bXA2NjYsamlh';
47
+ const iv = 'amlheW91LHFpYW53';
48
+ const algorithm = 'aes-128-cfb';
49
+ const decrypt = (rawData) => {
50
+ const encrypted = Buffer.from(rawData, 'base64').toString('hex');
51
+ const decipher = createDecipheriv(algorithm, key, iv);
52
+ const decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');
53
+ return JSON.parse(decrypted);
54
+ };
55
+
56
+ // Generate Feed
57
+ const searchLinkUrls = (keyword) => [
58
+ `https://tophub.today/search?e=tophub&q=${keyword}`,
59
+ `https://www.baidu.com/s?wd=${keyword}`,
60
+ `https://www.google.com/search?q=${keyword}`,
61
+ `https://m.zhihu.com/search?type=content&q=${keyword}`,
62
+ `https://s.weibo.com/weibo/${keyword}`,
63
+ `https://www.douyin.com/search/${keyword}`,
64
+ `https://so.toutiao.com/search?keyword=${keyword}`,
65
+ ];
66
+
67
+ const searchLinkNames = ['今日热榜', '百度', '谷歌', '知乎', '微博', '抖音', '头条'];
68
+
69
+ const createContent = (keyword, queryList, queryListText) =>
70
+ art(path.join(__dirname, 'templates', 'content.art'), {
71
+ keyword,
72
+ queryListText,
73
+ queries: queryList.map((query) => ({
74
+ links: searchLinkUrls(encodeURIComponent(query)).map((url, index) => `<a href="${url}" rel="noopener noreferrer" target="_blank">${searchLinkNames[index]}</a>`),
75
+ key: query,
76
+ })),
77
+ });
78
+
79
+ module.exports = async (ctx) => {
80
+ const now = dayjs();
81
+ const start_date = now.subtract(DEFAULT_FETCH_DURATION_MONTH, 'month').format('YYYYMMDD');
82
+ const end_date = now.format('YYYYMMDD');
83
+ const keyword = ctx.params.keyword;
84
+ if (!keyword) {
85
+ throw Error('Invalid keyword');
86
+ }
87
+ if (ctx.params.channel && !['douyin', 'toutiao'].includes(ctx.params.channel)) {
88
+ throw Error('Invalid channel。 Only support `douyin` or `toutiao`');
89
+ }
90
+
91
+ const channel = ctx.params.channel === 'toutiao' ? 'toutiao' : 'aweme'; // default channel is `douyin`
92
+ const channelName = ctx.params.channel === 'toutiao' ? '头条' : '抖音';
93
+
94
+ const link = `https://trendinsight.oceanengine.com/arithmetic-index/analysis?keyword=${keyword}&appName=${channel}`;
95
+
96
+ const item = await ctx.cache.tryGet(
97
+ link,
98
+ async () => {
99
+ const browser = await require('@/utils/puppeteer')();
100
+ const page = await browser.newPage();
101
+ await page.setRequestInterception(true);
102
+ page.on('request', (request) => {
103
+ request.resourceType() === 'document' || request.resourceType() === 'script' || request.resourceType() === 'xhr' ? request.continue() : request.abort();
104
+ });
105
+ await page.goto('https://trendinsight.oceanengine.com/arithmetic-index');
106
+ const res = await getMultiKeywordHotTrend(page, keyword, start_date, end_date, channel);
107
+ browser.close();
108
+
109
+ const rawData = JSON.parse(res).data;
110
+ const data = decrypt(rawData).hot_list[0];
111
+
112
+ const searchAverage = parseInt(data.average.search_average);
113
+
114
+ return data.search_top_point_list.map(({ date, query_list }) => {
115
+ const searchIndex = parseInt(data.search_hot_list.find((listItem) => listItem.datetime === date).index);
116
+ const relativePercent = Math.round(((searchIndex - searchAverage) / searchAverage) * 100);
117
+ const icon = relativePercent > 0 ? '📈' : '📉';
118
+
119
+ const uniqueQueryList = query_list.filter((query) => query !== keyword);
120
+ const uniqueQueryListStr = uniqueQueryList.join(', ');
121
+
122
+ const content = createContent(keyword, [keyword, ...uniqueQueryList], uniqueQueryListStr);
123
+
124
+ return {
125
+ title: `${icon} ${keyword} ${relativePercent}% | ${uniqueQueryListStr}`,
126
+ author: `巨量算数 - ${channelName}算数指数`,
127
+ description: content,
128
+ link,
129
+ pubDate: timezone(parseDate(date), +8),
130
+ guid: `巨量算数 - ${channelName}算数指数 | ${keyword} - ${date}`,
131
+ };
132
+ });
133
+ },
134
+ CACHE_MAX_AGE,
135
+ false
136
+ );
137
+
138
+ ctx.state.data = {
139
+ title: `${keyword} - ${channelName}指数波峰`,
140
+ link,
141
+ description: `巨量算数 - ${channelName}算数指数 | 关键词: ${keyword}`,
142
+ language: 'zh-cn',
143
+ item,
144
+ };
145
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/index/:keyword/:channel?': ['Jkker'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'oceanengine.com': {
3
+ _name: '巨量算数',
4
+ trendinsight: [
5
+ {
6
+ title: '抖音/头条指数波峰',
7
+ docs: 'https://docs.rsshub.app/other.html#ju-liang-suan-shu-suan-shu-zhi-shu',
8
+ source: ['/arithmetic-index/analysis'],
9
+ target: (params, url) => `/oceanengine/index/${new URL(url).searchParams.get('keyword')}`,
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/index/:keyword/:channel?', require('./arithmeticIndex'));
3
+ };
@@ -0,0 +1,14 @@
1
+ <article>
2
+ <h2>关键词: </h2>
3
+ {{queryListText}}
4
+ &nbsp&nbsp&nbsp&nbsp&nbsp
5
+ <br>
6
+ {{each queries q}}
7
+ <h2>{{q.key}}</h2>
8
+ <p>
9
+ {{each q.links l}}
10
+ {{@l}}&nbsp&nbsp
11
+ {{/each}}
12
+ </p>
13
+ {{/each}}
14
+ </article>
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/releases/:model?': ['DIYgod'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'openwrt.org': {
3
+ _name: 'Openwrt',
4
+ '.': [
5
+ {
6
+ title: 'Model Releases',
7
+ docs: 'https://docs.rsshub.app/program-update.html#openwrt',
8
+ source: '/toh/:band/:model',
9
+ target: '/openwrt/releases/:model',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,25 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+
4
+ module.exports = async (ctx) => {
5
+ const brand = ctx.params.brand;
6
+ const model = ctx.params.model;
7
+ const url = `https://openwrt.org/toh/${brand}/${model}`;
8
+ const response = await got(url);
9
+ const $ = cheerio.load(response.data);
10
+ const table = $('#installation').next();
11
+
12
+ ctx.state.data = {
13
+ title: $('h1').text() + ' - OpenWrt Releases',
14
+ link: url,
15
+ description: $('.dw-content div.level1').text(),
16
+ language: 'en-US',
17
+ item: [
18
+ {
19
+ title: table.find('.supported_current_rel').text(),
20
+ link: url,
21
+ description: `Firmware OpenWrt Install: ${table.find('.firmware_openwrt_install_url').html()}<br><br>Firmware OpenWrt Upgrade: ${$('.firmware_openwrt_upgrade_url').html()}'`,
22
+ },
23
+ ],
24
+ };
25
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = function (router) {
2
+ router.get('/releases/:brand/:model', require('./releases'));
3
+ };
@@ -4,7 +4,13 @@ const puppeteerGet = (url, cache) =>
4
4
  cache.tryGet(url, async () => {
5
5
  const browser = await require('@/utils/puppeteer')();
6
6
  const page = await browser.newPage();
7
- await page.goto(url);
7
+ await page.setRequestInterception(true);
8
+ page.on('request', (request) => {
9
+ request.resourceType() === 'document' ? request.continue() : request.abort();
10
+ });
11
+ await page.goto(url, {
12
+ waitUntil: 'domcontentloaded',
13
+ });
8
14
  const html = await page.evaluate(() => document.documentElement.innerHTML);
9
15
  browser.close();
10
16
  return html;
@@ -7,4 +7,7 @@ module.exports = {
7
7
  '/nsd/gd': ['MisLink'],
8
8
  '/rccp/mzyt': ['vhxubo'],
9
9
  '/scc/recruit/:type?': ['DylanXie123'],
10
+ '/ss/notice': ['legr4ndk'],
11
+ '/ss/admission': ['legr4ndk'],
12
+ '/ss/pgadmin': ['legr4ndk'],
10
13
  };
@@ -126,5 +126,25 @@ module.exports = {
126
126
  },
127
127
  },
128
128
  ],
129
+ ss: [
130
+ {
131
+ title: '软微-通知公告',
132
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
133
+ source: ['/index.php/newscenter/notice', '/'],
134
+ target: '/pku/ss/notice',
135
+ },
136
+ {
137
+ title: '软微-招生通知',
138
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
139
+ source: ['/admission/admnotice', '/'],
140
+ target: '/pku/ss/admission',
141
+ },
142
+ {
143
+ title: '软微-硕士统考招生',
144
+ docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
145
+ source: ['/admission/admbrochure/admission01', '/'],
146
+ target: '/pku/ss/pgadmin',
147
+ },
148
+ ],
129
149
  },
130
150
  };
@@ -7,4 +7,7 @@ module.exports = function (router) {
7
7
  router.get('/nsd/gd', require('./nsd'));
8
8
  router.get('/rccp/mzyt', require('./rccp/mzyt'));
9
9
  router.get('/scc/recruit/:type?', require('./scc/recruit'));
10
+ router.get('/ss/notice', require('./ss/notice.js'));
11
+ router.get('/ss/admission', require('./ss/admission.js'));
12
+ router.get('/ss/pgadmin', require('./ss/pg_admin.js'));
10
13
  };
@@ -0,0 +1,53 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ const link = 'http://www.ss.pku.edu.cn';
6
+ const host = 'http://www.ss.pku.edu.cn/index.php/admission/admnotice';
7
+
8
+ const getSingleRecord = async () => {
9
+ const res = await got(host);
10
+
11
+ const $ = cheerio.load(res.data);
12
+ const list = $('#info-list-ul').find('li');
13
+
14
+ return (
15
+ list &&
16
+ list
17
+ .map((index, item) => {
18
+ item = $(item);
19
+ const date = item.find('.time').text();
20
+ return {
21
+ title: item.find('a').attr('title'),
22
+ pubDate: parseDate(date),
23
+ link: link + item.find('a').attr('href'),
24
+ };
25
+ })
26
+ .get()
27
+ );
28
+ };
29
+
30
+ module.exports = async (ctx) => {
31
+ const items = await getSingleRecord();
32
+ const out = await Promise.all(
33
+ items.map((item) =>
34
+ ctx.cache.tryGet(item.link, async () => {
35
+ const response = await got(item.link);
36
+ const $ = cheerio.load(response.data);
37
+ return {
38
+ title: item.title,
39
+ link: item.link,
40
+ description: $('.article-content').html(),
41
+ pubDate: item.pubDate,
42
+ };
43
+ })
44
+ )
45
+ );
46
+
47
+ ctx.state.data = {
48
+ title: '北大软微-招生通知',
49
+ description: '北京大学软件与微电子学院 - 招生通知',
50
+ link: host,
51
+ item: out,
52
+ };
53
+ };
@@ -0,0 +1,53 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ const link = 'http://www.ss.pku.edu.cn';
6
+ const host = 'http://www.ss.pku.edu.cn/index.php/newscenter/notice';
7
+
8
+ const getSingleRecord = async () => {
9
+ const res = await got(host);
10
+
11
+ const $ = cheerio.load(res.data);
12
+ const list = $('#info-list-ul').find('li');
13
+
14
+ return (
15
+ list &&
16
+ list
17
+ .map((index, item) => {
18
+ item = $(item);
19
+ const date = item.find('.time').text();
20
+ return {
21
+ title: item.find('a').attr('title'),
22
+ pubDate: parseDate(date),
23
+ link: link + item.find('a').attr('href'),
24
+ };
25
+ })
26
+ .get()
27
+ );
28
+ };
29
+
30
+ module.exports = async (ctx) => {
31
+ const items = await getSingleRecord();
32
+ const out = await Promise.all(
33
+ items.map((item) =>
34
+ ctx.cache.tryGet(item.link, async () => {
35
+ const response = await got(item.link);
36
+ const $ = cheerio.load(response.data);
37
+ return {
38
+ title: item.title,
39
+ link: item.link,
40
+ description: $('.article-content').html(),
41
+ pubDate: item.pubDate,
42
+ };
43
+ })
44
+ )
45
+ );
46
+
47
+ ctx.state.data = {
48
+ title: '北大软微-通知公告',
49
+ description: '北京大学软件与微电子学院 - 通知公告',
50
+ link: host,
51
+ item: out,
52
+ };
53
+ };
@@ -0,0 +1,53 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ const link = 'http://www.ss.pku.edu.cn';
6
+ const host = 'http://www.ss.pku.edu.cn/index.php/admission/admbrochure/admission01';
7
+
8
+ const getSingleRecord = async () => {
9
+ const res = await got(host);
10
+
11
+ const $ = cheerio.load(res.data);
12
+ const list = $('#info-list-ul').find('li');
13
+
14
+ return (
15
+ list &&
16
+ list
17
+ .map((index, item) => {
18
+ item = $(item);
19
+ const date = item.find('.time').text();
20
+ return {
21
+ title: item.find('a').attr('title'),
22
+ pubDate: parseDate(date),
23
+ link: link + item.find('a').attr('href'),
24
+ };
25
+ })
26
+ .get()
27
+ );
28
+ };
29
+
30
+ module.exports = async (ctx) => {
31
+ const items = await getSingleRecord();
32
+ const out = await Promise.all(
33
+ items.map((item) =>
34
+ ctx.cache.tryGet(item.link, async () => {
35
+ const response = await got(item.link);
36
+ const $ = cheerio.load(response.data);
37
+ return {
38
+ title: item.title,
39
+ link: item.link,
40
+ description: $('.article-content').html(),
41
+ pubDate: item.pubDate,
42
+ };
43
+ })
44
+ )
45
+ );
46
+
47
+ ctx.state.data = {
48
+ title: '北大软微-硕士统考招生',
49
+ description: '北京大学软件与微电子学院 - 硕士统考招生通知',
50
+ link: host,
51
+ item: out,
52
+ };
53
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/series/:mid/:sort?': ['minimalistrojan'],
3
+ };
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ 'prestige-av.com': {
3
+ _name: 'Prestige 蚊香社',
4
+ '.': [
5
+ {
6
+ title: '系列作品',
7
+ docs: 'https://docs.rsshub.app/multimedia.html#prestige-wen-xiang-she',
8
+ source: ['/goods/goods_list.php'],
9
+ target: (_params, url) => {
10
+ const link = new URL(url);
11
+ if (link.searchParams.get('mode') === 'series') {
12
+ return link.searchParams.has('sort') ? `/prestige-av/series/${link.searchParams.get('mid')}/${link.searchParams.get('sort')}` : `/prestige-av/series/${link.searchParams.get('mid')}`;
13
+ }
14
+ },
15
+ },
16
+ ],
17
+ },
18
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/series/:mid/:sort?', require('./series'));
3
+ };