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,24 @@
1
+ {{ if pictures }}
2
+ {{ each pictures picture }}
3
+ <img src="{{ picture.src }}"
4
+ {{ if picture.w }}
5
+ weight="{{ picture.w }}"
6
+ {{ /if }}
7
+ {{ if picture.h }}
8
+ height="{{ picture.h }}"
9
+ {{ /if }}
10
+ >
11
+ {{ /each }}
12
+ {{ /if }}
13
+ {{ if fields.length != 0 }}
14
+ <table>
15
+ <tbody>
16
+ {{ each fields field }}
17
+ <tr>
18
+ <th>{{ field.key }}</th>
19
+ <td>{{ field.value }}</td>
20
+ </tr>
21
+ {{ /each }}
22
+ </tbody>
23
+ </table>
24
+ {{ /if }}
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/master/:type': ['nilleo'],
3
+ };
@@ -0,0 +1,78 @@
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
+ const title_map = {
7
+ tzgg: '通知公告',
8
+ zsxx: '硕士招生信息',
9
+ pyxx: '研究生培养信息',
10
+ };
11
+ const description_map = {
12
+ tzgg: '通知公告',
13
+ zsxx: '硕士招生信息',
14
+ pyxx: '研究生培养信息',
15
+ };
16
+ const url_map = {
17
+ tzgg: 'tzgg',
18
+ zsxx: 'zsxx/sszsxx',
19
+ pyxx: 'pyxx/pyxx',
20
+ };
21
+
22
+ module.exports = async (ctx) => {
23
+ const type = ctx.params.type;
24
+ const response = await got(`https://yjsy.ncepu.edu.cn/${url_map[type]}/index.htm`);
25
+ const data = response.data; // 获取页面 html 数据
26
+
27
+ const $ = cheerio.load(data);
28
+ const list = $('.articleList ul li')
29
+ .map((_, item) => {
30
+ item = $(item);
31
+ // 单篇文章块的信息,其中文字部分是标题,属性是文章链接
32
+ const a = item.find('a');
33
+ // 发表日期
34
+ const pubDate = timezone(parseDate(item.find('span').text().replace('[', '').replace(']', '')), +8);
35
+ // 相对地址转化为绝对地址
36
+ const url_head = `https://yjsy.ncepu.edu.cn/${url_map[type]}/`;
37
+ const url_part = a.attr('href');
38
+ const url = url_head + url_part;
39
+ // 返回格式化数据
40
+ return {
41
+ title: a.attr('title'),
42
+ link: url,
43
+ pubDate,
44
+ };
45
+ })
46
+ .get();
47
+
48
+ const items = await Promise.all(
49
+ list.map(async (item) => {
50
+ const itemData = await ctx.cache.tryGet(item.link, async () => (await got(item.link)).data);
51
+ const content = cheerio.load(itemData);
52
+
53
+ const articleAuthor = content('.articleAuthor').html().replace('作者:&nbsp;&nbsp;', '').replace('来源:&nbsp;&nbsp;', '');
54
+ const eDescription = content('.article').html();
55
+ let files = content('.Annex').html();
56
+ if (typeof files === 'undefined' || files === null) {
57
+ files = ''; // 无附件时files设置为空字符串
58
+ } else {
59
+ files = content('.Annex').html();
60
+ }
61
+
62
+ const single = {
63
+ title: item.title,
64
+ link: item.link,
65
+ description: articleAuthor + eDescription + files,
66
+ pubDate: item.pubDate,
67
+ };
68
+ return single;
69
+ })
70
+ );
71
+
72
+ ctx.state.data = {
73
+ title: `${title_map[type]}-华北电力大学研究生院`,
74
+ link: `http://yjsy.ncepu.edu.cn/${url_map[type]}`,
75
+ description: `华北电力大学研究生院${description_map[type]}`,
76
+ item: items,
77
+ };
78
+ };
@@ -0,0 +1,25 @@
1
+ module.exports = {
2
+ 'ncepu.edu.cn': {
3
+ _name: '华北电力大学研究生院',
4
+ yjsy: [
5
+ {
6
+ title: '通知公告',
7
+ docs: ' https://docs.rsshub.app/university.html#hua-bei-dian-li-da-xue',
8
+ source: ['/tzgg/index.htm', '/'],
9
+ target: '/ncepu/master/tzgg',
10
+ },
11
+ {
12
+ title: '硕士招生信息',
13
+ docs: 'https://docs.rsshub.app/university.html#hua-bei-dian-li-da-xue',
14
+ source: ['/zsxx/sszsxx/index.htm', '/'],
15
+ target: '/ncepu/master/zsxx',
16
+ },
17
+ {
18
+ title: '研究生培养信息',
19
+ docs: 'https://docs.rsshub.app/university.html#hua-bei-dian-li-da-xue',
20
+ source: ['/pyxx/pyxx/index.htm', '/'],
21
+ target: '/ncepu/master/pyxx',
22
+ },
23
+ ],
24
+ },
25
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = function (router) {
2
+ router.get('/master/:type', require('./master/masterinfo'));
3
+ };
@@ -1,5 +1,8 @@
1
1
  const got = require('@/utils/got');
2
2
  const config = require('@/config').value;
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ const X_UA = 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)';
3
6
 
4
7
  module.exports = async (ctx) => {
5
8
  const { fid, recommend } = ctx.params;
@@ -15,11 +18,9 @@ module.exports = async (ctx) => {
15
18
  return `<img src="${src}" />`;
16
19
  })
17
20
  .replace(/\[url\](.+?)\[\/url\]/g, `<a href="$1">$1</a>`);
18
- const homePage = await got({
19
- method: 'post',
20
- url: 'https://ngabbs.com/app_api.php?__lib=subject&__act=list',
21
+ const homePage = await got.post('https://ngabbs.com/app_api.php?__lib=subject&__act=list', {
21
22
  headers: {
22
- 'X-User-Agent': 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)',
23
+ 'X-User-Agent': X_UA,
23
24
  Cookie: cookieString,
24
25
  },
25
26
  form: {
@@ -39,15 +40,13 @@ module.exports = async (ctx) => {
39
40
  title: subject,
40
41
  description: '',
41
42
  link,
42
- pubDate: new Date(postdate * 1000).toUTCString(),
43
+ pubDate: parseDate(postdate, 'X'),
43
44
  };
44
45
 
45
46
  const description = await ctx.cache.tryGet(`nga-forum: ${link}`, async () => {
46
- const response = await got({
47
- method: 'post',
48
- url: 'https://ngabbs.com/app_api.php?__lib=post&__act=list',
47
+ const response = await got.post('https://ngabbs.com/app_api.php?__lib=post&__act=list', {
49
48
  headers: {
50
- 'X-User-Agent': 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)',
49
+ 'X-User-Agent': X_UA,
51
50
  Cookie: cookieString,
52
51
  },
53
52
  form: {
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ '/forum/:fid/:recommend?': ['xyqfer'],
3
+ '/post/:tid/:authorId?': ['xyqfer', 'syrinka'],
4
+ };
@@ -1,20 +1,20 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
3
  const iconv = require('iconv-lite');
4
+ const { parseDate } = require('@/utils/parse-date');
5
+ const timezone = require('@/utils/timezone');
4
6
  const config = require('@/config').value;
5
7
 
6
8
  module.exports = async (ctx) => {
7
- const getPageUrl = (tid, page = 1, hash = '') => `https://nga.178.com/read.php?tid=${tid}&page=${page}&rand=${Math.random() * 1000}#${hash}`;
8
- const getPage = async (tid, pageId = 1) => {
9
- const link = getPageUrl(tid, pageId);
9
+ const getPageUrl = (tid, authorId, page = 1, hash = '') => `https://nga.178.com/read.php?tid=${tid}&page=${page}&authorid=${authorId}&rand=${Math.random() * 1000}#${hash}`;
10
+ const getPage = async (tid, authorId, pageId = 1) => {
11
+ const link = getPageUrl(tid, authorId, pageId);
10
12
  const timestamp = Math.floor(Date.now() / 1000);
11
13
  let cookieString = `guestJs=${timestamp};`;
12
14
  if (config.nga.uid && config.nga.cid) {
13
15
  cookieString = `ngaPassportUid=${config.nga.uid}; ngaPassportCid=${config.nga.cid};`;
14
16
  }
15
- const response = await got({
16
- method: 'get',
17
- url: link,
17
+ const response = await got(link, {
18
18
  responseType: 'buffer',
19
19
  headers: {
20
20
  Cookie: cookieString,
@@ -25,10 +25,10 @@ module.exports = async (ctx) => {
25
25
  return cheerio.load(htmlString);
26
26
  };
27
27
 
28
- const getLastPageId = async (tid) => {
29
- const $ = await getPage(tid);
28
+ const getLastPageId = async (tid, authorId) => {
29
+ const $ = await getPage(tid, authorId);
30
30
  const nav = $('#pagebtop');
31
- const match = nav.html().match(/\{0:'\/read.php\?tid=(\d+)',1:(\d+).*?\}/);
31
+ const match = nav.html().match(/\{0:'\/read\.php\?tid=(\d+).*?',1:(\d+),.*?\}/);
32
32
  return match ? match[2] : 1;
33
33
  };
34
34
 
@@ -37,9 +37,10 @@ module.exports = async (ctx) => {
37
37
  const pipeImg = (str) => str.replace(/\[img\](.+?)\[\/img\]/g, (m, src) => `<img src='${src[0] === '.' ? 'https://img.nga.178.com/attachments' + src.substr(1) : src}'></img>`);
38
38
 
39
39
  const tid = ctx.params.tid;
40
- const pageId = await getLastPageId(tid);
40
+ const authorId = ctx.params.authorId;
41
+ const pageId = await getLastPageId(tid, authorId);
41
42
 
42
- const $ = await getPage(tid, pageId);
43
+ const $ = await getPage(tid, authorId, pageId);
43
44
  const title = $('title').text() || '';
44
45
 
45
46
  const items = $('#m_posts_c')
@@ -51,8 +52,8 @@ module.exports = async (ctx) => {
51
52
  const title = eraseTag(content.text());
52
53
  const description = eraseTag(pipeImg(eraseQuote(content.html() || '')));
53
54
  const postId = content.attr('id');
54
- const link = getPageUrl(tid, pageId, postId);
55
- const pubDate = new Date(post.find('.postInfo > span').first().text()).toUTCString();
55
+ const link = getPageUrl(tid, authorId, pageId, postId);
56
+ const pubDate = timezone(parseDate(post.find('.postInfo > span').first().text(), 'YYYY-MM-DD HH:mm'), +8);
56
57
 
57
58
  return {
58
59
  title,
@@ -64,8 +65,8 @@ module.exports = async (ctx) => {
64
65
  });
65
66
 
66
67
  ctx.state.data = {
67
- title: `nga-${title}`,
68
- link: getPageUrl(tid, pageId),
68
+ title: authorId ? `nga-${title}-${authorId}` : `nga-${title}`,
69
+ link: getPageUrl(tid, authorId, pageId),
69
70
  item: items.get(),
70
71
  };
71
72
  };
@@ -0,0 +1,56 @@
1
+ module.exports = {
2
+ 'nga.cn': {
3
+ _name: 'NGA',
4
+ bbs: [
5
+ {
6
+ title: '分区帖子',
7
+ docs: 'https://docs.rsshub.app/bbs.html#nga-fen-qu-tie-zi',
8
+ source: '/thread.php',
9
+ target: (params, url) => new URL(url).searchParams.get('fid') && `/nga/forum/${new URL(url).searchParams.get('fid')}`,
10
+ },
11
+ {
12
+ title: '帖子',
13
+ docs: 'https://docs.rsshub.app/bbs.html#nga-tie-zi',
14
+ source: '/read.php',
15
+ target: (params, url) => new URL(url).searchParams.get('tid') && `/nga/post/${new URL(url).searchParams.get('tid')}`,
16
+ },
17
+ {
18
+ title: '帖子 - 只看作者',
19
+ docs: 'https://docs.rsshub.app/bbs.html#nga-tie-zi',
20
+ source: '/read.php',
21
+ target: (params, url, document) => {
22
+ const tid = new URL(url).searchParams.get('tid');
23
+ const authorId = document.documentElement.innerHTML.match(/commonui\.userInfo\.setAll\(\s{3}{"(\d+)"/)[1];
24
+ return `/nga/post/${tid}/${authorId}`;
25
+ }
26
+ },
27
+ ],
28
+ },
29
+ '178.com': {
30
+ _name: 'NGA',
31
+ nga: [
32
+ {
33
+ title: '分区帖子',
34
+ docs: 'https://docs.rsshub.app/bbs.html#nga-fen-qu-tie-zi',
35
+ source: '/thread.php',
36
+ target: (params, url) => new URL(url).searchParams.get('fid') && `/nga/forum/${new URL(url).searchParams.get('fid')}`,
37
+ },
38
+ {
39
+ title: '帖子',
40
+ docs: 'https://docs.rsshub.app/bbs.html#nga-tie-zi',
41
+ source: '/read.php',
42
+ target: (params, url) => new URL(url).searchParams.get('tid') && `/nga/post/${new URL(url).searchParams.get('tid')}`,
43
+ },
44
+ {
45
+ title: '帖子 - 只看作者',
46
+ docs: 'https://docs.rsshub.app/bbs.html#nga-tie-zi',
47
+ source: '/read.php',
48
+ target: (params, url, document) => {
49
+ const tid = new URL(url).searchParams.get('tid');
50
+ const authorId = document.documentElement.innerHTML.match(/commonui\.userInfo\.setAll\(\s{3}{"(\d+)"/)[1];
51
+ return `/nga/post/${tid}/${authorId}`;
52
+ }
53
+ },
54
+ ],
55
+ },
56
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = function (router) {
2
+ router.get('/forum/:fid/:recommend?', require('./forum'));
3
+ router.get('/post/:tid/:authorId?', require('./post'));
4
+ };
@@ -0,0 +1,40 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ module.exports = async (ctx) => {
6
+ const id = ctx.params.id ?? 'shutup10';
7
+
8
+ const rootUrl = 'https://www.oo-software.com';
9
+ const currentUrl = `${rootUrl}/en/${id}/changelog`;
10
+
11
+ const response = await got({
12
+ method: 'get',
13
+ url: currentUrl,
14
+ });
15
+
16
+ const $ = cheerio.load(response.data);
17
+
18
+ const items = $('.content h4')
19
+ .toArray()
20
+ .map((item) => {
21
+ item = $(item);
22
+
23
+ const title = item.text();
24
+
25
+ return {
26
+ title,
27
+ link: `${currentUrl}#${title.split(' – ')[0]}`,
28
+ description: item.next().html(),
29
+ pubDate: parseDate(title.match(/released (on )?(.*)$/)[2], 'MMMM DD, YYYY'),
30
+ };
31
+ });
32
+
33
+ items[0].enclosure_url = $('.banner-inlay').find('a').attr('href');
34
+
35
+ ctx.state.data = {
36
+ title: $('title').text(),
37
+ link: currentUrl,
38
+ item: items,
39
+ };
40
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/changelog/:id': ['nczitzk'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'oo-software.com': {
3
+ _name: 'O&O Software',
4
+ '.': [
5
+ {
6
+ title: 'Changelog',
7
+ docs: 'https://docs.rsshub.app/program-update.html#oo-software-changelog',
8
+ source: ['/en/changelog'],
9
+ target: (params, url) => `/oo-software/changelog/${new URL(url).match(/\/en\/(.*?)\/changelog/)[1]}`,
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = function (router) {
2
+ router.get('/changelog/:id', require('./changelog'));
3
+ };
@@ -35,7 +35,7 @@ module.exports = async (ctx) => {
35
35
  description: String(gaugeCount) + ' ' + gaugeText,
36
36
  pubDate: new Date().toUTCString(),
37
37
  guid: new Date().getTime(),
38
- link: URL,
38
+ link: url,
39
39
  };
40
40
  outageHistory.push(outageReportItem);
41
41
  }
@@ -43,7 +43,7 @@ module.exports = async (ctx) => {
43
43
  // how this RSS feed looks like
44
44
  ctx.state.data = {
45
45
  title: `Is ${serviceName} Down Right Now?`,
46
- link: URL,
46
+ link: url,
47
47
  description: rssDescribe,
48
48
  item: outageHistory,
49
49
  allowEmpty: true,
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/:name/:count?': ['cxumol', 'nczitzk'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'outage.report': {
3
+ _name: 'Outage.Report',
4
+ '.': [
5
+ {
6
+ title: 'Report',
7
+ docs: 'https://docs.rsshub.app/forecast.html#outage-report',
8
+ source: ['/'],
9
+ target: (params, url) => `/outagereport/${new URL(url).toString().split('/').pop()}`,
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = function (router) {
2
+ router.get('/:name/:count?', require('./index'));
3
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/topic/:topic?': ['TonyRL'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'peopo.org': {
3
+ _name: 'PeoPo 公民新聞',
4
+ '.': [
5
+ {
6
+ title: '新聞分類',
7
+ docs: 'https://docs.rsshub.app/new-media.html#peopo-gong-min-xin-wen',
8
+ source: '/topic/:topicId',
9
+ target: '/peopo/topic/:topicId',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/topic/:topicId?', require('./topic'));
3
+ };
@@ -0,0 +1,46 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const timezone = require('@/utils/timezone');
5
+ const baseUrl = 'https://www.peopo.org';
6
+
7
+ module.exports = async (ctx) => {
8
+ const { topicId = '159' } = ctx.params;
9
+ const url = `${baseUrl}/topic/${topicId}`;
10
+ const response = await got(url);
11
+ const $ = cheerio.load(response.data);
12
+ const list = $('.view-list-title')
13
+ .toArray()
14
+ .map((item) => {
15
+ item = $(item);
16
+ return {
17
+ title: item.find('a').text(),
18
+ link: new URL(item.find('a').attr('href'), baseUrl).href,
19
+ };
20
+ });
21
+
22
+ const items = await Promise.all(
23
+ list.map((item) =>
24
+ ctx.cache.tryGet(item.link, async () => {
25
+ const response = await got(item.link);
26
+ const $ = cheerio.load(response.data);
27
+
28
+ item.author = $('#user-info h3').text();
29
+ item.category = $('#node-terms .inline li')
30
+ .toArray()
31
+ .map((item) => $(item).find('a').text());
32
+ item.pubDate = timezone(parseDate($('.submitted span').text()), +8);
33
+ item.description = ($('.field-name-field-video-id .field-items').text() ? $('.field-name-field-video-id input').attr('value') : '') + $('.post_text_s .field-items').html();
34
+
35
+ return item;
36
+ })
37
+ )
38
+ );
39
+
40
+ ctx.state.data = {
41
+ title: $('head title').text(),
42
+ link: url,
43
+ language: 'zh-TW',
44
+ item: items,
45
+ };
46
+ };
@@ -0,0 +1,44 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const { art } = require('@/utils/render');
5
+ const path = require('path');
6
+
7
+ module.exports = async (ctx) => {
8
+ const rootUrl = 'https://news.pts.org.tw';
9
+ const currentUrl = `${rootUrl}/curations`;
10
+
11
+ const response = await got({
12
+ method: 'get',
13
+ url: currentUrl,
14
+ });
15
+
16
+ const $ = cheerio.load(response.data);
17
+
18
+ const items = $('.project-intro')
19
+ .last()
20
+ .find('h3 a')
21
+ .toArray()
22
+ .map((item) => {
23
+ item = $(item);
24
+
25
+ const projectDiv = item.parent().parent();
26
+
27
+ return {
28
+ title: item.text(),
29
+ link: item.attr('href'),
30
+ pubDate: parseDate(projectDiv.find('time').text()),
31
+ description: art(path.join(__dirname, 'templates/description.art'), {
32
+ image: projectDiv.parent().find('.cover-fit').attr('src'),
33
+ }),
34
+ };
35
+ });
36
+
37
+ ctx.state.data = {
38
+ title: $('title')
39
+ .text()
40
+ .replace(/第\d+頁 | /, ''),
41
+ link: currentUrl,
42
+ item: items,
43
+ };
44
+ };
@@ -2,10 +2,12 @@ const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
3
  const timezone = require('@/utils/timezone');
4
4
  const { parseDate } = require('@/utils/parse-date');
5
+ const { art } = require('@/utils/render');
6
+ const path = require('path');
5
7
 
6
8
  module.exports = async (ctx) => {
7
9
  const rootUrl = 'https://news.pts.org.tw';
8
- const currentUrl = `${rootUrl}/dailynews`;
10
+ const currentUrl = `${rootUrl}${ctx.path === '/' ? '/dailynews' : ctx.path}`;
9
11
 
10
12
  const response = await got({
11
13
  method: 'get',
@@ -14,19 +16,20 @@ module.exports = async (ctx) => {
14
16
 
15
17
  const $ = cheerio.load(response.data);
16
18
 
17
- const list = $('h2 a')
18
- .map((_, item) => {
19
+ let items = $('h2 a')
20
+ .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 30)
21
+ .toArray()
22
+ .map((item) => {
19
23
  item = $(item);
20
24
 
21
25
  return {
22
26
  title: item.text(),
23
27
  link: item.attr('href'),
24
28
  };
25
- })
26
- .get();
29
+ });
27
30
 
28
- const items = await Promise.all(
29
- list.map((item) =>
31
+ items = await Promise.all(
32
+ items.map((item) =>
30
33
  ctx.cache.tryGet(item.link, async () => {
31
34
  const detailResponse = await got({
32
35
  method: 'get',
@@ -35,17 +38,27 @@ module.exports = async (ctx) => {
35
38
 
36
39
  const content = cheerio.load(detailResponse.data);
37
40
 
38
- item.author = content('meta[property="article:author"]').attr('content');
41
+ item.author = content('meta[property="article:author"]').attr('content').split(' / ')[0];
39
42
  item.pubDate = timezone(parseDate(content('meta[property="article:published_time"]').attr('content')), +8);
40
- item.description = `<img src="${content('meta[property="og:image"]').attr('content')}">${content('.post-article').html()}`;
41
-
43
+ item.category = content('.tag-list')
44
+ .first()
45
+ .find('.blue-tag')
46
+ .toArray()
47
+ .map((t) => content(t).text())
48
+ .filter((t) => t !== '...');
49
+ item.description = art(path.join(__dirname, 'templates/description.art'), {
50
+ image: content('meta[property="og:image"]').attr('content'),
51
+ description: content('.post-article').html(),
52
+ });
42
53
  return item;
43
54
  })
44
55
  )
45
56
  );
46
57
 
47
58
  ctx.state.data = {
48
- title: '即時 | 公視新聞網 PNN',
59
+ title: $('title')
60
+ .text()
61
+ .replace(/第\d+頁 | /, ''),
49
62
  link: currentUrl,
50
63
  item: items,
51
64
  };
@@ -1,3 +1,9 @@
1
1
  module.exports = {
2
+ '/category/:id': ['nczitzk'],
3
+ '/curations': ['nczitzk'],
2
4
  '/dailynews': ['nczitzk'],
5
+ '/opinion': ['nczitzk'],
6
+ '/projects': ['nczitzk'],
7
+ '/report': ['nczitzk'],
8
+ '/tag/:id': ['nczitzk'],
3
9
  };