rsshub 1.0.0-master.d3ce31d → 1.0.0-master.d4c8fa0

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 (154) hide show
  1. package/lib/middleware/parameter.js +10 -4
  2. package/lib/radar-rules.js +20 -37
  3. package/lib/router.js +9 -9
  4. package/lib/v2/36kr/index.js +75 -0
  5. package/lib/v2/36kr/maintainer.js +7 -5
  6. package/lib/v2/36kr/radar.js +27 -15
  7. package/lib/v2/36kr/router.js +1 -5
  8. package/lib/v2/acs/journal.js +73 -0
  9. package/lib/v2/acs/maintainer.js +3 -0
  10. package/lib/v2/acs/radar.js +13 -0
  11. package/lib/v2/acs/router.js +3 -0
  12. package/lib/v2/acs/templates/description.art +2 -0
  13. package/lib/v2/airchina/index.js +36 -0
  14. package/lib/v2/airchina/maintainer.js +3 -0
  15. package/lib/v2/airchina/radar.js +13 -0
  16. package/lib/v2/airchina/router.js +3 -0
  17. package/lib/v2/allrecode/index.js +65 -0
  18. package/lib/v2/allrecode/maintainer.js +5 -0
  19. package/lib/v2/allrecode/news.js +35 -0
  20. package/lib/v2/allrecode/radar.js +25 -0
  21. package/lib/v2/allrecode/router.js +4 -0
  22. package/lib/v2/biquge/index.js +78 -0
  23. package/lib/v2/biquge/maintainer.js +3 -0
  24. package/lib/v2/biquge/radar.js +29 -0
  25. package/lib/v2/biquge/router.js +3 -0
  26. package/lib/v2/ccfcv/index.js +68 -0
  27. package/lib/v2/ccfcv/maintainer.js +3 -0
  28. package/lib/v2/ccfcv/radar.js +25 -0
  29. package/lib/v2/ccfcv/router.js +3 -0
  30. package/lib/v2/ccfcv/templates/description.art +1 -0
  31. package/lib/v2/cde/maintainer.js +1 -0
  32. package/lib/v2/cde/radar.js +12 -0
  33. package/lib/v2/cde/router.js +1 -0
  34. package/lib/v2/cde/zdyz.js +77 -0
  35. package/lib/v2/clash/maintainer.js +3 -0
  36. package/lib/v2/clash/premium.js +23 -0
  37. package/lib/v2/clash/radar.js +13 -0
  38. package/lib/v2/clash/router.js +3 -0
  39. package/lib/v2/gdut/maintainer.js +3 -0
  40. package/lib/{routes/universities → v2}/gdut/news.js +4 -0
  41. package/lib/v2/gdut/oa_news.js +214 -0
  42. package/lib/v2/gdut/radar.js +13 -0
  43. package/lib/v2/gdut/router.js +3 -0
  44. package/lib/v2/github/maintainer.js +1 -1
  45. package/lib/v2/github/templates/trending-description.art +5 -0
  46. package/lib/v2/github/trending.js +32 -16
  47. package/lib/v2/gov/maintainer.js +2 -0
  48. package/lib/v2/gov/moj/aac/news.js +49 -0
  49. package/lib/v2/gov/nifdc/index.js +86 -0
  50. package/lib/v2/gov/radar.js +22 -0
  51. package/lib/v2/gov/router.js +2 -0
  52. package/lib/v2/gov/shanghai/yjj/index.js +16 -10
  53. package/lib/v2/hakkatv/maintainer.js +3 -0
  54. package/lib/v2/hakkatv/radar.js +13 -0
  55. package/lib/v2/hakkatv/router.js +3 -0
  56. package/lib/v2/hakkatv/type.js +67 -0
  57. package/lib/v2/hk01/channel.js +13 -30
  58. package/lib/v2/hk01/hot.js +13 -14
  59. package/lib/v2/hk01/issue.js +12 -31
  60. package/lib/v2/hk01/maintainer.js +5 -5
  61. package/lib/v2/hk01/radar.js +19 -19
  62. package/lib/v2/hk01/router.js +4 -4
  63. package/lib/v2/hk01/tag.js +14 -15
  64. package/lib/v2/hk01/templates/description.art +53 -0
  65. package/lib/v2/hk01/utils.js +43 -0
  66. package/lib/v2/hk01/zone.js +15 -34
  67. package/lib/v2/houxu/events.js +37 -0
  68. package/lib/v2/houxu/index.js +21 -69
  69. package/lib/v2/houxu/lives.js +35 -0
  70. package/lib/v2/houxu/maintainer.js +4 -2
  71. package/lib/v2/houxu/memory.js +37 -0
  72. package/lib/v2/houxu/radar.js +18 -6
  73. package/lib/v2/houxu/router.js +6 -1
  74. package/lib/v2/houxu/templates/events.art +5 -0
  75. package/lib/v2/houxu/templates/lives.art +5 -0
  76. package/lib/v2/houxu/templates/memory.art +3 -0
  77. package/lib/v2/myfigurecollection/activity.js +58 -0
  78. package/lib/v2/myfigurecollection/index.js +78 -0
  79. package/lib/v2/myfigurecollection/maintainer.js +4 -0
  80. package/lib/v2/myfigurecollection/radar.js +44 -0
  81. package/lib/v2/myfigurecollection/router.js +4 -0
  82. package/lib/v2/myfigurecollection/templates/activity.art +8 -0
  83. package/lib/v2/myfigurecollection/templates/description.art +24 -0
  84. package/lib/v2/ncepu/maintainer.js +3 -0
  85. package/lib/v2/ncepu/master/masterinfo.js +78 -0
  86. package/lib/v2/ncepu/radar.js +25 -0
  87. package/lib/v2/ncepu/router.js +3 -0
  88. package/lib/{routes → v2}/nga/forum.js +8 -9
  89. package/lib/v2/nga/maintainer.js +4 -0
  90. package/lib/{routes → v2}/nga/post.js +16 -15
  91. package/lib/v2/nga/radar.js +56 -0
  92. package/lib/v2/nga/router.js +4 -0
  93. package/lib/v2/oo-software/changelog.js +40 -0
  94. package/lib/v2/oo-software/maintainer.js +3 -0
  95. package/lib/v2/oo-software/radar.js +13 -0
  96. package/lib/v2/oo-software/router.js +3 -0
  97. package/lib/{routes/outagereport/service.js → v2/outagereport/index.js} +2 -2
  98. package/lib/v2/outagereport/maintainer.js +3 -0
  99. package/lib/v2/outagereport/radar.js +13 -0
  100. package/lib/v2/outagereport/router.js +3 -0
  101. package/lib/v2/peopo/maintainer.js +3 -0
  102. package/lib/v2/peopo/radar.js +13 -0
  103. package/lib/v2/peopo/router.js +3 -0
  104. package/lib/v2/peopo/topic.js +46 -0
  105. package/lib/v2/pts/curations.js +44 -0
  106. package/lib/v2/pts/{dailynews.js → index.js} +24 -11
  107. package/lib/v2/pts/maintainer.js +6 -0
  108. package/lib/v2/pts/projects.js +44 -0
  109. package/lib/v2/pts/radar.js +38 -2
  110. package/lib/v2/pts/router.js +4 -1
  111. package/lib/v2/pts/templates/description.art +6 -0
  112. package/lib/v2/sakurazaka46/blog.js +1 -1
  113. package/lib/v2/sakurazaka46/maintainer.js +1 -0
  114. package/lib/v2/sakurazaka46/news.js +51 -0
  115. package/lib/v2/sakurazaka46/radar.js +6 -0
  116. package/lib/v2/sakurazaka46/router.js +1 -0
  117. package/lib/v2/scitation/journal.js +37 -50
  118. package/lib/v2/scitation/section.js +38 -56
  119. package/lib/v2/scitation/templates/description.art +4 -7
  120. package/lib/v2/scitation/utils.js +29 -0
  121. package/lib/v2/sinchew/index.js +68 -0
  122. package/lib/v2/sinchew/maintainer.js +5 -0
  123. package/lib/v2/sinchew/radar.js +25 -0
  124. package/lib/v2/sinchew/router.js +4 -0
  125. package/lib/v2/sinchew/templates/images.art +4 -0
  126. package/lib/v2/taiwannews/hot.js +52 -0
  127. package/lib/v2/taiwannews/maintainer.js +3 -0
  128. package/lib/v2/taiwannews/radar.js +13 -0
  129. package/lib/v2/taiwannews/router.js +3 -0
  130. package/lib/v2/test/index.js +2 -0
  131. package/lib/v2/tju/cic/index.js +113 -0
  132. package/lib/v2/tju/maintainer.js +6 -0
  133. package/lib/v2/tju/news/index.js +135 -0
  134. package/lib/v2/tju/oaa/index.js +112 -0
  135. package/lib/v2/tju/radar.js +97 -0
  136. package/lib/v2/tju/router.js +6 -0
  137. package/lib/v2/tju/yzb/index.js +121 -0
  138. package/lib/v2/tribalfootball/latest.js +68 -0
  139. package/lib/v2/tribalfootball/maintainer.js +3 -0
  140. package/lib/v2/tribalfootball/radar.js +13 -0
  141. package/lib/v2/tribalfootball/router.js +3 -0
  142. package/lib/v2/tribalfootball/templates/plus_header.art +6 -0
  143. package/lib/v2/youzhiyouxing/materials.js +5 -5
  144. package/lib/v2/zhihu/question.js +5 -3
  145. package/lib/v2/zhihu/router.js +1 -1
  146. package/lib/v2/zhihu/zhuanlan.js +2 -2
  147. package/package.json +19 -19
  148. package/lib/routes/universities/tjpyu/ooa.js +0 -73
  149. package/lib/v2/36kr/motif.js +0 -36
  150. package/lib/v2/36kr/news.js +0 -56
  151. package/lib/v2/36kr/newsflashes.js +0 -37
  152. package/lib/v2/36kr/search/article.js +0 -27
  153. package/lib/v2/36kr/user.js +0 -61
  154. package/lib/v2/houxu/templates/description.art +0 -9
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/': ['Rongronggg9'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'tribalfootball.com': {
3
+ _name: 'Tribal Football',
4
+ '.': [
5
+ {
6
+ title: 'Latest News',
7
+ docs: 'https://docs.rsshub.app/new-media.html#tribal-football',
8
+ source: ['/'],
9
+ target: '/tribalfootball',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/', require('./latest'));
3
+ };
@@ -0,0 +1,6 @@
1
+ {{ if header_image }}
2
+ <p>
3
+ <img src="{{ header_image }}">
4
+ </p>
5
+ {{ /if }}
6
+ {{@ desc }}
@@ -15,15 +15,15 @@ module.exports = async (ctx) => {
15
15
 
16
16
  const $ = cheerio.load(response.data);
17
17
 
18
- let items = $('li[phx-click="material"]')
18
+ let items = $('li[id*="material"]')
19
19
  .toArray()
20
20
  .map((item) => {
21
21
  item = $(item);
22
22
 
23
23
  return {
24
24
  title: item.text(),
25
- link: `${rootUrl}/materials/${item.attr('phx-value-id')}`,
26
- pubDate: parseDate(item.find('.tw-text-right').text(), ['YYYY年M月D日', 'M月D日']),
25
+ link: `${rootUrl}${item.find('a').attr('href')}`,
26
+ pubDate: parseDate(item.find('.tw-text-t-muted').text(), ['YYYY年M月D日', 'M月D日']),
27
27
  };
28
28
  });
29
29
 
@@ -38,7 +38,7 @@ module.exports = async (ctx) => {
38
38
  const content = cheerio.load(detailResponse.data);
39
39
 
40
40
  item.author = content('.tw-inline').text().replace('·', '');
41
- item.description = content('#zx-rangy-root')
41
+ item.description = content('#zx-material-marker-root')
42
42
  .html()
43
43
  .replace(/(<img.*?) src(=.*?>)/g, '$1 data$2')
44
44
  .replace(/(<img.*?) data-src(=.*?>)/g, '$1 src$2');
@@ -49,7 +49,7 @@ module.exports = async (ctx) => {
49
49
  );
50
50
 
51
51
  ctx.state.data = {
52
- title: `有知有行 - ${$(`a[phx-value-column_id="${id}"]`).text()}`,
52
+ title: `有知有行 - ${$(`a[phx-value-column_id="${id === '' ? 0 : id}"]`).text()}`,
53
53
  link: currentUrl,
54
54
  item: items,
55
55
  };
@@ -5,7 +5,10 @@ const g_encrypt = require('./execlib/g_encrypt');
5
5
  const { parseDate } = require('@/utils/parse-date');
6
6
 
7
7
  module.exports = async (ctx) => {
8
- const { questionId } = ctx.params;
8
+ const {
9
+ questionId,
10
+ sortBy = 'default', // default,created,updated
11
+ } = ctx.params;
9
12
  // Because the API of zhihu.com has changed, we must use the value of `d_c0` (extracted from cookies) to calculate
10
13
  // `x-zse-96`. So first get `d_c0`, then get the actual data of a ZhiHu question. In this way, we don't need to
11
14
  // require users to set the cookie in environmental variables anymore.
@@ -32,12 +35,11 @@ module.exports = async (ctx) => {
32
35
  const cookie = `d_c0=${cookie_mes}`;
33
36
 
34
37
  // second: get real data from zhihu
35
- const sort = 'updated'; // or default,created
36
38
  const limit = 20;
37
39
  const include =
38
40
  'data%5B*%5D.is_normal%2Cadmin_closed_comment%2Creward_info%2Cis_collapsed%2Cannotation_action%2Cannotation_detail%2Ccollapse_reason%2Cis_sticky%2Ccollapsed_by%2Csuggest_edit%2Ccomment_count%2Ccan_comment%2Ccontent%2Ceditable_content%2Cattachment%2Cvoteup_count%2Creshipment_settings%2Ccomment_permission%2Ccreated_time%2Cupdated_time%2Creview_info%2Crelevant_info%2Cquestion%2Cexcerpt%2Cis_labeled%2Cpaid_info%2Cpaid_info_content%2Crelationship.is_authorized%2Cis_author%2Cvoting%2Cis_thanked%2Cis_nothelp%2Cis_recognized%3Bdata%5B*%5D.mark_infos%5B*%5D.url%3Bdata%5B*%5D.author.follower_count%2Cbadge%5B*%5D.topics%3Bdata%5B*%5D.settings.table_of_content.enabled&offset=0';
39
41
  const rootUrl = 'https://www.zhihu.com';
40
- const apiPath = `/api/v4/questions/${questionId}/answers?include=${include}&limit=${limit}&sort_by=${sort}&platform=desktop`;
42
+ const apiPath = `/api/v4/questions/${questionId}/answers?include=${include}&limit=${limit}&sort_by=${sortBy}&platform=desktop`;
41
43
  const url = rootUrl + apiPath;
42
44
 
43
45
  // calculate x-zse-96, refer to https://github.com/srx-2000/spider_collection/issues/18
@@ -11,7 +11,7 @@ module.exports = (router) => {
11
11
  router.get('/pin/daily', require('./pin/daily'));
12
12
  router.get('/pin/hotlist', require('./pin/hotlist'));
13
13
  router.get('/posts/:usertype/:id', require('./posts'));
14
- router.get('/question/:questionId', require('./question'));
14
+ router.get('/question/:questionId/:sortBy?', require('./question'));
15
15
  router.get('/timeline', require('./timeline'));
16
16
  router.get('/topic/:topicId', require('./topic'));
17
17
  router.get('/weekly', require('./weekly'));
@@ -62,9 +62,9 @@ module.exports = async (ctx) => {
62
62
  author = item.author.name;
63
63
  pubDate = parseDate(item.created * 1000);
64
64
  } else if (item.type === 'zvideo') {
65
- // 官方 api 没有提供视频类的源 url, 故返回专栏页面 url
65
+ // 如果类型是zvideo,id即为视频地址参数
66
66
  title = item.title;
67
- link = url;
67
+ link = `https://www.zhihu.com/zvideo/${item.id}`;
68
68
  author = item.author.name;
69
69
  pubDate = parseDate(item.created_at * 1000);
70
70
  // 判断是否存在视频简介
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsshub",
3
- "version": "1.0.0-master.d3ce31d",
3
+ "version": "1.0.0-master.d4c8fa0",
4
4
  "description": "Make RSS Great Again!",
5
5
  "main": "lib/pkg.js",
6
6
  "files": [
@@ -42,22 +42,22 @@
42
42
  "homepage": "https://github.com/DIYgod/RSSHub#readme",
43
43
  "devDependencies": {
44
44
  "@napi-rs/pinyin": "1.7.0",
45
- "@types/koa": "2.13.4",
46
- "@vercel/nft": "0.20.1",
45
+ "@types/koa": "2.13.5",
46
+ "@vercel/nft": "0.21.0",
47
47
  "@vuepress/plugin-back-to-top": "1.9.7",
48
48
  "@vuepress/plugin-google-analytics": "1.9.7",
49
49
  "@vuepress/plugin-pwa": "1.9.7",
50
50
  "@vuepress/shared-utils": "1.9.7",
51
51
  "cross-env": "7.0.3",
52
- "eslint": "8.19.0",
52
+ "eslint": "8.20.0",
53
53
  "eslint-config-prettier": "8.5.0",
54
54
  "eslint-plugin-prettier": "4.2.1",
55
55
  "eslint-plugin-yml": "1.0.0",
56
56
  "fs-extra": "10.1.0",
57
- "jest": "28.1.2",
57
+ "jest": "28.1.3",
58
58
  "mockdate": "3.0.5",
59
- "nock": "13.2.8",
60
- "nodemon": "2.0.18",
59
+ "nock": "13.2.9",
60
+ "nodemon": "2.0.19",
61
61
  "prettier": "2.7.1",
62
62
  "prettier-check": "2.0.0",
63
63
  "pretty-quick": "3.1.3",
@@ -77,30 +77,30 @@
77
77
  "yorkie": "2.0.0"
78
78
  },
79
79
  "dependencies": {
80
- "@koa/router": "10.1.1",
80
+ "@koa/router": "12.0.0",
81
81
  "@postlight/mercury-parser": "2.2.1",
82
- "@sentry/node": "7.5.0",
82
+ "@sentry/node": "7.7.0",
83
83
  "aes-js": "3.1.2",
84
84
  "art-template": "4.13.2",
85
85
  "bbcodejs": "0.0.4",
86
86
  "cheerio": "1.0.0-rc.12",
87
87
  "chrono-node": "2.3.9",
88
- "city-timezones": "1.2.0",
88
+ "city-timezones": "1.2.1",
89
89
  "crypto-js": "4.1.1",
90
90
  "currency-symbol-map": "5.1.0",
91
- "dayjs": "1.11.3",
91
+ "dayjs": "1.11.4",
92
92
  "dotenv": "16.0.1",
93
93
  "emailjs-imap-client": "3.1.0",
94
94
  "entities": "3.0.1",
95
95
  "etag": "1.8.1",
96
96
  "fanfou-sdk": "4.2.0",
97
97
  "git-rev-sync": "3.0.2",
98
- "googleapis": "104.0.0",
98
+ "googleapis": "105.0.0",
99
99
  "got": "11.8.5",
100
100
  "https-proxy-agent": "5.0.1",
101
101
  "iconv-lite": "0.6.3",
102
102
  "instagram-private-api": "1.45.3",
103
- "ioredis": "5.1.0",
103
+ "ioredis": "5.2.1",
104
104
  "ip-regex": "4.3.0",
105
105
  "is-localhost-ip": "1.4.0",
106
106
  "jsdom": "20.0.0",
@@ -110,19 +110,19 @@
110
110
  "koa-basic-auth": "4.0.0",
111
111
  "koa-favicon": "2.1.0",
112
112
  "koa-mount": "4.0.0",
113
- "lru-cache": "7.12.0",
113
+ "lru-cache": "7.13.1",
114
114
  "lz-string": "1.4.4",
115
115
  "mailparser": "3.5.0",
116
116
  "markdown-it": "13.0.1",
117
117
  "module-alias": "2.2.2",
118
118
  "parse-torrent": "9.1.5",
119
119
  "pidusage": "3.0.0",
120
- "plist": "3.0.5",
121
- "puppeteer": "13.7.0",
122
- "puppeteer-extra": "3.3.0",
123
- "puppeteer-extra-plugin-stealth": "2.10.1",
120
+ "plist": "3.0.6",
121
+ "puppeteer": "15.4.0",
122
+ "puppeteer-extra": "3.3.4",
123
+ "puppeteer-extra-plugin-stealth": "2.11.0",
124
124
  "query-string": "7.1.1",
125
- "rand-user-agent": "1.0.70",
125
+ "rand-user-agent": "1.0.72",
126
126
  "re2": "1.17.7",
127
127
  "require-all": "3.0.0",
128
128
  "rss-parser": "3.12.0",
@@ -1,73 +0,0 @@
1
- const got = require('@/utils/got');
2
- const cheerio = require('cheerio');
3
-
4
- const ooa_base_url = 'http://oaa.tju.edu.cn/';
5
- const repo_url = 'https://github.com/DIYgod/RSSHub/issues';
6
-
7
- module.exports = async (ctx) => {
8
- const type = ctx.params && ctx.params.type;
9
- let path, subtitle;
10
-
11
- switch (type) {
12
- case 'news':
13
- subtitle = '新闻动态';
14
- path = 'zytz';
15
- break;
16
- case 'notification':
17
- subtitle = '通知公告';
18
- path = 'zygg';
19
- break;
20
- default:
21
- subtitle = '新闻动态';
22
- path = 'zytz';
23
- }
24
- let response = null;
25
- try {
26
- response = await got({
27
- method: 'get',
28
- url: ooa_base_url + path,
29
- headers: {
30
- Referer: ooa_base_url,
31
- },
32
- });
33
- } catch (e) {
34
- // ignore error handler
35
- // console.log(e);
36
- }
37
-
38
- if (response === null) {
39
- ctx.state.data = {
40
- title: '天津大学教务处 - ' + subtitle,
41
- link: ooa_base_url + path,
42
- description: '链接失效' + ooa_base_url + path,
43
- item: [
44
- {
45
- title: '提示信息',
46
- link: repo_url,
47
- description: `<h2>请到<a href=${repo_url}>此处</a>提交Issue</h2>`,
48
- },
49
- ],
50
- };
51
- } else {
52
- const $ = cheerio.load(response.data);
53
- const list = $('.iplan > ul > li').slice(0, 10);
54
-
55
- ctx.state.data = {
56
- title: '天津大学教务处 - ' + subtitle,
57
- link: ooa_base_url + path,
58
- description: null,
59
- item:
60
- list &&
61
- list
62
- .map((index, item) => ({
63
- title: $('h2', item)
64
- .text()
65
- .replace(/(\d+)-(\d+)-(\d+)$/, ''), // remove duplicate date at the end of h2 element
66
- pubDate: new Date($('span', item).text()).toUTCString(),
67
- link: $('a', item).attr('href'),
68
- description: $('p', item).text(),
69
- }))
70
- .get(),
71
- };
72
- }
73
- };
@@ -1,36 +0,0 @@
1
- const got = require('@/utils/got');
2
- const { parseDate } = require('@/utils/parse-date');
3
-
4
- module.exports = async (ctx) => {
5
- const motifUrl = `https://36kr.com/motif/${ctx.params.mid}`;
6
- const response = await got({
7
- method: 'get',
8
- url: motifUrl,
9
- });
10
- const data = JSON.parse(response.data.match(/"motifDetailData":{"code":0,"data":(.*?)},"channel":/)[1]);
11
-
12
- const motifInfo = data.motifInfo.data;
13
- const motifArticleList = data.motifArticleList.data.itemList;
14
- const articleList = motifArticleList.map((item) => ({
15
- title: item.templateMaterial.widgetTitle,
16
- link: `https://36kr.com/${item.route.split('?')[0] === 'detail_video' ? 'video' : 'p'}/${item.itemId}`,
17
- pubDate: parseDate(item.templateMaterial.publishTime),
18
- }));
19
-
20
- ctx.state.data = {
21
- title: `36氪专题 - ${motifInfo.categoryTitle}`,
22
- link: motifUrl,
23
- item: await Promise.all(
24
- articleList.map((item) =>
25
- ctx.cache.tryGet(item.link, async () => {
26
- const contentResponse = await got({ method: 'get', url: item.link });
27
- const result = contentResponse.data.match(/"articleDetailData":(.*?),"articleRecommendData":/) || contentResponse.data.match(/"videoDetail":(.*?),"authorVideos":/);
28
- const contentData = JSON.parse(result[1]);
29
- item.description = contentData.data.widgetContent;
30
- return item;
31
- })
32
- )
33
- ),
34
- description: motifInfo.categoryTitle,
35
- };
36
- };
@@ -1,56 +0,0 @@
1
- const got = require('@/utils/got');
2
- const cheerio = require('cheerio');
3
- const { parseDate } = require('@/utils/parse-date');
4
-
5
- const links = {
6
- latest: 'information/web_news',
7
- recommend: 'information/web_recommend',
8
- life: 'information/happy_life',
9
- estate: 'information/real_estate',
10
- workplace: 'information/web_zhichang',
11
- };
12
-
13
- module.exports = async (ctx) => {
14
- const category = ctx.params.category ?? 'latest';
15
-
16
- const rootUrl = 'https://36kr.com';
17
- const currentUrl = `${rootUrl}/${links.hasOwnProperty(category) ? links[category] : `information/${category}`}`;
18
-
19
- const response = await got({
20
- method: 'get',
21
- url: currentUrl,
22
- });
23
-
24
- const data = JSON.parse(response.data.match(/<script>window\.initialState=(.*?)<\/script>/)[1]);
25
-
26
- const list = data.information.informationList.itemList
27
- .filter((item) => item.itemType === 10)
28
- .map((item) => ({
29
- title: item.templateMaterial.widgetTitle,
30
- link: `${rootUrl}/p/${item.itemId} `,
31
- pubDate: parseDate(item.templateMaterial.publishTime),
32
- }));
33
-
34
- const items = await Promise.all(
35
- list.map((item) =>
36
- ctx.cache.tryGet(item.link, async () => {
37
- const detailResponse = await got({
38
- method: 'get',
39
- url: item.link,
40
- });
41
-
42
- const content = cheerio.load(detailResponse.data);
43
-
44
- item.description = content('.articleDetailContent').html();
45
-
46
- return item;
47
- })
48
- )
49
- );
50
-
51
- ctx.state.data = {
52
- title: `${response.data.match(/shareTitle: "(.*)频道.*",/)[1]} - 36氪资讯`,
53
- link: currentUrl,
54
- item: items,
55
- };
56
- };
@@ -1,37 +0,0 @@
1
- const got = require('@/utils/got');
2
- const { parseDate } = require('@/utils/parse-date');
3
-
4
- module.exports = async (ctx) => {
5
- const response = await got({
6
- method: 'get',
7
- url: `https://36kr.com/newsflashes`,
8
- headers: {
9
- Host: '36kr.com',
10
- 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25',
11
- },
12
- });
13
- const regexp = /<script>window\.initialState=(.*?)<\/script>/;
14
- const newsflashes = JSON.parse(response.data.match(regexp)[1]);
15
-
16
- const out = newsflashes.newsflashList.flow.itemList.map((item) => {
17
- const link = item.templateMaterial.sourceUrlRoute ? new URL(`http://www.example.com/${item.templateMaterial.sourceUrlRoute}`).searchParams.get('url') : `https://36kr.com/newsflashes/${item.itemId}`;
18
- const date = item.templateMaterial.publishTime;
19
- const title = item.templateMaterial.widgetTitle;
20
- const description = item.templateMaterial.widgetContent;
21
-
22
- const single = {
23
- title,
24
- link,
25
- pubDate: parseDate(date),
26
- description,
27
- };
28
-
29
- return single;
30
- });
31
-
32
- ctx.state.data = {
33
- title: `快讯 - 36氪`,
34
- link: `https://36kr.com/newsflashes`,
35
- item: out,
36
- };
37
- };
@@ -1,27 +0,0 @@
1
- const got = require('@/utils/got');
2
- const { parseDate } = require('@/utils/parse-date');
3
-
4
- module.exports = async (ctx) => {
5
- const keyword = ctx.params.keyword ?? '';
6
-
7
- const rootUrl = 'https://www.36kr.com';
8
- const currentUrl = `${rootUrl}/search/articles/${keyword}`;
9
-
10
- const response = await got({
11
- method: 'get',
12
- url: currentUrl,
13
- });
14
-
15
- const items = JSON.parse(response.data.match(/"itemList":(.*),"pageCallback"/)[1]).map((item) => ({
16
- title: item.widgetTitle.replace(/<\/?em>/g, ''),
17
- link: `${rootUrl}/p/${item.itemId}`,
18
- description: `<p>${item.content}</p>`,
19
- pubDate: parseDate(item.publishTime),
20
- }));
21
-
22
- ctx.state.data = {
23
- title: `36氪 - ${keyword}相关文章`,
24
- link: currentUrl,
25
- item: items,
26
- };
27
- };
@@ -1,61 +0,0 @@
1
- const got = require('@/utils/got');
2
- const { parseDate } = require('@/utils/parse-date');
3
-
4
- module.exports = async (ctx) => {
5
- const id = ctx.params.id;
6
-
7
- const rootUrl = 'https://36kr.com';
8
- const apiRootUrl = 'https://gateway.36kr.com';
9
- const currentUrl = `${rootUrl}/user/${id}`;
10
-
11
- const infoResponse = await got({
12
- method: 'post',
13
- url: `${apiRootUrl}/api/mis/user/info`,
14
- json: {
15
- param: {
16
- userId: id,
17
- siteId: 1,
18
- platformId: 2,
19
- },
20
- platformId: 2,
21
- siteId: 1,
22
- userId: id,
23
- partner_id: 'web',
24
- },
25
- });
26
-
27
- const response = await got({
28
- method: 'post',
29
- url: `${apiRootUrl}/api/mis/me/article`,
30
- json: {
31
- param: {
32
- userId: id,
33
- pageEvent: 0,
34
- pageSize: 20,
35
- pageCallback: '',
36
- siteId: 1,
37
- platformId: 2,
38
- },
39
- pageCallback: '',
40
- pageEvent: 0,
41
- pageSize: 20,
42
- platformId: 2,
43
- siteId: 1,
44
- userId: id,
45
- partner_id: 'web',
46
- },
47
- });
48
-
49
- const items = response.data.data.itemList.map((item) => ({
50
- title: item.templateMaterial.widgetTitle,
51
- link: `${rootUrl}/p/${item.itemId}`,
52
- pubDate: parseDate(item.templateMaterial.publishTime),
53
- description: `<p>${item.templateMaterial.widgetContent}</p>`,
54
- }));
55
-
56
- ctx.state.data = {
57
- title: `36kr - ${infoResponse.data.data.userNick}`,
58
- link: currentUrl,
59
- item: items,
60
- };
61
- };
@@ -1,9 +0,0 @@
1
- <div>
2
- <h3>
3
- <a href="{{ link }}">{{ title }}</a>
4
- </h3>
5
- <p>{{ description }}</p>
6
- <small><b>来源</b> {{ author }}</small>
7
- <br>
8
- <small><b>时间</b> {{ pubDate }}</small>
9
- </div>