rsshub 1.0.0-master.f97cdb2 → 1.0.0-master.fa3428f

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 (237) hide show
  1. package/README.md +1 -1
  2. package/lib/config.js +3 -1
  3. package/lib/radar-rules.js +0 -92
  4. package/lib/router.js +68 -71
  5. package/lib/routes/tencent/wechat/miniprogram/framework.js +4 -2
  6. package/lib/utils/common-config.js +4 -0
  7. package/lib/utils/parse-date.js +8 -7
  8. package/lib/utils/rand-user-agent.js +29 -0
  9. package/lib/utils/request-wrapper.js +2 -5
  10. package/lib/utils/wechat-mp.js +106 -10
  11. package/lib/v2/agirls/index.js +6 -0
  12. package/lib/v2/bilibili/video.js +1 -0
  13. package/lib/v2/bookfere/category.js +36 -0
  14. package/lib/v2/bookfere/maintainer.js +3 -0
  15. package/lib/v2/bookfere/radar.js +11 -0
  16. package/lib/v2/bookfere/router.js +3 -0
  17. package/lib/v2/cankaoxiaoxi/index.js +81 -0
  18. package/lib/v2/cankaoxiaoxi/maintainer.js +3 -0
  19. package/lib/v2/cankaoxiaoxi/radar.js +61 -0
  20. package/lib/v2/cankaoxiaoxi/router.js +3 -0
  21. package/lib/{routes → v2}/cctv/category.js +1 -1
  22. package/lib/{routes → v2}/cctv/jx.js +6 -1
  23. package/lib/{routes → v2}/cctv/lm.js +1 -1
  24. package/lib/v2/cctv/maintainer.js +7 -0
  25. package/lib/v2/cctv/radar.js +41 -0
  26. package/lib/v2/cctv/router.js +7 -0
  27. package/lib/{routes → v2}/cctv/special.js +6 -4
  28. package/lib/{routes → v2}/cctv/utils/mzzlbg.js +8 -6
  29. package/lib/{routes → v2}/cctv/utils/news.js +25 -22
  30. package/lib/{routes → v2}/cctv/utils/xinwen1j1.js +20 -17
  31. package/lib/v2/cctv/xwlb.js +50 -0
  32. package/lib/v2/chinacef/experts.js +38 -0
  33. package/lib/v2/chinacef/hot.js +38 -0
  34. package/lib/v2/chinacef/index.js +39 -0
  35. package/lib/v2/chinacef/maintainer.js +5 -0
  36. package/lib/v2/chinacef/radar.js +25 -0
  37. package/lib/v2/chinacef/router.js +5 -0
  38. package/lib/v2/{wechat → chinacef}/templates/description.art +0 -0
  39. package/lib/v2/chinacef/utils.js +55 -0
  40. package/lib/v2/chinanews/index.js +65 -0
  41. package/lib/v2/chinanews/maintainer.js +3 -0
  42. package/lib/v2/chinanews/radar.js +13 -0
  43. package/lib/v2/chinanews/router.js +3 -0
  44. package/lib/v2/cnbeta/index.js +2 -1
  45. package/lib/v2/cnbeta/utils.js +1 -0
  46. package/lib/v2/dapenti/maintainer.js +4 -0
  47. package/lib/v2/dapenti/radar.js +27 -0
  48. package/lib/v2/dapenti/router.js +4 -0
  49. package/lib/{routes → v2}/dapenti/subject.js +1 -1
  50. package/lib/{routes → v2}/dapenti/tugua.js +1 -1
  51. package/lib/v2/dapenti/utils.js +75 -0
  52. package/lib/{routes → v2}/dongqiudi/daily.js +10 -13
  53. package/lib/v2/dongqiudi/maintainer.js +8 -0
  54. package/lib/{routes → v2}/dongqiudi/player_news.js +0 -0
  55. package/lib/v2/dongqiudi/radar.js +45 -0
  56. package/lib/{routes → v2}/dongqiudi/result.js +2 -1
  57. package/lib/v2/dongqiudi/router.js +8 -0
  58. package/lib/{routes → v2}/dongqiudi/special.js +0 -0
  59. package/lib/{routes → v2}/dongqiudi/team_news.js +0 -0
  60. package/lib/{routes → v2}/dongqiudi/top_news.js +12 -15
  61. package/lib/{routes → v2}/dongqiudi/utils.js +47 -28
  62. package/lib/v2/dut/defaults.js +53 -0
  63. package/lib/v2/dut/index.js +78 -0
  64. package/lib/v2/dut/maintainer.js +14 -0
  65. package/lib/v2/dut/radar.js +109 -0
  66. package/lib/v2/dut/router.js +4 -0
  67. package/lib/v2/dut/shortcuts.js +77 -0
  68. package/lib/{routes → v2}/dx2025/index.js +0 -0
  69. package/lib/v2/dx2025/maintainer.js +3 -0
  70. package/lib/v2/dx2025/radar.js +19 -0
  71. package/lib/v2/dx2025/router.js +3 -0
  72. package/lib/v2/e-hentai/radar.js +21 -3
  73. package/lib/v2/eagle/blog.js +47 -0
  74. package/lib/{routes → v2}/eagle/changelog.js +3 -1
  75. package/lib/v2/eagle/maintainer.js +4 -0
  76. package/lib/v2/eagle/radar.js +101 -0
  77. package/lib/v2/eagle/router.js +4 -0
  78. package/lib/{routes → v2}/ehentai/ehapi.js +50 -21
  79. package/lib/{routes → v2}/ehentai/favorites.js +4 -2
  80. package/lib/v2/ehentai/maintainer.js +5 -0
  81. package/lib/v2/ehentai/router.js +5 -0
  82. package/lib/{routes → v2}/ehentai/search.js +5 -3
  83. package/lib/{routes → v2}/ehentai/tag.js +4 -2
  84. package/lib/v2/firefox/index.js +7 -2
  85. package/lib/v2/fortunechina/index.js +1 -1
  86. package/lib/v2/github/comments.js +7 -0
  87. package/lib/v2/gitpod/blog.js +8 -0
  88. package/lib/v2/gov/maintainer.js +1 -0
  89. package/lib/v2/gov/nrta/news.js +63 -0
  90. package/lib/v2/gov/radar.js +11 -0
  91. package/lib/v2/gov/router.js +1 -0
  92. package/lib/v2/guancha/index.js +1 -1
  93. package/lib/v2/guangdiu/cheaps.js +28 -0
  94. package/lib/v2/guangdiu/index.js +44 -0
  95. package/lib/v2/guangdiu/maintainer.js +5 -0
  96. package/lib/v2/guangdiu/radar.js +25 -0
  97. package/lib/v2/guangdiu/rank.js +38 -0
  98. package/lib/v2/guangdiu/router.js +5 -0
  99. package/lib/{routes/guokr/calendar.js → v2/guokr/channel.js} +2 -2
  100. package/lib/v2/guokr/maintainer.js +4 -0
  101. package/lib/v2/guokr/radar.js +19 -0
  102. package/lib/v2/guokr/router.js +4 -0
  103. package/lib/{routes → v2}/guokr/scientific.js +3 -3
  104. package/lib/v2/hkej/index.js +9 -15
  105. package/lib/v2/hkepc/index.js +8 -0
  106. package/lib/v2/hket/index.js +10 -2
  107. package/lib/v2/huangz/index.js +29 -0
  108. package/lib/v2/huangz/maintainer.js +3 -0
  109. package/lib/v2/huangz/radar.js +13 -0
  110. package/lib/v2/huangz/router.js +3 -0
  111. package/lib/v2/huanqiu/index.js +65 -0
  112. package/lib/v2/huanqiu/maintainer.js +3 -0
  113. package/lib/v2/huanqiu/radar.js +13 -0
  114. package/lib/v2/huanqiu/router.js +3 -0
  115. package/lib/v2/miris/blog.js +19 -0
  116. package/lib/v2/miris/maintainer.js +3 -0
  117. package/lib/v2/miris/radar.js +11 -0
  118. package/lib/v2/miris/router.js +3 -0
  119. package/lib/v2/news/whxw.js +2 -2
  120. package/lib/v2/npm/package.js +1 -1
  121. package/lib/v2/npm/router.js +1 -1
  122. package/lib/v2/qbittorrent/maintainer.js +3 -0
  123. package/lib/v2/qbittorrent/news.js +59 -0
  124. package/lib/v2/qbittorrent/radar.js +13 -0
  125. package/lib/v2/qbittorrent/router.js +3 -0
  126. package/lib/v2/rsshub/sponsors.js +1 -0
  127. package/lib/{routes → v2}/sciencenet/blog.js +17 -12
  128. package/lib/v2/sciencenet/maintainer.js +4 -0
  129. package/lib/v2/sciencenet/radar.js +19 -0
  130. package/lib/v2/sciencenet/router.js +4 -0
  131. package/lib/v2/sciencenet/user.js +65 -0
  132. package/lib/v2/sdu/cmse.js +59 -0
  133. package/lib/v2/sdu/cs.js +57 -0
  134. package/lib/v2/sdu/data.js +110 -0
  135. package/lib/v2/sdu/epe.js +55 -0
  136. package/lib/v2/sdu/extractor/index.js +15 -0
  137. package/lib/v2/sdu/extractor/sdrj.js +21 -0
  138. package/lib/v2/sdu/extractor/view.js +21 -0
  139. package/lib/v2/sdu/extractor/wh/jwc.js +24 -0
  140. package/lib/v2/sdu/extractor/wh/news.js +21 -0
  141. package/lib/v2/sdu/maintainer.js +9 -0
  142. package/lib/v2/sdu/mech.js +60 -0
  143. package/lib/v2/sdu/radar.js +159 -0
  144. package/lib/v2/sdu/router.js +9 -0
  145. package/lib/v2/sdu/sc.js +61 -0
  146. package/lib/v2/sdu/wh/jwc.js +42 -0
  147. package/lib/v2/sdu/wh/news.js +38 -0
  148. package/lib/v2/stratechery/index.js +20 -0
  149. package/lib/v2/stratechery/maintainer.js +3 -0
  150. package/lib/v2/stratechery/radar.js +11 -0
  151. package/lib/v2/stratechery/router.js +3 -0
  152. package/lib/{routes → v2}/taptap/changelog.js +2 -1
  153. package/lib/v2/taptap/maintainer.js +5 -0
  154. package/lib/v2/taptap/radar.js +25 -0
  155. package/lib/v2/taptap/review.js +69 -0
  156. package/lib/v2/taptap/router.js +5 -0
  157. package/lib/v2/taptap/templates/videoPost.art +2 -0
  158. package/lib/v2/taptap/topic.js +79 -0
  159. package/lib/v2/taptap/utils.js +48 -0
  160. package/lib/v2/thecover/channel.js +66 -0
  161. package/lib/v2/thecover/maintainer.js +3 -0
  162. package/lib/v2/thecover/radar.js +13 -0
  163. package/lib/v2/thecover/router.js +3 -0
  164. package/lib/{routes → v2}/twreporter/category.js +7 -12
  165. package/lib/{routes → v2}/twreporter/fetch_article.js +5 -4
  166. package/lib/v2/twreporter/maintainer.js +5 -0
  167. package/lib/{routes → v2}/twreporter/newest.js +8 -13
  168. package/lib/v2/twreporter/photography.js +46 -0
  169. package/lib/v2/twreporter/radar.js +25 -0
  170. package/lib/v2/twreporter/router.js +5 -0
  171. package/lib/{routes/tencent → v2}/wechat/announce.js +3 -2
  172. package/lib/v2/wechat/ce.js +69 -0
  173. package/lib/v2/wechat/data258.js +137 -0
  174. package/lib/v2/wechat/ershcimi.js +35 -0
  175. package/lib/{routes/tencent → v2}/wechat/feeds.js +0 -0
  176. package/lib/v2/wechat/maintainer.js +11 -0
  177. package/lib/{routes/tencent → v2}/wechat/mp.js +0 -0
  178. package/lib/{routes/tencent → v2}/wechat/msgalbum.js +0 -0
  179. package/lib/v2/wechat/radar.js +76 -1
  180. package/lib/v2/wechat/router.js +11 -0
  181. package/lib/{routes/tencent → v2}/wechat/tgchannel.js +0 -0
  182. package/lib/{routes/tencent → v2}/wechat/uread.js +0 -0
  183. package/lib/{routes/tencent → v2}/wechat/wemp.js +0 -0
  184. package/lib/{routes/tencent → v2}/wechat/wxnmh.js +0 -0
  185. package/lib/{routes → v2}/xueqiu/favorite.js +2 -1
  186. package/lib/v2/xueqiu/fund.js +50 -0
  187. package/lib/{routes → v2}/xueqiu/hots.js +2 -1
  188. package/lib/v2/xueqiu/maintainer.js +10 -0
  189. package/lib/v2/xueqiu/radar.js +60 -0
  190. package/lib/v2/xueqiu/router.js +10 -0
  191. package/lib/{routes → v2}/xueqiu/snb.js +2 -1
  192. package/lib/{routes → v2}/xueqiu/stock_comments.js +4 -20
  193. package/lib/{routes → v2}/xueqiu/stock_info.js +2 -1
  194. package/lib/v2/xueqiu/templates/comments_description.art +10 -0
  195. package/lib/{routes → v2}/xueqiu/user.js +2 -1
  196. package/lib/{routes → v2}/xueqiu/user_stock.js +3 -2
  197. package/lib/v2/yunspe/maintainer.js +3 -0
  198. package/lib/v2/yunspe/newsflash.js +42 -0
  199. package/lib/v2/yunspe/radar.js +13 -0
  200. package/lib/v2/yunspe/router.js +3 -0
  201. package/lib/{routes → v2}/yystv/category.js +8 -8
  202. package/lib/{routes → v2}/yystv/docs.js +2 -2
  203. package/lib/v2/yystv/maintainer.js +4 -0
  204. package/lib/v2/yystv/radar.js +49 -0
  205. package/lib/v2/yystv/router.js +4 -0
  206. package/lib/{routes/universities → v2}/zju/career/index.js +14 -13
  207. package/lib/{routes/universities → v2}/zju/cst/custom.js +2 -1
  208. package/lib/{routes/universities → v2}/zju/cst/index.js +20 -24
  209. package/lib/v2/zju/grs/index.js +43 -0
  210. package/lib/v2/zju/list.js +66 -0
  211. package/lib/v2/zju/maintainer.js +8 -0
  212. package/lib/v2/zju/physics/index.js +52 -0
  213. package/lib/v2/zju/radar.js +139 -0
  214. package/lib/v2/zju/router.js +8 -0
  215. package/lib/views/atom.art +13 -1
  216. package/lib/views/welcome.art +4 -1
  217. package/package.json +13 -12
  218. package/lib/routes/cctv/xwlb.js +0 -48
  219. package/lib/routes/dapenti/utils.js +0 -73
  220. package/lib/routes/taptap/review.js +0 -39
  221. package/lib/routes/taptap/topic.js +0 -85
  222. package/lib/routes/tencent/wechat/_README +0 -1
  223. package/lib/routes/tencent/wechat/ce.js +0 -40
  224. package/lib/routes/tencent/wechat/ershcimi.js +0 -43
  225. package/lib/routes/twreporter/photography.js +0 -57
  226. package/lib/routes/universities/dut/index.js +0 -60
  227. package/lib/routes/universities/dut/subsite.js +0 -50
  228. package/lib/routes/universities/sdu/cmse.js +0 -55
  229. package/lib/routes/universities/sdu/cs.js +0 -55
  230. package/lib/routes/universities/sdu/epe.js +0 -54
  231. package/lib/routes/universities/sdu/mech.js +0 -58
  232. package/lib/routes/universities/sdu/sc.js +0 -56
  233. package/lib/routes/universities/zju/grs/index.js +0 -44
  234. package/lib/routes/universities/zju/list.js +0 -78
  235. package/lib/routes/universities/zju/physics/index.js +0 -55
  236. package/lib/routes/xueqiu/fund.js +0 -71
  237. package/lib/v2/wechat/templates/image.art +0 -1
@@ -0,0 +1,75 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const iconv = require('iconv-lite');
4
+ const { parseDate } = require('@/utils/parse-date');
5
+ const timezone = require('@/utils/timezone');
6
+
7
+ module.exports = {
8
+ parseFeed: async ({ subjectid }, ctx) => {
9
+ const url = `https://www.dapenti.com/blog/blog.asp?name=xilei&subjectid=${subjectid}`;
10
+ const listRes = await got({
11
+ method: 'get',
12
+ url,
13
+ headers: {
14
+ Referer: url,
15
+ },
16
+ // 喷嚏网编码为GBK,需要转码
17
+ // 转码需要设定返回数据的格式,其可选项是arraybuffer,blob,document,json,text,stream
18
+ // 默认为json
19
+ responseType: 'buffer',
20
+ });
21
+ // 转码
22
+ const data = iconv.decode(listRes.data, 'gb2312');
23
+ const $ = cheerio.load(data);
24
+ // 只取最近的三个,取全文rss
25
+ const list = $('li', 'ul').slice(0, 3).get();
26
+
27
+ const result_item = await Promise.all(
28
+ list.map((item) =>
29
+ ctx.cache.tryGet(`https://www.dapenti.com/blog/${$(item).find('a').attr('href')}`, async () => {
30
+ const el = $(item);
31
+ const url = `https://www.dapenti.com/blog/${el.find('a').attr('href')}`;
32
+ const original_data = await got({
33
+ method: 'get',
34
+ url,
35
+ headers: {
36
+ Referer: url,
37
+ },
38
+ responseType: 'buffer',
39
+ });
40
+ const convert_data = iconv.decode(original_data.data, 'gbk');
41
+ const description = cheerio.load(convert_data, {
42
+ decodeEntities: false,
43
+ })('body > table > tbody > tr > td.oblog_t_2 > div > table > tbody > tr:nth-child(2) > td');
44
+ const pubInfo = description.find('span span.oblog_text').text().split('发布于');
45
+ description.find('table, .adsbygoogle').remove();
46
+
47
+ // remove header
48
+ const count = subjectid.toString() === '70' ? 7 : 3;
49
+ for (let index = 0; index < count; index++) {
50
+ description.children().first().remove();
51
+ }
52
+
53
+ // remove footer
54
+ for (let index = 0; index < 8; index++) {
55
+ description.children().last().remove();
56
+ }
57
+ const single = {
58
+ title: el.text(),
59
+ author: pubInfo[0].trim(),
60
+ description: description.html(),
61
+ pubDate: timezone(parseDate(pubInfo[1]?.trim()), +8),
62
+ link: url,
63
+ };
64
+ return single;
65
+ })
66
+ )
67
+ );
68
+
69
+ return {
70
+ title: `喷嚏-${subjectid}`,
71
+ link: url,
72
+ item: result_item,
73
+ };
74
+ },
75
+ };
@@ -17,24 +17,21 @@ module.exports = async (ctx) => {
17
17
  const proList = [];
18
18
 
19
19
  const out = await Promise.all(
20
- list.map(async (item) => {
20
+ list.map((item) => {
21
21
  const $ = cheerio.load(item);
22
22
  const title = $('a').text();
23
23
  const itemUrl = host + $('a').attr('href');
24
24
 
25
- const cache = await ctx.cache.get(itemUrl);
26
- if (cache) {
27
- return Promise.resolve(JSON.parse(cache));
28
- }
25
+ return ctx.cache.tryGet(itemUrl, () => {
26
+ const single = {
27
+ title,
28
+ link: itemUrl,
29
+ };
29
30
 
30
- const single = {
31
- title,
32
- link: itemUrl,
33
- };
34
-
35
- const es = got.get(itemUrl);
36
- proList.push(es);
37
- return Promise.resolve(single);
31
+ const es = got.get(itemUrl);
32
+ proList.push(es);
33
+ return single;
34
+ });
38
35
  })
39
36
  );
40
37
 
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ '/daily': ['HenryQW'],
3
+ '/player_news/:id': ['HenryQW'],
4
+ '/result/:team': ['HenryQW'],
5
+ '/special/:id': ['dxmpalb'],
6
+ '/team_news/:team': ['HenryQW'],
7
+ '/top_news/:id?': ['HendricksZheng'],
8
+ };
File without changes
@@ -0,0 +1,45 @@
1
+ module.exports = {
2
+ 'dongqiudi.com': {
3
+ _name: '懂球帝',
4
+ m: [
5
+ {
6
+ title: '新闻',
7
+ docs: 'https://docs.rsshub.app/new-media.html#dong-qiu-di',
8
+ source: ['/home/:id'],
9
+ target: '/dongqiudi/top_news/:id',
10
+ },
11
+ ],
12
+ www: [
13
+ {
14
+ title: '专题',
15
+ docs: 'https://docs.rsshub.app/new-media.html#dong-qiu-di',
16
+ source: ['/special/:id'],
17
+ target: '/dongqiudi/special/:id',
18
+ },
19
+ {
20
+ title: '早报',
21
+ docs: 'https://docs.rsshub.app/new-media.html#dong-qiu-di',
22
+ source: ['/special/48'],
23
+ target: '/dongqiudi/daily',
24
+ },
25
+ {
26
+ title: '足球赛果',
27
+ docs: 'https://docs.rsshub.app/new-media.html#dong-qiu-di',
28
+ source: ['/team/*team'],
29
+ target: (params) => `/dongqiudi/result/${params.team.replace('.html', '')}`,
30
+ },
31
+ {
32
+ title: '球队新闻',
33
+ docs: 'https://docs.rsshub.app/new-media.html#dong-qiu-di',
34
+ source: ['/team/*team'],
35
+ target: (params) => `/dongqiudi/team_news/${params.team.replace('.html', '')}`,
36
+ },
37
+ {
38
+ title: '球员新闻',
39
+ docs: 'https://docs.rsshub.app/new-media.html#dong-qiu-di',
40
+ source: ['/player/*id'],
41
+ target: (params) => `/dongqiudi/player_news/${params.id.replace('.html', '')}`,
42
+ },
43
+ ],
44
+ },
45
+ };
@@ -1,5 +1,6 @@
1
1
  const got = require('@/utils/got');
2
2
  const { JSDOM } = require('jsdom');
3
+ const { parseDate } = require('@/utils/parse-date');
3
4
 
4
5
  module.exports = async (ctx) => {
5
6
  const team = ctx.params.team;
@@ -18,7 +19,7 @@ module.exports = async (ctx) => {
18
19
  title: `${result.match_title} ${result.team_A_name} ${result.fs_A}-${result.fs_B} ${result.team_B_name}`,
19
20
  guid: result.match_id,
20
21
  link: result.scheme.replace('dongqiudi:///game/', 'https://www.dongqiudi.com/liveDetail/'),
21
- pubDate: result.start_time,
22
+ pubDate: parseDate(result.start_time),
22
23
  }));
23
24
 
24
25
  ctx.state.data = {
@@ -0,0 +1,8 @@
1
+ module.exports = (router) => {
2
+ router.get('/daily', require('./daily'));
3
+ router.get('/player_news/:id', require('./player_news'));
4
+ router.get('/result/:team', require('./result'));
5
+ router.get('/special/:id', require('./special'));
6
+ router.get('/team_news/:team', require('./team_news'));
7
+ router.get('/top_news/:id?', require('./top_news'));
8
+ };
File without changes
File without changes
@@ -2,31 +2,28 @@ const got = require('@/utils/got');
2
2
  const utils = require('./utils');
3
3
 
4
4
  module.exports = async (ctx) => {
5
- const id = ctx.params.id || 1;
6
- const response = await got.get(`https://api.dongqiudi.com/app/tabs/iphone/${id}.json?mark=gif&version=576`);
5
+ const id = ctx.params.id ?? 1;
6
+ const response = await got(`https://api.dongqiudi.com/app/tabs/iphone/${id}.json?mark=gif&version=576`);
7
7
  const data = response.data.articles;
8
8
  const label = response.data.label;
9
9
 
10
10
  const proList = [];
11
11
 
12
12
  const out = await Promise.all(
13
- data.map(async (item) => {
13
+ data.map((item) => {
14
14
  const title = item.title;
15
15
  const itemUrl = `https://www.dongqiudi.com/news/${item.id}.html`;
16
16
 
17
- const cache = await ctx.cache.get(itemUrl);
18
- if (cache) {
19
- return Promise.resolve(JSON.parse(cache));
20
- }
17
+ return ctx.cache.tryGet(itemUrl, () => {
18
+ const single = {
19
+ title,
20
+ link: itemUrl,
21
+ };
21
22
 
22
- const single = {
23
- title,
24
- link: itemUrl,
25
- };
26
-
27
- const es = got.get(itemUrl);
28
- proList.push(es);
29
- return Promise.resolve(single);
23
+ const es = got(itemUrl);
24
+ proList.push(es);
25
+ return single;
26
+ });
30
27
  })
31
28
  );
32
29
 
@@ -1,11 +1,11 @@
1
1
  const cheerio = require('cheerio');
2
2
  const got = require('@/utils/got');
3
- const url = require('url');
4
3
  const { JSDOM } = require('jsdom');
4
+ const { parseDate } = require('@/utils/parse-date');
5
5
 
6
6
  const ProcessVideo = (content) => {
7
7
  content('div.video').each((i, v) => {
8
- let link = url.parse(v.attribs.src);
8
+ let link = new URL(v.attribs.src);
9
9
  if (link.host === 'm.miguvideo.com') {
10
10
  content(`<a href="${link.href}"> ▶️ 观看视频 </a><br>`).insertAfter(v);
11
11
  content(v).remove();
@@ -13,8 +13,6 @@ const ProcessVideo = (content) => {
13
13
  link = v.attribs.src;
14
14
  switch (v.attribs.site) {
15
15
  case 'qiniu':
16
- // 临时解决七牛 CDN 证书过期
17
- link = link.replace('https://', 'http://');
18
16
  content(`<video width="100%" controls="controls"> <source src="${link}" type="video/mp4"> Your RSS reader does not support video playback. </video>`).insertAfter(v);
19
17
  content(v).remove();
20
18
  break;
@@ -31,7 +29,7 @@ const ProcessVideo = (content) => {
31
29
  // Process iframes
32
30
  content('iframe.media-iframe, .edui-faked-video').each((i, v) => {
33
31
  const link = v.attribs.src;
34
- if (link.startsWith('http://ssports.iqiyi.com')) {
32
+ if (link.startsWith('http://ssports.iqiyi.com/')) {
35
33
  content(`<a href="${link.link}"> ▶️ 观看视频 </a><br>`).insertAfter(v);
36
34
  }
37
35
 
@@ -49,6 +47,20 @@ const ProcessHref = (content) => {
49
47
  });
50
48
  };
51
49
 
50
+ const ProcessImg = (content) => {
51
+ content.each((_, img) => {
52
+ if (img.attribs['data-gif-src'] && img.attribs['data-gif-src'].length) {
53
+ img.attribs = { src: img.attribs['data-gif-src'] };
54
+ }
55
+ if (img.attribs['orig-src'] && img.attribs['orig-src'].length) {
56
+ img.attribs.src = img.attribs['orig-src'];
57
+ delete img.attribs['orig-src'];
58
+ delete img.attribs['data-src'];
59
+ }
60
+ img.attribs.src = img.attribs.src.includes('?watermark') ? img.attribs.src.split('?watermark')[0] : img.attribs.src;
61
+ });
62
+ };
63
+
52
64
  const ProcessFeed = async (ctx, link, type) => {
53
65
  const got_ins = got.extend({
54
66
  headers: {
@@ -74,34 +86,34 @@ const ProcessFeed = async (ctx, link, type) => {
74
86
  }
75
87
 
76
88
  const out = await Promise.all(
77
- list.map(async (item) => {
78
- const res = await got_ins.get(item.share.replace('www', 'm').replace('articles', 'article'));
89
+ list.map((item) => {
90
+ const url = item.share.replace('www', 'm').replace('articles', 'article');
91
+ return ctx.cache.tryGet(url, async () => {
92
+ const res = await got_ins.get(url);
79
93
 
80
- const $ = cheerio.load(res.data);
94
+ const $ = cheerio.load(res.data);
81
95
 
82
- const author = $('body > header a').text();
96
+ const author = $('body > header a').text();
83
97
 
84
- const content = $('article');
98
+ const content = $('article');
85
99
 
86
- ProcessVideo($);
100
+ ProcessVideo($);
87
101
 
88
- $('.data-gif-src').each((j, y) => {
89
- if (y.attribs['data-gif-src']) {
90
- y.attribs = { src: y.attribs['data-gif-src'] };
91
- }
92
- });
102
+ ProcessImg($('.data-gif-src'));
103
+ ProcessImg($('img'));
104
+
105
+ ProcessHref(content.find('a'));
93
106
 
94
- ProcessHref(content.find('a'));
95
-
96
- const single = {
97
- title: item.title,
98
- guid: item.id,
99
- link: `https://www.dongqiudi.com/news/${item.id}.html`,
100
- description: content.html(),
101
- pubDate: new Date(item.show_time * 1000).toUTCString(),
102
- author,
103
- };
104
- return Promise.resolve(single);
107
+ const single = {
108
+ title: item.title,
109
+ guid: item.id,
110
+ link: `https://www.dongqiudi.com/news/${item.id}.html`,
111
+ description: content.html(),
112
+ pubDate: parseDate(item.show_time * 1000),
113
+ author,
114
+ };
115
+ return single;
116
+ });
105
117
  })
106
118
  );
107
119
 
@@ -119,12 +131,18 @@ const ProcessFeedType2 = (item, response) => {
119
131
 
120
132
  const data = dom.window.__NUXT__.data[0].newData;
121
133
 
134
+ // filter out undefined item
135
+ if (!data) {
136
+ return;
137
+ }
138
+
122
139
  if (Object.keys(data).length > 0) {
123
140
  const body = ProcessVideo(cheerio.load(data.body));
124
141
  ProcessHref(body('a'));
142
+ ProcessImg(body('img'));
125
143
  item.description = body.html();
126
144
  item.author = data.writer;
127
- item.pubDate = new Date(data.show_time * 1000).toUTCString();
145
+ item.pubDate = parseDate(data.show_time * 1000);
128
146
  }
129
147
  };
130
148
 
@@ -133,4 +151,5 @@ module.exports = {
133
151
  ProcessFeed,
134
152
  ProcessFeedType2,
135
153
  ProcessHref,
154
+ ProcessImg,
136
155
  };
@@ -0,0 +1,53 @@
1
+ module.exports = {
2
+ // 新闻网:https://news.dlut.edu.cn
3
+ // 默认 -> 头条关注 https://news.dlut.edu.cn/ttgz.htm
4
+ news: 'ttgz',
5
+
6
+ // 教务处:http://teach.dlut.edu.cn
7
+ // 默认 -> 新闻快递 http://teach.dlut.edu.cn/xwkd/xwkd.htm
8
+ teach: 'xwkd/xwkd',
9
+
10
+ // 人事处:http://perdep.dlut.edu.cn
11
+ // 默认 -> 通知公告 http://perdep.dlut.edu.cn/tzgg/tzgg.htm
12
+ perdep: 'tzgg/tzgg',
13
+
14
+ // 研究生院:http://gs.dlut.edu.cn
15
+ // 默认 -> 重要通知 http://gs.dlut.edu.cn/zytz.htm
16
+ gs: 'zytz',
17
+
18
+ // 软件学院:http://ssdut.dlut.edu.cn
19
+ // 默认 -> 焦点新闻 http://ssdut.dlut.edu.cn/ywgg/xueyuanxinwen/jdxw.htm
20
+ ssdut: 'ywgg/xueyuanxinwen/jdxw',
21
+
22
+ // 开发区校区:http://eda.dlut.edu.cn
23
+ // 默认 -> 通知公告 http://eda.dlut.edu.cn/tzgg/tzgg.htm
24
+ eda: 'tzgg/tzgg',
25
+
26
+ // 盘锦校区:https://panjin.dlut.edu.cn/index.htm
27
+ // 默认 -> 公告 https://panjin.dlut.edu.cn/index/gg.htm
28
+ panjin: 'index/gg',
29
+
30
+ // 盘锦校区学生事务办公室:http://xsgzb.dlut.edu.cn
31
+ // 默认 -> 通知公告 http://xsgzb.dlut.edu.cn/index/zytz.htm
32
+ xsgzb: 'index/zytz',
33
+
34
+ // 盘锦校区教务教学事务办公室:http://pjteach.dlut.edu.cn
35
+ // 默认 -> 新闻快递 http://pjteach.dlut.edu.cn/index/xwkd.htm
36
+ pjteach: 'index/xwkd',
37
+
38
+ // 盘锦校区总务部:http://pjxqzwb.dlut.edu.cn/index.htm
39
+ // 默认 -> 通知公告 http://pjxqzwb.dlut.edu.cn/index/tzgg.htm
40
+ pjxqzwb: 'index/tzgg',
41
+
42
+ // 体育与健康学院盘锦分院:http://tjpj.dlut.edu.cn/index.htm
43
+ // 默认 -> 通知公告 http://tjpj.dlut.edu.cn/index/zxgg.htm
44
+ tjpj: 'index/zxgg',
45
+
46
+ // 国际合作与交流处(港澳台办):http://dutdice.dlut.edu.cn
47
+ // 默认 -> 新闻速递 http://dutdice.dlut.edu.cn/xwsd/xxxw.htm
48
+ dutdice: 'xwsd/xxxw',
49
+
50
+ // 体育场馆中心:http://tycgzx.dlut.edu.cn
51
+ // 默认 -> 通知公告 http://tycgzx.dlut.edu.cn/tzgg/tzgg.htm
52
+ tycgzx: 'tzgg/tzgg',
53
+ };
@@ -0,0 +1,78 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const defaults = require('./defaults');
5
+ const shortcuts = require('./shortcuts');
6
+
7
+ module.exports = async (ctx) => {
8
+ const site = ctx.params[0] ?? 'news';
9
+
10
+ let items;
11
+ let category = ctx.params[1] ?? (defaults.hasOwnProperty(site) ? defaults[site] : '');
12
+ category = shortcuts.hasOwnProperty(site) ? (shortcuts[site].hasOwnProperty(category) ? shortcuts[site][category] : category) : category;
13
+
14
+ const rootUrl = `https://${site}.dlut.edu.cn`;
15
+ const currentUrl = `${rootUrl}/${category}.htm`;
16
+
17
+ const response = await got({
18
+ method: 'get',
19
+ url: currentUrl,
20
+ });
21
+
22
+ const $ = cheerio.load(response.data);
23
+
24
+ if (site === 'panjin') {
25
+ items = $('a.news').slice(0, -4);
26
+ } else {
27
+ $('.Next, .rjxw_left, .pb_sys_common').remove();
28
+ items = $('.txt, .itemlist, .wall, .list, .list01, .ny_list, .rjxw_right, .rj_yjs_con, .c_hzjl_list1, .winstyle67894, .winstyle80936, .winstyle50738, #lili').find('a');
29
+ }
30
+
31
+ items = items
32
+ .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 50)
33
+ .toArray()
34
+ .map((item) => {
35
+ item = $(item);
36
+
37
+ const dateRegex = /(\d{4}[-/年]\d{2}[-/月]\d{2})/;
38
+
39
+ let dateMatch = item.parent().text().match(dateRegex);
40
+ if (!dateMatch) {
41
+ dateMatch = item.parent().parent().text().match(dateRegex);
42
+ }
43
+
44
+ return {
45
+ title: item.text() === '' ? item.next().text() : item.text(),
46
+ link: /^http/.test(item.attr('href')) ? item.attr('href') : `${rootUrl}/${item.attr('href').replace(/^[./]+/, '')}`,
47
+ pubDate: parseDate(dateMatch ? dateMatch[1].replace(/年|月/g, '-') : new Date().toString()),
48
+ };
49
+ });
50
+
51
+ items = await Promise.all(
52
+ items.map((item) =>
53
+ ctx.cache.tryGet(item.link, async () => {
54
+ try {
55
+ const detailResponse = await got({
56
+ method: 'get',
57
+ url: item.link,
58
+ });
59
+
60
+ const content = cheerio.load(detailResponse.data);
61
+
62
+ item.description = content('.v_news_content, .conbox').html();
63
+ } catch (err) {
64
+ // Fo example: http://dutdice.dlut.edu.cn/nry.jsp?urltype=news.NewsContentUrl&wbtreeid=1006&wbnewsid=9820
65
+ // do nothing to the cases which require fetching resources from the Intranet :P
66
+ }
67
+ return item;
68
+ })
69
+ )
70
+ );
71
+
72
+ ctx.state.data = {
73
+ title: $('title').text(),
74
+ link: currentUrl,
75
+ item: items,
76
+ allowEmpty: true,
77
+ };
78
+ };
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ '/news/:category?': ['nczitzk'],
3
+ '/perdep/:category?': ['nczitzk'],
4
+ '/teach/:category?': ['beautyyuyanli', 'nczitzk'],
5
+ '/gs/:category?': ['nczitzk'],
6
+ '/ssdut/:category?': ['nczitzk'],
7
+ '/eda/:category?': ['nczitzk'],
8
+ '/panjin/:category?': ['nczitzk'],
9
+ '/xsgzb/:category?': ['nczitzk'],
10
+ '/pjteach/:category?': ['nczitzk'],
11
+ '/pjxqzwb/:category?': ['nczitzk'],
12
+ '/dutdice/:category?': ['beautyyuyanli', 'nczitzk'],
13
+ '/tycgzx/:category?': ['beatyyuyanli', 'nczitzk'],
14
+ };
@@ -0,0 +1,109 @@
1
+ module.exports = {
2
+ 'dlut.edu.cn': {
3
+ _name: '大连理工大学',
4
+ news: [
5
+ {
6
+ title: '新闻网',
7
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-xin-wen-wang',
8
+ source: ['/'],
9
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
10
+ },
11
+ ],
12
+ perdep: [
13
+ {
14
+ title: '人事处',
15
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-ren-shi-chu',
16
+ source: ['/'],
17
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
18
+ },
19
+ ],
20
+ teach: [
21
+ {
22
+ title: '教务处',
23
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-jiao-wu-chu',
24
+ source: ['/'],
25
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
26
+ },
27
+ ],
28
+ gs: [
29
+ {
30
+ title: '研究生院',
31
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-yan-jiu-sheng-yuan',
32
+ source: ['/'],
33
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
34
+ },
35
+ ],
36
+ ssdut: [
37
+ {
38
+ title: '软件学院',
39
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-ruan-jian-xue-yuan',
40
+ source: ['/'],
41
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
42
+ },
43
+ ],
44
+ eda: [
45
+ {
46
+ title: '开发区校区',
47
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-kai-fa-qu-xiao-qu',
48
+ source: ['/'],
49
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
50
+ },
51
+ ],
52
+ panjin: [
53
+ {
54
+ title: '盘锦校区',
55
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-pan-jin-xiao-qu',
56
+ source: ['/'],
57
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
58
+ },
59
+ ],
60
+ xsgzb: [
61
+ {
62
+ title: '盘锦校区学生事务办公室',
63
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-pan-jin-xiao-qu-xue-sheng-shi-wu-ban-gong-shi',
64
+ source: ['/'],
65
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
66
+ },
67
+ ],
68
+ pjteach: [
69
+ {
70
+ title: '盘锦校区教务教学事务办公室',
71
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-pan-jin-xiao-qu-jiao-wu-jiao-xue-shi-wu-ban-gong-shi',
72
+ source: ['/'],
73
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
74
+ },
75
+ ],
76
+ pjxqzwb: [
77
+ {
78
+ title: '盘锦校区总务部',
79
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-pan-jin-xiao-qu-zong-wu-bu',
80
+ source: ['/'],
81
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
82
+ },
83
+ ],
84
+ tjpj: [
85
+ {
86
+ title: '体育与健康学院盘锦分院',
87
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-ti-yu-jian-kang-xue-yuan-pan-jin-fen-yuan',
88
+ source: ['/'],
89
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
90
+ },
91
+ ],
92
+ dutdice: [
93
+ {
94
+ title: '国际合作与交流处(港澳台办)',
95
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-guo-ji-he-zuo-yu-jiao-liu-chu-gang-ao-tai-ban',
96
+ source: ['/'],
97
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
98
+ },
99
+ ],
100
+ tycgzx: [
101
+ {
102
+ title: '体育场馆中心',
103
+ docs: 'https://docs.rsshub.app/university.html#da-lian-li-gong-da-xue-ti-yu-chang-guan-zhong-xin',
104
+ source: ['/'],
105
+ target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
106
+ },
107
+ ],
108
+ },
109
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = function (router) {
2
+ router.get(/([\w\d]+)\/([\w\d/]+)?/, require('./index'));
3
+ router.get('/:0?', require('./index'));
4
+ };