rsshub 1.0.0-master.baeafb9 → 1.0.0-master.bb80a2e

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 (104) hide show
  1. package/README.md +4 -3
  2. package/lib/config.js +4 -0
  3. package/lib/middleware/cache/index.js +3 -3
  4. package/lib/middleware/cache/memory.js +5 -11
  5. package/lib/router.js +23 -22
  6. package/lib/routes/amd/graphicsdrivers.js +1 -1
  7. package/lib/routes/weibo/keyword.js +18 -10
  8. package/lib/routes/weibo/super_index.js +24 -15
  9. package/lib/routes/weibo/timeline.js +37 -14
  10. package/lib/routes/weibo/user.js +42 -18
  11. package/lib/routes/weibo/utils.js +39 -0
  12. package/lib/utils/parse-date.js +171 -17
  13. package/lib/utils/torrent.js +9 -1
  14. package/lib/v2/asus/bios.js +38 -0
  15. package/lib/v2/asus/maintainer.js +3 -0
  16. package/lib/v2/asus/radar.js +13 -0
  17. package/lib/v2/asus/router.js +3 -0
  18. package/lib/v2/asus/templates/bios.art +6 -0
  19. package/lib/v2/douban/people/status.js +10 -2
  20. package/lib/v2/douban/people/wish.js +55 -43
  21. package/lib/v2/gov/anhui/kjt.js +56 -0
  22. package/lib/v2/gov/maintainer.js +1 -0
  23. package/lib/v2/gov/radar.js +90 -76
  24. package/lib/v2/gov/router.js +1 -0
  25. package/lib/v2/hupu/all.js +73 -0
  26. package/lib/v2/hupu/bbs.js +64 -0
  27. package/lib/v2/hupu/index.js +72 -0
  28. package/lib/v2/hupu/maintainer.js +7 -0
  29. package/lib/v2/hupu/radar.js +35 -0
  30. package/lib/v2/hupu/router.js +7 -0
  31. package/lib/v2/hupu/templates/description.art +6 -0
  32. package/lib/{routes → v2}/ifeng/feng.js +7 -5
  33. package/lib/v2/ifeng/maintainer.js +3 -0
  34. package/lib/v2/ifeng/radar.js +11 -0
  35. package/lib/v2/ifeng/router.js +3 -0
  36. package/lib/{routes → v2}/ifeng/utils.js +0 -0
  37. package/lib/v2/kakuyomu/episode.js +54 -0
  38. package/lib/v2/kakuyomu/maintainer.js +3 -0
  39. package/lib/v2/kakuyomu/radar.js +13 -0
  40. package/lib/v2/kakuyomu/router.js +1 -0
  41. package/lib/v2/mihoyo/bbs.js +62 -0
  42. package/lib/v2/mihoyo/maintainer.js +3 -0
  43. package/lib/v2/mihoyo/radar.js +31 -0
  44. package/lib/v2/mihoyo/router.js +3 -0
  45. package/lib/v2/mihoyo/templates/description.art +6 -0
  46. package/lib/{routes → v2}/mpaypass/main.js +23 -27
  47. package/lib/v2/mpaypass/maintainer.js +4 -0
  48. package/lib/v2/mpaypass/news.js +39 -0
  49. package/lib/v2/mpaypass/radar.js +19 -0
  50. package/lib/v2/mpaypass/router.js +4 -0
  51. package/lib/v2/natgeo/dailyphoto.js +32 -0
  52. package/lib/v2/natgeo/dailyselection.js +41 -0
  53. package/lib/v2/natgeo/maintainer.js +5 -0
  54. package/lib/{routes → v2}/natgeo/natgeo.js +18 -32
  55. package/lib/v2/natgeo/radar.js +24 -0
  56. package/lib/v2/natgeo/router.js +5 -0
  57. package/lib/v2/natgeo/templates/dailyPhoto.art +5 -0
  58. package/lib/v2/nuaa/cs/index.js +87 -0
  59. package/lib/v2/nuaa/jwc/jwc.js +82 -0
  60. package/lib/v2/nuaa/maintainer.js +5 -0
  61. package/lib/v2/nuaa/radar.js +23 -0
  62. package/lib/v2/nuaa/router.js +5 -0
  63. package/lib/{routes/universities → v2}/nuaa/utils/pypasswaf.js +1 -1
  64. package/lib/{routes/universities → v2}/nuaa/yjsy/yjsy.js +16 -22
  65. package/lib/v2/picuki/profile.js +12 -3
  66. package/lib/v2/pubmed/maintainer.js +3 -0
  67. package/lib/v2/pubmed/radar.js +13 -0
  68. package/lib/v2/pubmed/router.js +3 -0
  69. package/lib/v2/pubmed/templates/description.art +7 -0
  70. package/lib/v2/pubmed/trending.js +58 -0
  71. package/lib/v2/qweather/3days.js +46 -0
  72. package/lib/v2/qweather/maintainer.js +4 -0
  73. package/lib/v2/qweather/now.js +46 -0
  74. package/lib/v2/qweather/router.js +4 -0
  75. package/lib/v2/qweather/util/3days.art +20 -0
  76. package/lib/v2/qweather/util/now.art +16 -0
  77. package/lib/v2/telegram/channel.js +10 -6
  78. package/lib/v2/test/index.js +1 -1
  79. package/lib/{routes → v2}/thepaper/839studio/category.js +0 -0
  80. package/lib/{routes → v2}/thepaper/839studio/studio.js +0 -0
  81. package/lib/{routes → v2}/thepaper/channel.js +0 -0
  82. package/lib/v2/thepaper/factpaper.js +61 -0
  83. package/lib/{routes → v2}/thepaper/featured.js +0 -0
  84. package/lib/{routes → v2}/thepaper/list.js +0 -0
  85. package/lib/v2/thepaper/maintainer.js +8 -0
  86. package/lib/v2/thepaper/radar.js +42 -0
  87. package/lib/v2/thepaper/router.js +8 -0
  88. package/lib/v2/thepaper/templates/factpaper.art +12 -0
  89. package/lib/v2/thepaper/utils.js +55 -0
  90. package/lib/v2/zooTeam/blog.js +32 -0
  91. package/lib/v2/zooTeam/maintainer.js +4 -0
  92. package/lib/v2/zooTeam/radar.js +21 -0
  93. package/lib/v2/zooTeam/router.js +4 -0
  94. package/lib/v2/zooTeam/weekly.js +34 -0
  95. package/package.json +12 -8
  96. package/lib/routes/hupu/all.js +0 -53
  97. package/lib/routes/hupu/bbs.js +0 -83
  98. package/lib/routes/hupu/dept.js +0 -66
  99. package/lib/routes/mpaypass/news.js +0 -43
  100. package/lib/routes/natgeo/dailyphoto.js +0 -27
  101. package/lib/routes/pubmed/trending.js +0 -65
  102. package/lib/routes/thepaper/utils.js +0 -48
  103. package/lib/routes/universities/nuaa/cs/index.js +0 -84
  104. package/lib/routes/universities/nuaa/jwc/jwc.js +0 -105
@@ -1,42 +1,196 @@
1
1
  const dayjs = require('dayjs');
2
2
  dayjs.extend(require('dayjs/plugin/customParseFormat'));
3
+ dayjs.extend(require('dayjs/plugin/duration'));
4
+ dayjs.extend(require('dayjs/plugin/weekday'));
5
+
6
+ const words = [
7
+ {
8
+ startAt: dayjs(),
9
+ regExp: /^(?:今(?:天|日)|t(?:o)?da(?:y)?)(.*)/,
10
+ },
11
+ {
12
+ startAt: dayjs().subtract(1, 'days'),
13
+ regExp: /^(?:昨(?:天|日)|y(?:ester)?da(?:y)?)(.*)/,
14
+ },
15
+ {
16
+ startAt: dayjs().subtract(2, 'days'),
17
+ regExp: /^(?:前天|(?:the)?d(?:ay)?b(?:eforeyesterda)?y)(.*)/,
18
+ },
19
+ {
20
+ startAt: dayjs().isBefore(dayjs().weekday(1)) ? dayjs().weekday(1).subtract(1, 'week') : dayjs().weekday(1),
21
+ regExp: /^(?:周|星期)一(.*)/,
22
+ },
23
+ {
24
+ startAt: dayjs().isBefore(dayjs().weekday(2)) ? dayjs().weekday(2).subtract(1, 'week') : dayjs().weekday(2),
25
+ regExp: /^(?:周|星期)二(.*)/,
26
+ },
27
+ {
28
+ startAt: dayjs().isBefore(dayjs().weekday(3)) ? dayjs().weekday(3).subtract(1, 'week') : dayjs().weekday(3),
29
+ regExp: /^(?:周|星期)三(.*)/,
30
+ },
31
+ {
32
+ startAt: dayjs().isBefore(dayjs().weekday(4)) ? dayjs().weekday(4).subtract(1, 'week') : dayjs().weekday(4),
33
+ regExp: /^(?:周|星期)四(.*)/,
34
+ },
35
+ {
36
+ startAt: dayjs().isBefore(dayjs().weekday(5)) ? dayjs().weekday(5).subtract(1, 'week') : dayjs().weekday(5),
37
+ regExp: /^(?:周|星期)五(.*)/,
38
+ },
39
+ {
40
+ startAt: dayjs().isBefore(dayjs().weekday(6)) ? dayjs().weekday(6).subtract(1, 'week') : dayjs().weekday(6),
41
+ regExp: /^(?:周|星期)六(.*)/,
42
+ },
43
+ {
44
+ startAt: dayjs().isBefore(dayjs().weekday(7)) ? dayjs().weekday(7).subtract(1, 'week') : dayjs().weekday(7),
45
+ regExp: /^(?:周|星期)(?:日|天)(.*)/,
46
+ },
47
+ {
48
+ startAt: dayjs().add(1, 'days'),
49
+ regExp: /^(?:明(?:天|日)|y(?:ester)?da(?:y)?)(.*)/,
50
+ },
51
+ {
52
+ startAt: dayjs().add(2, 'days'),
53
+ regExp: /^(?:(?:后|後)(?:天|日)|(?:the)?d(?:ay)?a(?:fter)?t(?:omrrow)?)(.*)/,
54
+ },
55
+ ];
3
56
 
4
57
  const patterns = [
5
58
  {
6
- regexp: /^(\d+)分钟前$/,
7
- handler: (minute) => dayjs().subtract(minute, 'minutes'),
59
+ unit: 'years',
60
+ regExp: /(\d+)(?:年|y(?:ea)?r(?:s)?)/,
61
+ },
62
+ {
63
+ unit: 'months',
64
+ regExp: /(\d+)(?:(?:个|個)?月|month(?:s)?)/,
8
65
  },
9
66
  {
10
- regexp: /^(\d+)小时前$/,
11
- handler: (hour) => dayjs().subtract(hour, 'hours'),
67
+ unit: 'weeks',
68
+ regExp: /(\d+)(?:周|(?:个|個)?星期|week(?:s)?)/,
12
69
  },
13
70
  {
14
- regexp: /^(\d+)天前$/,
15
- handler: (day) => dayjs().subtract(day, 'days'),
71
+ unit: 'days',
72
+ regExp: /(\d+)(?:天|日|day(?:s)?)/,
16
73
  },
17
74
  {
18
- regexp: /^今天\s*((\d+:\d+)?)$/,
19
- handler: (hm) => dayjs(hm || '0:0', ['HH:m', 'HH:mm', 'H:m', 'H:mm']),
75
+ unit: 'hours',
76
+ regExp: /(\d+)(?:(?:个|個)?(?:(?:小)?时|時|点|點)|h(?:ou)?r(?:s)?)/,
20
77
  },
21
78
  {
22
- regexp: /^昨天\s*((\d+:\d+)?)$/,
23
- handler: (hm) => dayjs(hm || '0:0', ['HH:m', 'HH:mm', 'H:m', 'H:mm']).subtract(1, 'day'),
79
+ unit: 'minutes',
80
+ regExp: /(\d+)(?:分(?:钟|鐘)?|min(?:ute)?(?:s)?)/,
24
81
  },
25
82
  {
26
- regexp: /^前天\s*((\d+:\d+)?)$/,
27
- handler: (hm) => dayjs(hm || '0:0', ['HH:m', 'HH:mm', 'H:m', 'H:mm']).subtract(2, 'day'),
83
+ unit: 'seconds',
84
+ regExp: /(\d+)(?:秒(?:钟|鐘)?|sec(?:ond)?(?:s)?)/,
28
85
  },
29
86
  ];
30
87
 
88
+ const patternSize = Object.keys(patterns).length;
89
+
90
+ /**
91
+ * 预处理日期字符串
92
+ * @param {String} date 原始日期字符串
93
+ */
94
+ const toDate = (date) =>
95
+ date
96
+ .toLowerCase()
97
+ .replace(/(^a(?:n)?\s)|(\sa(?:n)?\s)/g, '1') // 替换 `a` 和 `an` 为 `1`
98
+ .replace(/几|幾/g, '3') // 如 `几秒钟前` 视作 `3秒钟前`
99
+ .replace(/[\s,]/g, ''); // 移除所有空格
100
+
101
+ /**
102
+ * 将 `['\d+时', ..., '\d+秒']` 转换为 `{ hours: \d+, ..., seconds: \d+ }`
103
+ * 用于描述时间长度
104
+ * @param {Array.<String>} matches 所有匹配结果
105
+ */
106
+ const toDurations = (matches) => {
107
+ const durations = {};
108
+
109
+ let p = 0;
110
+ for (const m of matches) {
111
+ for (; p <= patternSize; p++) {
112
+ const match = patterns[p].regExp.exec(m);
113
+ if (match) {
114
+ durations[patterns[p].unit] = match[1];
115
+ break;
116
+ }
117
+ }
118
+ }
119
+ return durations;
120
+ };
121
+
31
122
  module.exports = {
32
123
  parseDate: (date, ...options) => dayjs(date, ...options).toDate(),
33
124
  parseRelativeDate: (date) => {
34
- for (const pattern of patterns) {
35
- const match = pattern.regexp.exec(date);
36
- if (match !== null) {
37
- return pattern.handler(match[1]).toDate();
125
+ // 预处理日期字符串 date
126
+
127
+ const theDate = toDate(date);
128
+
129
+ // 将 `\d+年\d+月...\d+秒前` 分割成 `['\d+年', ..., '\d+秒前']`
130
+
131
+ const matches = theDate.match(/(?:\D+)?\d+(?!:|-|\/)\D+/g);
132
+
133
+ if (matches) {
134
+ // 获得最后的时间单元,如 `\d+秒前`
135
+
136
+ const lastMatch = matches.pop();
137
+
138
+ // 若最后的时间单元含有 `前`、`以前`、`之前` 等标识字段,减去相应的时间长度
139
+ // 如 `1分10秒前`
140
+
141
+ const beforeMatches = /(.*)(?:(?:之|以)?前|ago)$/.exec(lastMatch);
142
+ if (beforeMatches) {
143
+ matches.push(beforeMatches[1]);
144
+ return dayjs()
145
+ .subtract(dayjs.duration(toDurations(matches)))
146
+ .toDate();
147
+ }
148
+
149
+ // 若最后的时间单元含有 `后`、`以后`、`之后` 等标识字段,加上相应的时间长度
150
+ // 如 `1分10秒后`
151
+
152
+ const afterMatches = /(?:^in(.*)|(.*)(?:之|以)?(?:后|後))$/.exec(lastMatch);
153
+ if (afterMatches) {
154
+ matches.push(afterMatches[1] ?? afterMatches[2]);
155
+ return dayjs()
156
+ .add(dayjs.duration(toDurations(matches)))
157
+ .toDate();
158
+ }
159
+
160
+ // 以下处理日期字符串 date 含有特殊词的情形
161
+ // 如 `今天1点10分`
162
+
163
+ matches.push(lastMatch);
164
+ const firstMatch = matches.shift();
165
+
166
+ for (const w of words) {
167
+ const wordMatches = w.regExp.exec(firstMatch);
168
+ if (wordMatches) {
169
+ matches.unshift(wordMatches[1]);
170
+
171
+ // 取特殊词对应日零时为起点,加上相应的时间长度
172
+
173
+ return w.startAt
174
+ .set('hour', 0)
175
+ .set('minute', 0)
176
+ .set('second', 0)
177
+ .set('millisecond', 0)
178
+ .add(dayjs.duration(toDurations(matches)))
179
+ .toDate();
180
+ }
181
+ }
182
+ } else {
183
+ // 若日期字符串 date 不匹配 patterns 中所有模式,则默认为 `特殊词 + 标准时间格式` 的情形,此时直接将特殊词替换为对应日期
184
+ // 如今天为 `2022-03-22`,则 `今天 20:00` => `2022-03-22 20:00`
185
+
186
+ for (const w of words) {
187
+ const wordMatches = w.regExp.exec(theDate);
188
+ if (wordMatches) {
189
+ return dayjs(`${w.startAt.format('YYYY-MM-DD')} ${wordMatches[1]}`).toDate();
190
+ }
38
191
  }
39
192
  }
40
- return null;
193
+
194
+ return date;
41
195
  },
42
196
  };
@@ -60,6 +60,7 @@ class HDHome extends TorrentProvider {
60
60
  );
61
61
  }
62
62
  }
63
+
63
64
  TorrentSearchApi.loadProvider(HDHome);
64
65
 
65
66
  const allProviders = ['HDHome', 'Rarbg', '1337x', 'Yts', 'Eztv'];
@@ -119,7 +120,14 @@ module.exports = {
119
120
 
120
121
  const keyword = keywords[0];
121
122
  const normalizeKeyword = normalize(keyword);
122
- const torrents = await TorrentSearchApi.search(providers, keywords.join(' '), category);
123
+ let torrents;
124
+ try {
125
+ torrents = await TorrentSearchApi.search(providers, keywords.join(' '), category);
126
+ } catch (e) {
127
+ // expect a status code error, but we don't mind catching all errors here
128
+ // logger.debug(e);
129
+ return {};
130
+ }
123
131
  if (torrents && torrents.length > 0) {
124
132
  let bestRating = 0;
125
133
  let bestSize = 0;
@@ -0,0 +1,38 @@
1
+ const got = require('@/utils/got');
2
+ const { parseDate } = require('@/utils/parse-date');
3
+ const { art } = require('@/utils/render');
4
+ const path = require('path');
5
+
6
+ const getProductID = async (model) => {
7
+ const searchAPI = `https://odinapi.asus.com.cn/recent-data/apiv2/SearchSuggestion?SystemCode=asus&WebsiteCode=cn&SearchKey=${model}&SearchType=ProductsAll&RowLimit=4&sitelang=cn`;
8
+ const response = await got(searchAPI);
9
+
10
+ return {
11
+ productID: response.data.Result[0].Content[0].DataId,
12
+ url: response.data.Result[0].Content[0].Url,
13
+ };
14
+ };
15
+
16
+ module.exports = async (ctx) => {
17
+ const model = ctx.params.model;
18
+ const { productID, url } = await getProductID(model);
19
+ const biosAPI = `https://www.asus.com.cn/support/api/product.asmx/GetPDBIOS?website=cn&model=${model}&pdid=${productID}&sitelang=cn`;
20
+
21
+ const response = await got(biosAPI);
22
+ const biosList = response.data.Result.Obj[0].Files;
23
+
24
+ const items = biosList.map((item) => ({
25
+ title: item.Title,
26
+ description: art(path.join(__dirname, 'templates/bios.art'), {
27
+ item,
28
+ }),
29
+ pubDate: parseDate(item.ReleaseDate, 'YYYY/MM/DD'),
30
+ link: url,
31
+ }));
32
+
33
+ ctx.state.data = {
34
+ title: `${model} BIOS`,
35
+ link: url,
36
+ item: items,
37
+ };
38
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/bios/:model': ['Fatpandac'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'asus.com.cn': {
3
+ _name: 'Asus 华硕',
4
+ '.': [
5
+ {
6
+ title: '固件',
7
+ docs: 'https://docs.rsshub.app/program-update.html#hua-shuo',
8
+ source: ['/'],
9
+ target: '/bios/:model',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = function (router) {
2
+ router.get('/bios/:model', require('./bios'));
3
+ };
@@ -0,0 +1,6 @@
1
+ <p>更新信息:</p>
2
+ {{@ item.Description}}
3
+ <p>版本: {{item.Version}}</p>
4
+ <p>大小: {{item.FileSize}}</p>
5
+ <p>更新日期: {{item.ReleaseDate}}</p>
6
+ <p>下载链接: <a href="{{item.DownloadUrl.China}}">中国下载</a> | <a href="{{item.DownloadUrl.Global}}">全球下载</a></p>
@@ -1,6 +1,7 @@
1
1
  const querystring = require('querystring');
2
2
  const got = require('@/utils/got');
3
3
  const { fallback, queryToBoolean, queryToInteger } = require('@/utils/readable-social');
4
+ const config = require('@/config').value;
4
5
 
5
6
  const headers = { Referer: `https://m.douban.com/` };
6
7
 
@@ -466,8 +467,15 @@ async function getFullTextItems(ctx, items) {
466
467
  module.exports = async (ctx) => {
467
468
  const userid = ctx.params.userid;
468
469
  const url = `https://m.douban.com/rexxar/api/v2/status/user_timeline/${userid}`;
469
- const response = await got({ url, headers });
470
- const items = response.data.items;
470
+ const items = await ctx.cache.tryGet(
471
+ url,
472
+ async () => {
473
+ const _r = await got({ url, headers });
474
+ return _r.data.items;
475
+ },
476
+ config.cache.routeExpire,
477
+ false
478
+ );
471
479
 
472
480
  if (items) {
473
481
  await getFullTextItems(ctx, items);
@@ -13,6 +13,8 @@ module.exports = async (ctx) => {
13
13
  const torrentMinRating = routeParams.torrentMinRating ? parseFloat(routeParams.torrentMinRating) : 0.5;
14
14
  const torrentSkipNoMatch = routeParams.torrentSkipNoMatch === 'true';
15
15
 
16
+ let userName;
17
+
16
18
  const pageSize = 15;
17
19
  const pagesCount = routeParams.pagesCount ? parseInt(routeParams.pagesCount) : 1;
18
20
  const tasks = [];
@@ -20,51 +22,61 @@ module.exports = async (ctx) => {
20
22
  const url = `https://movie.douban.com/people/${userid}/wish?start=${page * pageSize}`;
21
23
 
22
24
  tasks.push(
23
- got({
24
- method: 'GET',
25
- url,
26
- headers: {
27
- Referer: url,
28
- Cookie: config.douban.cookie || '',
29
- },
30
- }).then((response) => {
31
- const data = response.data;
32
- const $ = cheerio.load(data);
33
- const list = $('div.article > div.grid-view > div.item');
25
+ ctx.cache
26
+ .tryGet(
27
+ url,
28
+ async () => {
29
+ const _r = await got({
30
+ method: 'GET',
31
+ url,
32
+ headers: {
33
+ Referer: url,
34
+ Cookie: config.douban.cookie || '',
35
+ },
36
+ });
37
+ return _r.data;
38
+ },
39
+ config.cache.routeExpire,
40
+ false
41
+ )
42
+ .then((data) => {
43
+ const $ = cheerio.load(data);
44
+ const list = $('div.article > div.grid-view > div.item');
45
+ userName = userName || $('div.side-info-txt > h3').text();
34
46
 
35
- if (list) {
36
- return Promise.all(
37
- list.get().map(async (item) => {
38
- item = $(item);
39
- const itemPicUrl = item.find('.pic a img').attr('src');
40
- const info = item.find('.info');
41
- const title = info.find('ul li.title a').text();
42
- const url = info.find('ul li.title a').attr('href');
43
- const titles = title.split('/').filter((title) => title.trim());
44
- const day = info.find('ul li .date').text().trim();
45
- const rssItem = {
46
- title: titles[0],
47
- description: `${info.find('.intro').text()}<br><img src="${itemPicUrl}">`,
48
- link: url,
49
- pubDate: new Date(day),
50
- };
47
+ if (list) {
48
+ return Promise.all(
49
+ list.get().map(async (item) => {
50
+ item = $(item);
51
+ const itemPicUrl = item.find('.pic a img').attr('src');
52
+ const info = item.find('.info');
53
+ const title = info.find('ul li.title a').text();
54
+ const url = info.find('ul li.title a').attr('href');
55
+ const titles = title.split('/').filter((title) => title.trim());
56
+ const day = info.find('ul li .date').text().trim();
57
+ const rssItem = {
58
+ title: titles[0],
59
+ description: `${info.find('.intro').text()}<br><img src="${itemPicUrl}">`,
60
+ link: url,
61
+ pubDate: new Date(day),
62
+ };
51
63
 
52
- if (routeParams.torrentProvider) {
53
- const category = url.indexOf('movie.douban.com') > 0 ? 'Movies' : 'TV';
54
- const keyword = titles.length > 1 ? titles[1] : titles[0];
55
- let keywords = [keyword];
56
- if (routeParams.torrentQuery) {
57
- keywords = keywords.concat(routeParams.torrentQuery.split(','));
64
+ if (routeParams.torrentProvider) {
65
+ const category = url.indexOf('movie.douban.com') > 0 ? 'Movies' : 'TV';
66
+ const keyword = titles.length > 1 ? titles[1] : titles[0];
67
+ let keywords = [keyword];
68
+ if (routeParams.torrentQuery) {
69
+ keywords = keywords.concat(routeParams.torrentQuery.split(','));
70
+ }
71
+ const result = await torrent.get(providers, routeParams, keywords, category, torrentMinSeeds, torrentMinRating);
72
+ return Object.assign(rssItem, result);
73
+ } else {
74
+ return rssItem;
58
75
  }
59
- const result = await torrent.get(providers, routeParams, keywords, category, torrentMinSeeds, torrentMinRating);
60
- return Object.assign(rssItem, result);
61
- } else {
62
- return rssItem;
63
- }
64
- })
65
- );
66
- }
67
- })
76
+ })
77
+ );
78
+ }
79
+ })
68
80
  );
69
81
  }
70
82
 
@@ -73,7 +85,7 @@ module.exports = async (ctx) => {
73
85
  items = items.filter((item) => item.enclosure_url && item.enclosure_url.length > 0);
74
86
  }
75
87
  ctx.state.data = {
76
- title: `豆瓣想看 - ${userid}`,
88
+ title: `豆瓣想看 - ${userName || userid}`,
77
89
  link: `https://movie.douban.com/people/${userid}/wish`,
78
90
  item: items,
79
91
  };
@@ -0,0 +1,56 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const timezone = require('@/utils/timezone');
4
+ const { parseDate } = require('@/utils/parse-date');
5
+
6
+ module.exports = async (ctx) => {
7
+ const params = ctx.params[0] ?? 'kjzx/tzgg';
8
+
9
+ const rootUrl = 'http://kjt.ah.gov.cn';
10
+ const currentUrl = `${rootUrl}/${params}/index.html`;
11
+
12
+ const response = await got({
13
+ method: 'get',
14
+ url: currentUrl,
15
+ });
16
+
17
+ const $ = cheerio.load(response.data);
18
+
19
+ let items = $('.doc_list li')
20
+ .not('.columnName')
21
+ .find('a')
22
+ .toArray()
23
+ .map((item) => {
24
+ item = $(item);
25
+
26
+ return {
27
+ title: item.text(),
28
+ link: item.attr('href'),
29
+ };
30
+ });
31
+
32
+ items = await Promise.all(
33
+ items.map((item) =>
34
+ ctx.cache.tryGet(item.link, async () => {
35
+ const detailResponse = await got({
36
+ method: 'get',
37
+ url: item.link,
38
+ });
39
+
40
+ const content = cheerio.load(detailResponse.data);
41
+
42
+ item.description = content('.wzcon').html();
43
+ item.author = content('meta[name="Author"]').attr('content');
44
+ item.pubDate = timezone(parseDate(content('meta[name="PubDate"]').attr('content')), +8);
45
+
46
+ return item;
47
+ })
48
+ )
49
+ );
50
+
51
+ ctx.state.data = {
52
+ title: $('title').text(),
53
+ link: currentUrl,
54
+ item: items,
55
+ };
56
+ };
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ '/anhui/kjt/:path?': ['nczitzk'],
2
3
  '/beijing/kw/:channel': ['Fatpandac'],
3
4
  '/shenzhen/hrss/szksy/:caty/:page?': ['zlasd'],
4
5
  '/shenzhen/zzb/:caty/:page?': ['zlasd'],