rsshub 1.0.0-master.d2b1df9 → 1.0.0-master.d2bf7b3

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 (122) hide show
  1. package/lib/config.js +3 -0
  2. package/lib/middleware/cache/index.js +3 -0
  3. package/lib/router.js +5 -5
  4. package/lib/v2/bangumi/maintainer.js +1 -0
  5. package/lib/v2/bangumi/online.js +26 -0
  6. package/lib/v2/bangumi/radar.js +13 -2
  7. package/lib/v2/bangumi/router.js +1 -0
  8. package/lib/v2/bangumi/templates/image.art +1 -0
  9. package/lib/v2/bilibili/collection.js +34 -0
  10. package/lib/v2/bilibili/maintainer.js +1 -0
  11. package/lib/v2/bilibili/radar.js +9 -0
  12. package/lib/v2/bilibili/router.js +1 -0
  13. package/lib/v2/china/maintainer.js +4 -0
  14. package/lib/v2/china/news/highlights/news.js +40 -0
  15. package/lib/v2/china/news/military/news.js +31 -0
  16. package/lib/v2/china/radar.js +21 -0
  17. package/lib/v2/china/router.js +4 -0
  18. package/lib/v2/csdn/blog.js +39 -0
  19. package/lib/v2/csdn/maintainer.js +3 -0
  20. package/lib/v2/csdn/radar.js +13 -0
  21. package/lib/v2/csdn/router.js +3 -0
  22. package/lib/v2/douyu/post.js +9 -2
  23. package/lib/v2/github/comments.js +3 -4
  24. package/lib/v2/hupu/bbs.js +23 -23
  25. package/lib/v2/huxiu/maintainer.js +1 -0
  26. package/lib/v2/huxiu/moment.js +40 -0
  27. package/lib/v2/huxiu/radar.js +6 -0
  28. package/lib/v2/huxiu/router.js +1 -0
  29. package/lib/v2/huxiu/templates/moment.art +16 -0
  30. package/lib/v2/iwara/maintainer.js +1 -0
  31. package/lib/v2/iwara/radar.js +6 -0
  32. package/lib/v2/iwara/router.js +1 -0
  33. package/lib/v2/iwara/subscriptions.js +49 -0
  34. package/lib/v2/iwara/templates/subscriptions.art +1 -0
  35. package/lib/v2/leetcode/dailyquestion-solution-cn.js +183 -0
  36. package/lib/v2/leetcode/dailyquestion-solution-en.js +213 -0
  37. package/lib/v2/leetcode/maintainer.js +1 -0
  38. package/lib/v2/leetcode/radar.js +12 -0
  39. package/lib/v2/leetcode/router.js +2 -0
  40. package/lib/v2/lovelive-anime/maintainer.js +3 -0
  41. package/lib/v2/lovelive-anime/news.js +56 -0
  42. package/lib/v2/lovelive-anime/radar.js +13 -0
  43. package/lib/v2/lovelive-anime/router.js +3 -0
  44. package/lib/v2/lovelive-anime/templates/description.art +1 -0
  45. package/lib/v2/macfilos/blog.js +61 -0
  46. package/lib/v2/macfilos/maintainer.js +3 -0
  47. package/lib/v2/macfilos/radar.js +13 -0
  48. package/lib/v2/macfilos/router.js +3 -0
  49. package/lib/v2/meteor/boards.js +11 -0
  50. package/lib/v2/meteor/index.js +45 -0
  51. package/lib/v2/meteor/maintainer.js +4 -0
  52. package/lib/v2/meteor/radar.js +19 -0
  53. package/lib/v2/meteor/router.js +4 -0
  54. package/lib/v2/meteor/templates/desc.art +7 -0
  55. package/lib/v2/meteor/utils.js +90 -0
  56. package/lib/v2/nikkei-cn/index.js +4 -1
  57. package/lib/v2/nua/gra.js +56 -0
  58. package/lib/v2/nua/maintainer.js +3 -0
  59. package/lib/v2/nua/radar.js +13 -0
  60. package/lib/v2/nua/router.js +3 -0
  61. package/lib/v2/oschina/maintainer.js +6 -0
  62. package/lib/{routes → v2}/oschina/news.js +35 -39
  63. package/lib/v2/oschina/radar.js +33 -0
  64. package/lib/v2/oschina/router.js +6 -0
  65. package/lib/v2/oschina/topic.js +53 -0
  66. package/lib/v2/oschina/user.js +50 -0
  67. package/lib/v2/plurk/anonymous.js +23 -0
  68. package/lib/v2/plurk/hotlinks.js +20 -0
  69. package/lib/v2/plurk/maintainer.js +9 -0
  70. package/lib/v2/plurk/news.js +23 -0
  71. package/lib/v2/plurk/radar.js +56 -0
  72. package/lib/v2/plurk/router.js +9 -0
  73. package/lib/v2/plurk/search.js +27 -0
  74. package/lib/v2/plurk/top.js +29 -0
  75. package/lib/v2/plurk/topic.js +33 -0
  76. package/lib/v2/plurk/user.js +31 -0
  77. package/lib/v2/plurk/utils.js +56 -0
  78. package/lib/v2/segmentfault/blogs.js +38 -0
  79. package/lib/v2/segmentfault/maintainer.js +1 -0
  80. package/lib/v2/segmentfault/radar.js +8 -2
  81. package/lib/v2/segmentfault/router.js +1 -0
  82. package/lib/v2/sensortower/blog.js +69 -0
  83. package/lib/v2/sensortower/maintainer.js +3 -0
  84. package/lib/v2/sensortower/radar.js +13 -0
  85. package/lib/v2/sensortower/router.js +3 -0
  86. package/lib/v2/sensortower/templates/description.art +9 -0
  87. package/lib/v2/taptap/templates/imagePost.art +3 -0
  88. package/lib/v2/taptap/templates/videoPost.art +2 -1
  89. package/lib/v2/taptap/topic.js +33 -27
  90. package/lib/v2/taptap/utils.js +13 -8
  91. package/lib/v2/test/index.js +15 -0
  92. package/lib/v2/trending/allTrending.js +46 -19
  93. package/lib/v2/trending/templates/content.art +1 -0
  94. package/lib/v2/twitter/maintainer.js +1 -1
  95. package/lib/v2/twitter/router.js +1 -1
  96. package/lib/v2/twitter/web-api/twitter-api.js +1 -0
  97. package/lib/v2/warthunder/maintainer.js +3 -0
  98. package/lib/v2/warthunder/news.js +49 -0
  99. package/lib/v2/warthunder/radar.js +13 -0
  100. package/lib/v2/warthunder/router.js +3 -0
  101. package/lib/v2/warthunder/templates/description.art +1 -0
  102. package/lib/v2/xyzrank/index.js +111 -0
  103. package/lib/v2/xyzrank/maintainer.js +6 -0
  104. package/lib/v2/xyzrank/radar.js +31 -0
  105. package/lib/v2/xyzrank/router.js +3 -0
  106. package/lib/v2/xyzrank/templates/description.art +12 -0
  107. package/lib/v2/zaobao/util.js +6 -6
  108. package/lib/v2/zuvio/boards.js +14 -0
  109. package/lib/v2/zuvio/radar.js +13 -0
  110. package/lib/v2/zuvio/router.js +4 -0
  111. package/lib/v2/zuvio/student5.js +58 -0
  112. package/lib/v2/zuvio/templates/img.art +2 -0
  113. package/lib/v2/zuvio/templates/link.art +7 -0
  114. package/lib/v2/zuvio/templates/ref_article.art +8 -0
  115. package/lib/v2/zuvio/templates/rss.art +1 -0
  116. package/lib/v2/zuvio/templates/youtube.art +2 -0
  117. package/lib/v2/zuvio/utils.js +61 -0
  118. package/package.json +14 -15
  119. package/lib/routes/oschina/topic.js +0 -54
  120. package/lib/routes/oschina/u.js +0 -57
  121. package/lib/routes/oschina/user.js +0 -57
  122. package/lib/v2/hupu/templates/description.art +0 -6
package/lib/config.js CHANGED
@@ -178,6 +178,9 @@ const calculateValue = () => {
178
178
  password: envs.IG_PASSWORD,
179
179
  proxy: envs.IG_PROXY,
180
180
  },
181
+ iwara: {
182
+ cookie: envs.IWARA_COOKIE,
183
+ },
181
184
  lastfm: {
182
185
  api_key: envs.LASTFM_API_KEY,
183
186
  },
@@ -56,6 +56,9 @@ module.exports = function (app) {
56
56
  app.context.cache = {
57
57
  ...cacheModule,
58
58
  tryGet: async (key, getValueFunc, maxAge = config.cache.contentExpire, refresh = true) => {
59
+ if (typeof key !== 'string') {
60
+ throw Error('Cache key must be a string');
61
+ }
59
62
  let v = await get(key, refresh);
60
63
  if (!v) {
61
64
  v = await getValueFunc();
package/lib/router.js CHANGED
@@ -396,11 +396,11 @@ router.get('/gwern/:category', lazyloadRouteHandler('./routes/gwern/category'));
396
396
  // LinkedKeeper
397
397
  router.get('/linkedkeeper/:type/:id?', lazyloadRouteHandler('./routes/linkedkeeper/index'));
398
398
 
399
- // 开源中国
400
- router.get('/oschina/news/:category?', lazyloadRouteHandler('./routes/oschina/news'));
401
- router.get('/oschina/user/:id', lazyloadRouteHandler('./routes/oschina/user'));
402
- router.get('/oschina/u/:id', lazyloadRouteHandler('./routes/oschina/u'));
403
- router.get('/oschina/topic/:topic', lazyloadRouteHandler('./routes/oschina/topic'));
399
+ // 开源中国 migrated to v2
400
+ // router.get('/oschina/news/:category?', lazyloadRouteHandler('./routes/oschina/news'));
401
+ // router.get('/oschina/user/:id', lazyloadRouteHandler('./routes/oschina/user'));
402
+ // router.get('/oschina/u/:id', lazyloadRouteHandler('./routes/oschina/u'));
403
+ // router.get('/oschina/topic/:topic', lazyloadRouteHandler('./routes/oschina/topic'));
404
404
 
405
405
  // MIT Technology Review
406
406
  router.get('/technologyreview', lazyloadRouteHandler('./routes/technologyreview/index'));
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ '/online': ['devinmugen'],
2
3
  '/': ['nczitzk'],
3
4
  '/:tags?': ['nczitzk'],
4
5
  };
@@ -0,0 +1,26 @@
1
+ const got = require('@/utils/got');
2
+ const { art } = require('@/utils/render');
3
+ const path = require('path');
4
+
5
+ module.exports = async (ctx) => {
6
+ const url = 'https://bangumi.online/api/home';
7
+
8
+ const response = await got.post(url);
9
+
10
+ const list = response.data.data.list;
11
+
12
+ const items = list.map((item) => ({
13
+ title: `${item.title_zh} - 第 ${item.volume} 集`,
14
+ description: art(path.join(__dirname, 'templates/image.art'), {
15
+ src: `https:${item.cover}`,
16
+ alt: `${item.title_zh} - 第 ${item.volume} 集`,
17
+ }),
18
+ link: `https://bangumi.online/watch/${item.vid}`,
19
+ }));
20
+
21
+ ctx.state.data = {
22
+ title: 'アニメ新番組',
23
+ link: 'https://bangumi.online',
24
+ item: items,
25
+ };
26
+ };
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
- '萌番组 Bangumi Moe': {
3
- _name: 'bangumi.moe',
2
+ 'bangumi.moe': {
3
+ _name: '萌番組',
4
4
  '.': [
5
5
  {
6
6
  title: '最新',
@@ -16,4 +16,15 @@ module.exports = {
16
16
  },
17
17
  ],
18
18
  },
19
+ 'bangumi.online': {
20
+ _name: 'アニメ新番組',
21
+ '.': [
22
+ {
23
+ title: '當季新番',
24
+ docs: 'https://docs.rsshub.app/anime.html#アニメ-xin-fan-zu-dang-ji-xin-fan',
25
+ source: ['/'],
26
+ target: '/bangumi/online',
27
+ },
28
+ ],
29
+ },
19
30
  };
@@ -1,3 +1,4 @@
1
1
  module.exports = function (router) {
2
+ router.get('/online', require('./online'));
2
3
  router.get(/([\w-/]+)?/, require('./index'));
3
4
  };
@@ -0,0 +1 @@
1
+ <img src="{{ src }}" alt="{{ alt }}">
@@ -0,0 +1,34 @@
1
+ const got = require('@/utils/got');
2
+ const cache = require('./cache');
3
+ const utils = require('./utils');
4
+ const { parseDate } = require('@/utils/parse-date');
5
+
6
+ module.exports = async (ctx) => {
7
+ const uid = ctx.params.uid;
8
+ const sid = ctx.params.sid;
9
+ const disableEmbed = ctx.params.disableEmbed;
10
+ const [name, face] = await cache.getUsernameAndFaceFromUID(ctx, uid);
11
+ const response = await got({
12
+ method: 'get',
13
+ url: `https://api.bilibili.com/x/polymer/space/seasons_archives_list?mid=${uid}&season_id=${sid}&sort_reverse=false&page_num=1&page_size=30`,
14
+ headers: {
15
+ Referer: `https://space.bilibili.com/${uid}/channel/collectiondetail?sid=${sid}`,
16
+ },
17
+ });
18
+ const data = response.data;
19
+
20
+ ctx.state.data = {
21
+ title: `${name}的${data.data.meta.name}`,
22
+ link: `https://space.bilibili.com/${uid}/channel/collectiondetail?sid=${sid}`,
23
+ description: `${name} 的 bilibili 合集`,
24
+ logo: face,
25
+ icon: face,
26
+ item: data.data.archives.map((item) => ({
27
+ title: item.title,
28
+ description: `${!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''}<br><img src="${item.pic}">`,
29
+ pubDate: parseDate(item.pubdate * 1000),
30
+ link: item.pubdate > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
31
+ author: name,
32
+ })),
33
+ };
34
+ };
@@ -4,6 +4,7 @@ module.exports = {
4
4
  '/blackboard': ['Qixingchen'],
5
5
  '/bangumi/:seasonid': ['DIYgod'],
6
6
  '/bangumi/media/:mediaid': ['DIYgod'],
7
+ '/collection/:uid/:sid/:disableEmbed?': ['shininome'],
7
8
  '/fav/:uid/:fid/:disableEmbed?': ['Qixingchen'],
8
9
  '/followings/article/:uid': ['woshiluo'],
9
10
  '/followings/dynamic/:uid/:disableEmbed?': ['TigerCubDen'],
@@ -90,6 +90,15 @@ module.exports = {
90
90
  source: '/:uid',
91
91
  target: '/bilibili/user/bangumi/:uid',
92
92
  },
93
+ {
94
+ title: '当前合集',
95
+ docs: 'https://docs.rsshub.app/social-media.html#bilibili',
96
+ source: '/:uid/channel/collectiondetail',
97
+ target: (params, url) => {
98
+ const sid = new URL(url).searchParams.get('sid');
99
+ return `/bilibili/collection/:uid/${sid}`;
100
+ },
101
+ },
93
102
  ],
94
103
  manga: [
95
104
  {
@@ -4,6 +4,7 @@ module.exports = (router) => {
4
4
  router.get('/blackboard', require('./blackboard'));
5
5
  router.get('/bangumi/:seasonid', require('./bangumi')); // 弃用
6
6
  router.get('/bangumi/media/:mediaid', require('./bangumi'));
7
+ router.get('/collection/:uid/:sid/:disableEmbed?', require('./collection'));
7
8
  router.get('/fav/:uid/:fid/:disableEmbed?', require('./fav'));
8
9
  router.get('/followings/article/:uid', require('./followings_article'));
9
10
  router.get('/followings/dynamic/:uid/:disableEmbed?', require('./followings_dynamic'));
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ '/news/military': ['jiaaoMario'],
3
+ '/news/:category?': ['jiaaoMario'],
4
+ };
@@ -0,0 +1,40 @@
1
+ const cheerio = require('cheerio');
2
+ const got = require('@/utils/got');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ const CATEGORY_MAP = {
6
+ domestic: 'domestic',
7
+ international: 'international',
8
+ social: 'social',
9
+ news100: 'news100',
10
+ };
11
+
12
+ module.exports = async (ctx) => {
13
+ const baseUrl = 'https://news.china.com';
14
+ const category = CATEGORY_MAP[ctx.params.category] ?? CATEGORY_MAP.domestic;
15
+ const websiteUrl = `${baseUrl}/${category}`;
16
+ const response = await got(websiteUrl);
17
+ const data = response.data;
18
+ const $ = cheerio.load(data);
19
+ const categoryTitle = $('.wp_title').text();
20
+ const news = $('.item_list li');
21
+ ctx.state.data = {
22
+ title: `中华网-${categoryTitle}新闻`,
23
+ link: websiteUrl,
24
+ item:
25
+ news &&
26
+ news
27
+ .map((_, item) => {
28
+ item = $(item);
29
+ return {
30
+ title: item.find('.item_title a').text(),
31
+ author: item.find('.item_source').text(),
32
+ category: `${categoryTitle}新闻`,
33
+ pubDate: parseDate(item.find('.item_time').text()),
34
+ description: item.find('.item_title a').text(),
35
+ link: item.find('li a').attr('href'),
36
+ };
37
+ })
38
+ .get(),
39
+ };
40
+ };
@@ -0,0 +1,31 @@
1
+ const cheerio = require('cheerio');
2
+ const got = require('@/utils/got');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ module.exports = async (ctx) => {
6
+ const websiteUrl = 'https://military.china.com/news/';
7
+ const response = await got(websiteUrl);
8
+ const data = response.data;
9
+ const $ = cheerio.load(data);
10
+ const commonList = $('.listItem');
11
+
12
+ ctx.state.data = {
13
+ title: '中华网-军事新闻',
14
+ link: 'https://military.china.com/news/',
15
+ item:
16
+ commonList &&
17
+ commonList
18
+ .map((_, item) => {
19
+ item = $(item);
20
+ return {
21
+ title: item.find('.tit a').text(),
22
+ author: '中华网军事',
23
+ category: '中华网军事',
24
+ pubDate: parseDate(item.find('.time').text()),
25
+ description: item.find('.tag').text(),
26
+ link: item.find('.tit a').attr('href'),
27
+ };
28
+ })
29
+ .get(),
30
+ };
31
+ };
@@ -0,0 +1,21 @@
1
+ module.exports = {
2
+ 'china.com': {
3
+ _name: '中华网',
4
+ military: [
5
+ {
6
+ title: '军事新闻',
7
+ docs: 'https://docs.rsshub.app/new-media.html#zhong-hua-wang',
8
+ source: '/news',
9
+ target: '/china/news/military',
10
+ },
11
+ ],
12
+ news: [
13
+ {
14
+ title: '时事新闻',
15
+ docs: 'https://docs.rsshub.app/new-media.html#zhong-hua-wang',
16
+ source: '/:category',
17
+ target: '/china/news/:category?',
18
+ },
19
+ ],
20
+ },
21
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = (router) => {
2
+ router.get('/news/military', require('./news/military/news.js'));
3
+ router.get('/news/:category?', require('./news/highlights/news.js'));
4
+ };
@@ -0,0 +1,39 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const rssParser = require('@/utils/rss-parser');
4
+
5
+ module.exports = async (ctx) => {
6
+ const user = ctx.params.user;
7
+
8
+ const rootUrl = 'https://blog.csdn.net';
9
+ const blogUrl = `${rootUrl}/${user}`;
10
+ const rssUrl = blogUrl + '/rss/list';
11
+
12
+ const feed = await rssParser.parseURL(rssUrl);
13
+
14
+ const items = await Promise.all(
15
+ feed.items.map((item) =>
16
+ ctx.cache.tryGet(item.link, async () => {
17
+ const response = await got({
18
+ method: 'get',
19
+ url: item.link,
20
+ });
21
+
22
+ const $ = cheerio.load(response.data);
23
+
24
+ const description = $('#content_views').html();
25
+
26
+ return {
27
+ ...item,
28
+ description,
29
+ };
30
+ })
31
+ )
32
+ );
33
+
34
+ ctx.state.data = {
35
+ ...feed,
36
+ title: `${feed.title} - CSDN博客`,
37
+ item: items,
38
+ };
39
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/blog': ['Jkker'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'csdn.net': {
3
+ _name: 'CSDN',
4
+ blog: [
5
+ {
6
+ title: '博客',
7
+ docs: 'https://docs.rsshub.app/blog.html#csdn',
8
+ source: ['/:user'],
9
+ target: '/csdn/blog/:user',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = function (router) {
2
+ router.get('/blog/:user', require('./blog'));
3
+ };
@@ -16,9 +16,16 @@ module.exports = async (ctx) => {
16
16
  });
17
17
 
18
18
  const data = detailResponse.data.data;
19
- const apiUrl = `${rootUrl}/wbapi/web/post/comments/${id}?group_id=${data.group_id}&sink=1&page=1`;
19
+ let apiUrl = `${rootUrl}/wbapi/web/post/comments/${id}?group_id=${data.group_id}&sink=1&page=1`;
20
20
 
21
- const response = await got({
21
+ let response = await got({
22
+ method: 'get',
23
+ url: apiUrl,
24
+ });
25
+
26
+ apiUrl = `${rootUrl}/wbapi/web/post/comments/${id}?group_id=${data.group_id}&sink=1&page=${response.data.page_total}`;
27
+
28
+ response = await got({
22
29
  method: 'get',
23
30
  url: apiUrl,
24
31
  });
@@ -29,15 +29,13 @@ module.exports = async (ctx) => {
29
29
  Accept: 'application/vnd.github.v3+json',
30
30
  };
31
31
 
32
- const response = await got({
33
- url: `${apiUrl}/repos/${user}/${repo}/issues/${number}`,
32
+ const response = await got(`${apiUrl}/repos/${user}/${repo}/issues/${number}`, {
34
33
  headers,
35
34
  });
36
35
  const issue = response.data;
37
36
  const type = issue.pull_request ? 'pull' : 'issue';
38
37
 
39
- const timelineResponse = await got({
40
- url: issue.timeline_url,
38
+ const timelineResponse = await got(issue.timeline_url, {
41
39
  headers,
42
40
  searchParams: {
43
41
  per_page: limit,
@@ -81,6 +79,7 @@ module.exports = async (ctx) => {
81
79
  author: item.actor.login,
82
80
  pubDate: parseDate(item.created_at),
83
81
  guid: `${item.actor.login} ${item.event} on ${user}/${repo}: ${typeDict[type].title} #${issue.number} on ${item.created_at}`,
82
+ link: `${item.actor.login} ${item.event} on ${user}/${repo}: ${typeDict[type].title} #${issue.number} on ${item.created_at}`,
84
83
  });
85
84
  break;
86
85
  case 'renamed':
@@ -1,27 +1,35 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
3
  const timezone = require('@/utils/timezone');
4
- const { parseRelativeDate } = require('@/utils/parse-date');
5
- const { art } = require('@/utils/render');
6
- const path = require('path');
4
+ const { parseDate } = require('@/utils/parse-date');
7
5
 
8
6
  module.exports = async (ctx) => {
9
7
  const id = ctx.params.id ?? '34';
10
8
  const order = ctx.params.order ?? '1';
11
9
 
12
- const rootUrl = 'https://m.hupu.com';
13
- const currentUrl = `${rootUrl}/api/v1/bbs-forumthreadlist-frontend/${id}-1?postdate=${order}`;
10
+ const rootUrl = 'https://bbs.hupu.com';
11
+ const currentUrl = `${rootUrl}/${id}${order === '1' ? `-postdate` : ''}`;
14
12
 
15
13
  const response = await got({
16
14
  method: 'get',
17
15
  url: currentUrl,
18
16
  });
19
17
 
20
- let items = response.data.data.t_list.map((item) => ({
21
- title: item.title,
22
- link: `${rootUrl}/bbs/${item.tid}.html`,
23
- pubDate: timezone(parseRelativeDate(item.t_post), +8),
24
- }));
18
+ const $ = cheerio.load(response.data);
19
+
20
+ $('.page-icon').remove();
21
+
22
+ let items = $('.bbs-sl-web-post-layout .post-title a')
23
+ .toArray()
24
+ .map((item) => {
25
+ item = $(item);
26
+
27
+ return {
28
+ title: item.text(),
29
+ link: `${rootUrl}${item.attr('href')}`,
30
+ pubDate: timezone(parseDate(item.parent().parent().find('.post-time').text(), 'MM-DD HH:mm'), +8),
31
+ };
32
+ });
25
33
 
26
34
  items = await Promise.all(
27
35
  items.map((item) =>
@@ -34,18 +42,10 @@ module.exports = async (ctx) => {
34
42
 
35
43
  const content = cheerio.load(detailResponse.data);
36
44
 
37
- const videos = [];
45
+ content('.seo-dom').remove();
38
46
 
39
- content('.thread-video-wrap').each(function () {
40
- videos.push(content('video').attr('src'));
41
- content(this).remove();
42
- });
43
-
44
- item.author = content('.bbs-user-info-name').first().text();
45
- item.description = art(path.join(__dirname, 'templates/description.art'), {
46
- videos,
47
- description: content('#bbs-thread-content').html(),
48
- });
47
+ item.author = content('.post-user-comp-info-top-name').first().text();
48
+ item.description = content('.main-thread').first().html();
49
49
  } catch (e) {
50
50
  // no-empty
51
51
  }
@@ -56,9 +56,9 @@ module.exports = async (ctx) => {
56
56
  );
57
57
 
58
58
  ctx.state.data = {
59
- title: `虎扑社区 - ${response.data.data.keywords}`,
59
+ title: `虎扑社区 - ${$('.bbs-sl-web-intro-detail-title').text()}`,
60
60
  link: currentUrl,
61
61
  item: items,
62
- description: response.data.data.description,
62
+ description: $('.bbs-sl-web-intro-detail-desc-text').first().text(),
63
63
  };
64
64
  };
@@ -2,6 +2,7 @@ module.exports = {
2
2
  '/article': ['HenryQW'],
3
3
  '/author/:id': ['HenryQW'],
4
4
  '/collection/:id': ['AlexdanerZe'],
5
+ '/moment': ['nczitzk'],
5
6
  '/tag/:id': ['xyqfer', 'HenryQW'],
6
7
  '/search/:keyword': ['xyqfer', 'HenryQW'],
7
8
  };
@@ -0,0 +1,40 @@
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
+ module.exports = async (ctx) => {
7
+ const rootUrl = 'https://www.huxiu.com';
8
+ const currentUrl = `${rootUrl}/moment`;
9
+ const apiRootUrl = 'https://moment-api.huxiu.com';
10
+ const apiUrl = `${apiRootUrl}/web-v2/moment/feed`;
11
+
12
+ const response = await got({
13
+ method: 'post',
14
+ url: apiUrl,
15
+ form: {
16
+ last_dateline: parseInt(new Date().getTime() / 1000),
17
+ platform: 'www',
18
+ is_ai: 0,
19
+ },
20
+ });
21
+
22
+ const items = response.data.data.moment_list.datalist[0].datalist.map((item) => ({
23
+ title: item.content,
24
+ link: item.share_url,
25
+ author: item.user_info.username,
26
+ pubDate: parseDate(item.publish_time * 1000),
27
+ description: art(path.join(__dirname, 'templates/moment.art'), {
28
+ description: item.content,
29
+ images: item.img_urls,
30
+ video: item.video,
31
+ comments: item.comment,
32
+ }),
33
+ }));
34
+
35
+ ctx.state.data = {
36
+ title: '虎嗅 - 24小时',
37
+ link: currentUrl,
38
+ item: items,
39
+ };
40
+ };
@@ -8,6 +8,12 @@ module.exports = {
8
8
  source: ['/article', '/'],
9
9
  target: '/huxiu/article',
10
10
  },
11
+ {
12
+ title: '24小时',
13
+ docs: 'https://docs.rsshub.app/new-media.html#hu-xiu',
14
+ source: ['/moment', '/'],
15
+ target: '/huxiu/moment',
16
+ },
11
17
  {
12
18
  title: '标签',
13
19
  docs: 'https://docs.rsshub.app/new-media.html#hu-xiu',
@@ -2,6 +2,7 @@ module.exports = (router) => {
2
2
  router.get('/article', require('./article'));
3
3
  router.get('/author/:id', require('./author'));
4
4
  router.get('/collection/:id', require('./collection'));
5
+ router.get('/moment', require('./moment'));
5
6
  router.get('/tag/:id', require('./tag'));
6
7
  router.get('/search/:keyword', require('./search'));
7
8
  };
@@ -0,0 +1,16 @@
1
+ {{@ description }}
2
+ {{ if images }}
3
+ {{ each images image }}
4
+ <img src="{{ image.origin_pic }}" width="{{ image.origin_width }}" height="{{ image.origin_height }}">
5
+ {{ /each }}
6
+ {{ /if }}
7
+ {{ if video }}
8
+ <video width="{{ video.width }}" height="{{ video.height }}" poster="{{ video.cover_path }}" controls>
9
+ <source src="{{ video.url }}" type="video/{{ video.format }}">
10
+ </video>
11
+ {{ /if }}
12
+ {{ if comments }}
13
+ {{ each comments.datalist comment }}
14
+ <p>{{ comment.user_info.username }}: {{ comment.content }} ({{ comment.show_time }})</p>
15
+ {{ /each }}
16
+ {{ /if }}
@@ -1,3 +1,4 @@
1
1
  module.exports = {
2
2
  '/users/:username?/:type?': ['Fatpandac'],
3
+ '/subscriptions': ['FeCCC'],
3
4
  };
@@ -14,6 +14,12 @@ module.exports = {
14
14
  source: '/users/:username',
15
15
  target: '/iwara/users/:username?/image',
16
16
  },
17
+ {
18
+ title: '用户订阅列表',
19
+ docs: 'https://docs.rsshub.app/anime.html#iwara',
20
+ source: '',
21
+ target: '/iwara/subscriptions',
22
+ },
17
23
  ],
18
24
  },
19
25
  };
@@ -1,3 +1,4 @@
1
1
  module.exports = function (router) {
2
2
  router.get('/users/:username?/:type?', require('./index'));
3
+ router.get('/subscriptions', require('./subscriptions'));
3
4
  };
@@ -0,0 +1,49 @@
1
+ const got = require('@/utils/got');
2
+ const config = require('@/config').value;
3
+ const cheerio = require('cheerio');
4
+ const { art } = require('@/utils/render');
5
+ const path = require('path');
6
+
7
+ module.exports = async (ctx) => {
8
+ const rootUrl = `https://ecchi.iwara.tv`;
9
+ const subUrl = `https://ecchi.iwara.tv/subscriptions`;
10
+ const cookie = config.iwara.cookie;
11
+
12
+ if (cookie === undefined) {
13
+ throw Error('Iwara subscription RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>');
14
+ }
15
+
16
+ const response = await got({
17
+ method: 'get',
18
+ url: subUrl,
19
+ headers: {
20
+ Cookie: cookie,
21
+ },
22
+ });
23
+ const $ = cheerio.load(response.data);
24
+ const username = $('a.btn.btn-info.btn-sm.user').text().trim();
25
+ const list = $('div.views-column');
26
+
27
+ const items = list
28
+ .map((_, item) => {
29
+ const imageUrl = 'https:' + $(item).find('img').attr('src');
30
+ const type = $(item).find('div.field').hasClass('field-type-video') ? 'Video' : 'Image';
31
+ return {
32
+ title: $(item).find('h3.title').text(),
33
+ author: username,
34
+ link: rootUrl + $(item).find('h3.title > a').attr('href'),
35
+ category: type,
36
+ description: art(path.join(__dirname, 'templates/subscriptions.art'), {
37
+ type,
38
+ imageUrl,
39
+ }),
40
+ };
41
+ })
42
+ .get();
43
+
44
+ ctx.state.data = {
45
+ title: `${username}'s iwara Subscription`,
46
+ link: rootUrl,
47
+ item: items,
48
+ };
49
+ };
@@ -0,0 +1 @@
1
+ <h3>{{ type }}</h3><br><img src="{{ imageUrl }}">