rsshub 1.0.0-master.b791066 → 1.0.0-master.b8acfdb

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 (160) hide show
  1. package/lib/config.js +3 -0
  2. package/lib/radar-rules.js +1 -1
  3. package/lib/router.js +26 -25
  4. package/lib/routes/bendibao/news.js +5 -1
  5. package/lib/routes/bof/home.js +1 -2
  6. package/lib/routes/cnbeta/topic.js +75 -0
  7. package/lib/routes/cpta/notice.js +6 -1
  8. package/lib/routes/douban/people/status.js +5 -0
  9. package/lib/routes/douban/topic.js +1 -1
  10. package/lib/routes/fashionnetwork/headline.js +53 -0
  11. package/lib/routes/gameres/utils.js +4 -1
  12. package/lib/routes/gov/guangdong/edu.js +5 -1
  13. package/lib/routes/gov/shenzhen/xxgk/zfxxgj.js +5 -1
  14. package/lib/routes/hackerone/hacktivity.js +1 -2
  15. package/lib/routes/hackerone/search.js +1 -2
  16. package/lib/routes/hkcnews/news.js +5 -1
  17. package/lib/routes/hkej/index.js +7 -1
  18. package/lib/routes/infzm/news.js +9 -17
  19. package/lib/routes/lolapp/article.js +53 -0
  20. package/lib/routes/maoyan/hotComplete.js +87 -0
  21. package/lib/routes/nasa/apod-cn.js +4 -1
  22. package/lib/routes/ncm/userplayrecords.js +53 -0
  23. package/lib/routes/newzmz/index.js +5 -1
  24. package/lib/routes/nintendo/eshop_us.js +3 -6
  25. package/lib/routes/odaily/newsflash.js +25 -0
  26. package/lib/routes/odaily/post.js +60 -0
  27. package/lib/routes/odaily/user.js +53 -0
  28. package/lib/routes/pingwest/utils.js +4 -1
  29. package/lib/routes/qstheory/index.js +7 -1
  30. package/lib/routes/tencent/wechat/wechat-open/pay/announce.js +2 -4
  31. package/lib/routes/tingshuitz/guangzhou.js +1 -2
  32. package/lib/routes/ui-cn/article.js +8 -1
  33. package/lib/routes/universities/njtech/jwc.js +1 -1
  34. package/lib/routes/universities/nuc/index.js +6 -1
  35. package/lib/routes/weibo/search/hot.js +1 -2
  36. package/lib/routes/ximalaya/album.js +9 -12
  37. package/lib/routes/ximalaya/utils.js +3 -128
  38. package/lib/routes/yahoo-news/index.js +1 -1
  39. package/lib/utils/puppeteer.js +0 -1
  40. package/lib/v2/18comic/album.js +75 -0
  41. package/lib/v2/18comic/blogs.js +63 -0
  42. package/lib/v2/18comic/index.js +12 -0
  43. package/lib/v2/18comic/maintainer.js +6 -0
  44. package/lib/v2/18comic/radar.js +31 -0
  45. package/lib/v2/18comic/router.js +6 -0
  46. package/lib/v2/18comic/search.js +13 -0
  47. package/lib/v2/18comic/utils.js +71 -0
  48. package/lib/v2/2048/index.js +8 -1
  49. package/lib/v2/bse/index.js +173 -0
  50. package/lib/v2/bse/maintainer.js +3 -0
  51. package/lib/v2/bse/radar.js +13 -0
  52. package/lib/v2/bse/router.js +3 -0
  53. package/lib/v2/btzj/index.js +98 -0
  54. package/lib/v2/btzj/maintainer.js +3 -0
  55. package/lib/v2/btzj/radar.js +13 -0
  56. package/lib/v2/btzj/router.js +3 -0
  57. package/lib/v2/btzj/templates/torrents.art +5 -0
  58. package/lib/v2/csc/maintainer.js +3 -0
  59. package/lib/v2/csc/notice.js +99 -0
  60. package/lib/v2/csc/radar.js +31 -0
  61. package/lib/v2/csc/router.js +3 -0
  62. package/lib/v2/elsevier/latest.js +87 -0
  63. package/lib/v2/elsevier/maintainer.js +4 -0
  64. package/lib/v2/elsevier/radar.js +19 -0
  65. package/lib/v2/elsevier/router.js +4 -0
  66. package/lib/v2/elsevier/templates/description.art +9 -0
  67. package/lib/v2/elsevier/volume.js +75 -0
  68. package/lib/v2/epicgames/supportedList.js +1 -2
  69. package/lib/v2/eprice/radar.js +2 -2
  70. package/lib/v2/eprice/rss.js +29 -19
  71. package/lib/v2/eprice/templates/description.art +1 -1
  72. package/lib/v2/eprice/templates/image.art +1 -0
  73. package/lib/v2/gameapps/index.js +56 -0
  74. package/lib/v2/gameapps/maintainer.js +3 -0
  75. package/lib/v2/gameapps/radar.js +13 -0
  76. package/lib/v2/gameapps/router.js +3 -0
  77. package/lib/v2/gameapps/templates/description.art +3 -0
  78. package/lib/v2/hkej/index.js +7 -1
  79. package/lib/v2/hongkong/chp.js +103 -0
  80. package/lib/v2/hongkong/dh.js +53 -0
  81. package/lib/v2/hongkong/maintainer.js +4 -0
  82. package/lib/v2/hongkong/radar.js +19 -0
  83. package/lib/v2/hongkong/router.js +4 -0
  84. package/lib/v2/ieee/latestdate.js +103 -0
  85. package/lib/v2/ieee/latestvol.js +87 -0
  86. package/lib/v2/ieee/maintainer.js +4 -0
  87. package/lib/v2/ieee/radar.js +19 -0
  88. package/lib/v2/ieee/router.js +4 -0
  89. package/lib/v2/ieee/templates/description.art +9 -0
  90. package/lib/v2/jasa/latest.js +70 -0
  91. package/lib/v2/jasa/maintainer.js +4 -0
  92. package/lib/v2/jasa/radar.js +19 -0
  93. package/lib/v2/jasa/router.js +4 -0
  94. package/lib/v2/jasa/section.js +95 -0
  95. package/lib/v2/jasa/templates/description.art +9 -0
  96. package/lib/{routes → v2}/javdb/actors.js +2 -2
  97. package/lib/{routes → v2}/javdb/index.js +3 -3
  98. package/lib/v2/javdb/maintainer.js +10 -0
  99. package/lib/{routes → v2}/javdb/makers.js +2 -2
  100. package/lib/v2/javdb/radar.js +49 -0
  101. package/lib/{routes → v2}/javdb/rankings.js +2 -2
  102. package/lib/v2/javdb/router.js +10 -0
  103. package/lib/{routes → v2}/javdb/search.js +3 -3
  104. package/lib/{routes → v2}/javdb/series.js +2 -2
  105. package/lib/{routes → v2}/javdb/tags.js +2 -2
  106. package/lib/v2/javdb/utils.js +73 -0
  107. package/lib/v2/jisilu/index.js +90 -0
  108. package/lib/v2/jisilu/maintainer.js +3 -0
  109. package/lib/v2/jisilu/radar.js +25 -0
  110. package/lib/v2/jisilu/router.js +3 -0
  111. package/lib/v2/mohw/clarification.js +50 -0
  112. package/lib/v2/mohw/maintainer.js +3 -0
  113. package/lib/v2/mohw/radar.js +13 -0
  114. package/lib/v2/mohw/router.js +3 -0
  115. package/lib/v2/mox/index.js +57 -0
  116. package/lib/v2/mox/maintainer.js +3 -0
  117. package/lib/v2/mox/radar.js +13 -0
  118. package/lib/v2/mox/router.js +3 -0
  119. package/lib/v2/mvm/index.js +4 -1
  120. package/lib/v2/news/maintainer.js +3 -0
  121. package/lib/v2/news/radar.js +13 -0
  122. package/lib/v2/news/router.js +3 -0
  123. package/lib/{routes → v2}/news/whxw.js +18 -10
  124. package/lib/v2/nsfc/maintainer.js +3 -0
  125. package/lib/{routes → v2}/nsfc/news.js +0 -0
  126. package/lib/v2/nsfc/radar.js +31 -0
  127. package/lib/v2/nsfc/router.js +3 -0
  128. package/lib/v2/oncc/index.js +83 -0
  129. package/lib/v2/oncc/maintainer.js +3 -0
  130. package/lib/v2/oncc/radar.js +37 -0
  131. package/lib/v2/oncc/router.js +3 -0
  132. package/lib/v2/oncc/templates/article.art +2 -0
  133. package/lib/v2/shopback/maintainer.js +3 -0
  134. package/lib/v2/shopback/radar.js +13 -0
  135. package/lib/v2/shopback/router.js +3 -0
  136. package/lib/v2/shopback/store.js +37 -0
  137. package/lib/v2/sicau/maintainer.js +3 -0
  138. package/lib/v2/sicau/radar.js +13 -0
  139. package/lib/v2/sicau/router.js +3 -0
  140. package/lib/v2/sicau/zsjy.js +53 -0
  141. package/lib/v2/solidot/_article.js +4 -1
  142. package/lib/v2/swissinfo/index.js +72 -0
  143. package/lib/v2/swissinfo/maintainer.js +3 -0
  144. package/lib/v2/swissinfo/radar.js +13 -0
  145. package/lib/v2/swissinfo/router.js +3 -0
  146. package/lib/v2/wechat/feeddd.js +72 -0
  147. package/lib/v2/wechat/maintainer.js +3 -0
  148. package/lib/v2/wechat/radar.js +12 -0
  149. package/lib/v2/wechat/router.js +3 -0
  150. package/lib/v2/wechat/templates/description.art +1 -0
  151. package/lib/v2/wechat/templates/image.art +1 -0
  152. package/lib/v2/wsyu/maintainer.js +3 -0
  153. package/lib/{routes/universities → v2}/wsyu/news.js +0 -0
  154. package/lib/v2/wsyu/radar.js +25 -0
  155. package/lib/v2/wsyu/router.js +3 -0
  156. package/package.json +48 -48
  157. package/lib/routes/btzj/index.js +0 -77
  158. package/lib/routes/javdb/utils.js +0 -82
  159. package/lib/routes/jisilu/reply.js +0 -63
  160. package/lib/routes/jisilu/topic.js +0 -68
package/lib/config.js CHANGED
@@ -202,6 +202,9 @@ const calculateValue = () => {
202
202
  ipb_pass_hash: envs.EH_IPB_PASS_HASH,
203
203
  sk: envs.EH_SK,
204
204
  },
205
+ infzm: {
206
+ cookie: envs.INFZM_COOKIE,
207
+ },
205
208
  };
206
209
  };
207
210
  calculateValue();
@@ -463,7 +463,7 @@ module.exports = {
463
463
  source: '/:type/:id',
464
464
  target: (params) => {
465
465
  if (parseInt(params.id) + '' === params.id) {
466
- return '/ximalaya/album/:id/';
466
+ return '/ximalaya/:type/:id/';
467
467
  }
468
468
  },
469
469
  },
package/lib/router.js CHANGED
@@ -104,6 +104,7 @@ router.get('/ncm/playlist/:id', lazyloadRouteHandler('./routes/ncm/playlist'));
104
104
  router.get('/ncm/user/playlist/:uid', lazyloadRouteHandler('./routes/ncm/userplaylist'));
105
105
  router.get('/ncm/artist/:id', lazyloadRouteHandler('./routes/ncm/artist'));
106
106
  router.get('/ncm/djradio/:id', lazyloadRouteHandler('./routes/ncm/djradio'));
107
+ router.get('/ncm/user/playrecords/:uid/:type?', lazyloadRouteHandler('./routes/ncm/userplayrecords'));
107
108
 
108
109
  // 掘金
109
110
  router.get('/juejin/category/:category', lazyloadRouteHandler('./routes/juejin/category'));
@@ -326,8 +327,8 @@ router.get('/3dm/:name/:type', lazyloadRouteHandler('./routes/3dm/game'));
326
327
  router.get('/3dm/news', lazyloadRouteHandler('./routes/3dm/news_center'));
327
328
 
328
329
  // 喜马拉雅
329
- router.get('/ximalaya/album/:id/:all?', lazyloadRouteHandler('./routes/ximalaya/album'));
330
- router.get('/ximalaya/album/:id/:all/:shownote?', lazyloadRouteHandler('./routes/ximalaya/album'));
330
+ router.get('/ximalaya/:type/:id/:all?', lazyloadRouteHandler('./routes/ximalaya/album'));
331
+ router.get('/ximalaya/:type/:id/:all/:shownote?', lazyloadRouteHandler('./routes/ximalaya/album'));
331
332
 
332
333
  // EZTV
333
334
  router.get('/eztv/torrents/:imdb_id', lazyloadRouteHandler('./routes/eztv/imdb'));
@@ -969,7 +970,7 @@ router.get('/dytt', lazyloadRouteHandler('./routes/dytt/index'));
969
970
  router.get('/dytt/index', lazyloadRouteHandler('./routes/dytt/index')); // 废弃
970
971
 
971
972
  // BT之家
972
- router.get('/btzj/:type?', lazyloadRouteHandler('./routes/btzj/index'));
973
+ // router.get('/btzj/:type?', lazyloadRouteHandler('./routes/btzj/index'));
973
974
 
974
975
  // 人生05电影网
975
976
  router.get('/rs05/rs05', lazyloadRouteHandler('./routes/rs05/rs05'));
@@ -1820,9 +1821,11 @@ router.get('/aqicn/:city/:pollution?', lazyloadRouteHandler('./routes/aqicn/inde
1820
1821
  // 猫眼电影
1821
1822
  router.get('/maoyan/hot', lazyloadRouteHandler('./routes/maoyan/hot'));
1822
1823
  router.get('/maoyan/upcoming', lazyloadRouteHandler('./routes/maoyan/upcoming'));
1824
+ router.get('/maoyan/hotComplete/:orderby?/:ascOrDesc?/:top?', lazyloadRouteHandler('./routes/maoyan/hotComplete'));
1823
1825
 
1824
1826
  // cnBeta
1825
1827
  router.get('/cnbeta', lazyloadRouteHandler('./routes/cnbeta/home'));
1828
+ router.get('/cnbeta/topic/:topic_id', lazyloadRouteHandler('./routes/cnbeta/topic'));
1826
1829
 
1827
1830
  // 国家退伍士兵信息
1828
1831
  router.get('/gov/veterans/:type', lazyloadRouteHandler('./routes/gov/veterans/china'));
@@ -1909,6 +1912,7 @@ router.get('/lol/newsindex/:type', lazyloadRouteHandler('./routes/lol/newsindex'
1909
1912
 
1910
1913
  // 掌上英雄联盟
1911
1914
  router.get('/lolapp/recommend', lazyloadRouteHandler('./routes/lolapp/recommend'));
1915
+ router.get('/lolapp/article/:uuid', lazyloadRouteHandler('./routes/lolapp/article'));
1912
1916
 
1913
1917
  // 左岸读书
1914
1918
  router.get('/zreading', lazyloadRouteHandler('./routes/zreading/home'));
@@ -2671,18 +2675,12 @@ router.get('/lagou/jobs/:position/:city', lazyloadRouteHandler('./routes/lagou/j
2671
2675
  router.get('/yzu/home/:type', lazyloadRouteHandler('./routes/universities/yzu/home'));
2672
2676
  router.get('/yzu/yjszs/:type', lazyloadRouteHandler('./routes/universities/yzu/yjszs'));
2673
2677
 
2674
- // 国家自然科学基金委员会
2675
- router.get('/nsfc/news/:type?', lazyloadRouteHandler('./routes/nsfc/news'));
2676
-
2677
2678
  // 德国新闻社卫健新闻
2678
2679
  router.get('/krankenkassen', lazyloadRouteHandler('./routes/krankenkassen'));
2679
2680
 
2680
2681
  // 桂林航天工业学院
2681
2682
  router.get('/guat/news/:type?', lazyloadRouteHandler('./routes/guat/news'));
2682
2683
 
2683
- // 国家留学网
2684
- router.get('/csc/notice/:type?', lazyloadRouteHandler('./routes/csc/notice'));
2685
-
2686
2684
  // LearnKu
2687
2685
  router.get('/learnku/:community/:category?', lazyloadRouteHandler('./routes/learnku/topic'));
2688
2686
 
@@ -2772,9 +2770,6 @@ router.get('/eastmoney/user/:uid', lazyloadRouteHandler('./routes/eastmoney/user
2772
2770
  router.get('/ssmh', lazyloadRouteHandler('./routes/ssmh'));
2773
2771
  router.get('/ssmh/category/:cid', lazyloadRouteHandler('./routes/ssmh/category'));
2774
2772
 
2775
- // 武昌首义学院
2776
- router.get('/wsyu/news/:type?', lazyloadRouteHandler('./routes/universities/wsyu/news'));
2777
-
2778
2773
  // 华南师范大学研究生学院
2779
2774
  router.get('/scnuyjs', lazyloadRouteHandler('./routes/universities/scnu/scnuyjs'));
2780
2775
 
@@ -3441,14 +3436,14 @@ router.get('/mercari/:type/:id', lazyloadRouteHandler('./routes/mercari/index'))
3441
3436
  router.get('/notefolio/:caty?/:order?/:time?/:query?', lazyloadRouteHandler('./routes/notefolio/index'));
3442
3437
 
3443
3438
  // JavDB
3444
- router.get('/javdb/home/:category?/:sort?/:filter?', lazyloadRouteHandler('./routes/javdb'));
3445
- router.get('/javdb/search/:keyword?/:filter?', lazyloadRouteHandler('./routes/javdb/search'));
3446
- router.get('/javdb/tags/:query?/:caty?', lazyloadRouteHandler('./routes/javdb/tags'));
3447
- router.get('/javdb/actors/:id/:filter?', lazyloadRouteHandler('./routes/javdb/actors'));
3448
- router.get('/javdb/makers/:id/:filter?', lazyloadRouteHandler('./routes/javdb/makers'));
3449
- router.get('/javdb/series/:id/:filter?', lazyloadRouteHandler('./routes/javdb/series'));
3450
- router.get('/javdb/rankings/:caty?/:time?', lazyloadRouteHandler('./routes/javdb/rankings'));
3451
- router.get('/javdb/:category?/:sort?/:filter?', lazyloadRouteHandler('./routes/javdb'));
3439
+ // router.get('/javdb/home/:category?/:sort?/:filter?', lazyloadRouteHandler('./routes/javdb'));
3440
+ // router.get('/javdb/search/:keyword?/:filter?', lazyloadRouteHandler('./routes/javdb/search'));
3441
+ // router.get('/javdb/tags/:query?/:caty?', lazyloadRouteHandler('./routes/javdb/tags'));
3442
+ // router.get('/javdb/actors/:id/:filter?', lazyloadRouteHandler('./routes/javdb/actors'));
3443
+ // router.get('/javdb/makers/:id/:filter?', lazyloadRouteHandler('./routes/javdb/makers'));
3444
+ // router.get('/javdb/series/:id/:filter?', lazyloadRouteHandler('./routes/javdb/series'));
3445
+ // router.get('/javdb/rankings/:caty?/:time?', lazyloadRouteHandler('./routes/javdb/rankings'));
3446
+ // router.get('/javdb/:category?/:sort?/:filter?', lazyloadRouteHandler('./routes/javdb'));
3452
3447
 
3453
3448
  // World Economic Forum
3454
3449
  router.get('/weforum/report/:lang?/:year?/:platform?', lazyloadRouteHandler('./routes/weforum/report'));
@@ -3957,7 +3952,7 @@ router.get('/tianyancha/hot', lazyloadRouteHandler('./routes/tianyancha/hot'));
3957
3952
  router.get('/kingarthur/:type', lazyloadRouteHandler('./routes/kingarthur/index'));
3958
3953
 
3959
3954
  // 新华网
3960
- router.get('/news/whxw', lazyloadRouteHandler('./routes/news/whxw'));
3955
+ // router.get('/news/whxw', lazyloadRouteHandler('./routes/news/whxw'));
3961
3956
 
3962
3957
  // 游讯网
3963
3958
  router.get('/yxdown/recommend', lazyloadRouteHandler('./routes/yxdown/recommend'));
@@ -4073,8 +4068,8 @@ router.get('/liyuan-forums/threads/topic/:topic_id', lazyloadRouteHandler('./rou
4073
4068
  router.get('/liyuan-forums/threads/user/:user_id', lazyloadRouteHandler('./routes/liyuan-forums/threads'));
4074
4069
 
4075
4070
  // 集思录
4076
- router.get('/jisilu/reply/:user', lazyloadRouteHandler('./routes/jisilu/reply'));
4077
- router.get('/jisilu/topic/:user', lazyloadRouteHandler('./routes/jisilu/topic'));
4071
+ // router.get('/jisilu/reply/:user', lazyloadRouteHandler('./routes/jisilu/reply'));
4072
+ // router.get('/jisilu/topic/:user', lazyloadRouteHandler('./routes/jisilu/topic'));
4078
4073
 
4079
4074
  // Constitutional Court of Baden-Württemberg (Germany)
4080
4075
  router.get('/verfghbw/press/:keyword?', lazyloadRouteHandler('./routes/verfghbw/press'));
@@ -4236,8 +4231,6 @@ router.get('/sbs/chinese/:category?/:id?/:dialect?/:language?', lazyloadRouteHan
4236
4231
  // Asian to lick
4237
4232
  router.get('/asiantolick/:category?/:keyword?', lazyloadRouteHandler('./routes/asiantolick'));
4238
4233
 
4239
- // Deprecated: DO NOT ADD ROUTE HERE
4240
-
4241
4234
  // Research Gate
4242
4235
  router.get('/researchgate/publications/:id', lazyloadRouteHandler('./routes/researchgate/publications'));
4243
4236
 
@@ -4249,6 +4242,9 @@ router.get('/rss3/blog', lazyloadRouteHandler('./routes/rss3/blog'));
4249
4242
 
4250
4243
  // 星球日报
4251
4244
  router.get('/odaily/activity', lazyloadRouteHandler('./routes/odaily/activity'));
4245
+ router.get('/odaily/newsflash', lazyloadRouteHandler('./routes/odaily/newsflash'));
4246
+ router.get('/odaily/user/:id', lazyloadRouteHandler('./routes/odaily/user'));
4247
+ router.get('/odaily/:id?', lazyloadRouteHandler('./routes/odaily/post'));
4252
4248
 
4253
4249
  // Fashion Network
4254
4250
  router.get('/fashionnetwork/news/:sectors?/:categories?/:language?', lazyloadRouteHandler('./routes/fashionnetwork/news.js'));
@@ -4260,4 +4256,9 @@ router.get('/dykszx/news/:type?', lazyloadRouteHandler('./routes/dykszx/news'));
4260
4256
  router.get('/secrss/category/:category?', lazyloadRouteHandler('./routes/secrss/category'));
4261
4257
  router.get('/secrss/author/:author?', lazyloadRouteHandler('./routes/secrss/author'));
4262
4258
 
4259
+ // Fashion Network
4260
+ router.get('/fashionnetwork/headline/:country?', lazyloadRouteHandler('./routes/fashionnetwork/headline.js'));
4261
+
4262
+ // Deprecated: DO NOT ADD ROUTE HERE
4263
+
4263
4264
  module.exports = router;
@@ -66,7 +66,11 @@ module.exports = async (ctx) => {
66
66
 
67
67
  // Spans for publish dates are the same cases as above.
68
68
 
69
- item.pubDate = new Date((content('span.time').text().replace(/发布时间:/, '') || content('span.public_time').text()) + ' GMT+8').toUTCString();
69
+ item.pubDate = new Date(
70
+ (content('span.time')
71
+ .text()
72
+ .replace(/发布时间:/, '') || content('span.public_time').text()) + ' GMT+8'
73
+ ).toUTCString();
70
74
 
71
75
  return item;
72
76
  } catch (e) {
@@ -15,8 +15,7 @@ module.exports = async (ctx) => {
15
15
  height: 440,
16
16
  width: 670,
17
17
  },
18
- query:
19
- 'query GetArticlesGQL($articleSlug: String, $category: String, $authorSlug: String, $height: Int, $lastCursor: ID, $width: Int!, $first: Int) {\n articles(first: $first, after: $lastCursor, filter: {language__eq: chinese, articleSlug__eq: $articleSlug, categorySlug__eq: $category, authorSlug__eq: $authorSlug}) {\n edges {\n cursor\n node {\n __typename\n ... on ArticleInterface {\n title\n summary\n content\n url\n featuredAsset {\n ... on AssetInterface {\n caption\n __typename\n }\n ... on ManagedImage {\n transform(transform: {width: $width, height: $height, crop: FOCALPOINT, fit: CROP})\n __typename\n }\n ... on ManagedVideo {\n url\n __typename\n }\n __typename\n }\n isExclusive\n isSponsored\n published {\n value\n __typename\n }\n __typename\n }\n ... on InternalArticleInterface {\n authors {\n displayName\n slug\n __typename\n }\n __typename\n }\n ... on ExternalArticleInterface {\n source\n __typename\n }\n ... on CuratedArticleLink {\n _id\n title\n published {\n value\n __typename\n }\n url\n __typename\n }\n ... on SyndicatedArticle {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n __typename\n }\n __typename\n }\n ... on OriginalArticle {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n slug\n __typename\n }\n __typename\n }\n ... on FashionWeekReview {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n __typename\n }\n __typename\n }\n }\n __typename\n }\n __typename\n }\n}\n',
18
+ query: 'query GetArticlesGQL($articleSlug: String, $category: String, $authorSlug: String, $height: Int, $lastCursor: ID, $width: Int!, $first: Int) {\n articles(first: $first, after: $lastCursor, filter: {language__eq: chinese, articleSlug__eq: $articleSlug, categorySlug__eq: $category, authorSlug__eq: $authorSlug}) {\n edges {\n cursor\n node {\n __typename\n ... on ArticleInterface {\n title\n summary\n content\n url\n featuredAsset {\n ... on AssetInterface {\n caption\n __typename\n }\n ... on ManagedImage {\n transform(transform: {width: $width, height: $height, crop: FOCALPOINT, fit: CROP})\n __typename\n }\n ... on ManagedVideo {\n url\n __typename\n }\n __typename\n }\n isExclusive\n isSponsored\n published {\n value\n __typename\n }\n __typename\n }\n ... on InternalArticleInterface {\n authors {\n displayName\n slug\n __typename\n }\n __typename\n }\n ... on ExternalArticleInterface {\n source\n __typename\n }\n ... on CuratedArticleLink {\n _id\n title\n published {\n value\n __typename\n }\n url\n __typename\n }\n ... on SyndicatedArticle {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n __typename\n }\n __typename\n }\n ... on OriginalArticle {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n slug\n __typename\n }\n __typename\n }\n ... on FashionWeekReview {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n __typename\n }\n __typename\n }\n }\n __typename\n }\n __typename\n }\n}\n',
20
19
  }),
21
20
  });
22
21
 
@@ -0,0 +1,75 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const date = require('@/utils/date');
4
+ module.exports = async (ctx) => {
5
+ const topicUrl = `https://www.cnbeta.com/topics/${ctx.params.topic_id}.htm`;
6
+ const response = await got({
7
+ method: 'get',
8
+ url: topicUrl,
9
+ });
10
+ const $ = cheerio.load(response.data);
11
+
12
+ const topicInfo = $('div.cate-brief h2 b').text();
13
+ const news_list = $('div.item')
14
+ .map((i, item) => {
15
+ const title = $(item).find('dl dt a').text();
16
+ let href = $(item).find('dl dt a').attr('href');
17
+ if (href === undefined) {
18
+ return null;
19
+ }
20
+ if (href.startsWith('//')) {
21
+ href = 'https:' + href;
22
+ }
23
+ const status = $(item).find('div.meta-data ul.status li')['0'].children[0].data;
24
+ const info = status.split(' ');
25
+ const author = info[0];
26
+ const pubDate = info[1] + ' ' + info[2];
27
+ return { title, href, author, pubDate };
28
+ })
29
+ .filter((x) => x)
30
+ .map((i, e) => e)
31
+ .get();
32
+
33
+ const ProcessFeed = (data) => {
34
+ const $ = cheerio.load(data);
35
+
36
+ // 移除6.18广告
37
+ $('.article-global').remove();
38
+ $('.article-topic').remove();
39
+
40
+ // 提取内容
41
+ return $('.article-summary p').html() + '<br>' + $('.article-content').html();
42
+ };
43
+
44
+ const out = await Promise.all(
45
+ news_list.map(async (item) => {
46
+ const cache = await ctx.cache.get(item.href);
47
+ if (cache) {
48
+ return Promise.resolve(JSON.parse(cache));
49
+ }
50
+
51
+ const response = await got({
52
+ method: 'get',
53
+ url: item.href,
54
+ });
55
+
56
+ const description = ProcessFeed(response.data);
57
+ const single = {
58
+ title: item.title,
59
+ description,
60
+ pubDate: date(item.pubDate, +8),
61
+ link: item.href,
62
+ author: item.author,
63
+ };
64
+ ctx.cache.set(item.href, JSON.stringify(single));
65
+ return Promise.resolve(single);
66
+ })
67
+ );
68
+
69
+ ctx.state.data = {
70
+ title: `cnBeta专题 - ${topicInfo}`,
71
+ link: topicUrl,
72
+ item: out ?? [],
73
+ description: `cnBeta专题 - ${topicInfo}`,
74
+ };
75
+ };
@@ -27,7 +27,12 @@ module.exports = async (ctx) => {
27
27
  const detailResponse = await got({ method: 'get', url: item.link, responseType: 'buffer' });
28
28
  const content = cheerio.load(iconv.decode(detailResponse.data, 'gbk'));
29
29
  item.description = content('div.text').html();
30
- item.pubDate = new Date(content('#p_publishtime').text().replace(/[年|月]/g, '-').replace(/日/g, ' ') + ' GMT+8').toUTCString();
30
+ item.pubDate = new Date(
31
+ content('#p_publishtime')
32
+ .text()
33
+ .replace(/[年|月]/g, '-')
34
+ .replace(/日/g, ' ') + ' GMT+8'
35
+ ).toUTCString();
31
36
  return item;
32
37
  })
33
38
  )
@@ -51,6 +51,11 @@ function tryFixStatus(status) {
51
51
  }
52
52
  }
53
53
 
54
+ // 接口提供的URL最后有分享追踪器,要删去,否则路由无法工作
55
+ if (status.sharing_url) {
56
+ status.sharing_url = status.sharing_url.split('?')[0];
57
+ }
58
+
54
59
  if (!result.isFixSuccess) {
55
60
  status.sharing_url = 'https://www.douban.com?rsshub_failed=' + now.getTime().toString();
56
61
  if (!status.create_time) {
@@ -28,7 +28,7 @@ module.exports = async (ctx) => {
28
28
  let link;
29
29
  let title;
30
30
  if (type === 'status') {
31
- link = item.target.status.sharing_url;
31
+ link = item.target.status.sharing_url.split('?')[0];
32
32
  author = item.target.status.author.name;
33
33
  title = author + '的广播';
34
34
  date = item.target.status.create_time;
@@ -0,0 +1,53 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+
4
+ module.exports = async (ctx) => {
5
+ const country = ctx.params.country || 'ww';
6
+
7
+ const rootUrl = `https://${country}.fashionnetwork.com`;
8
+ const response = await got({
9
+ method: 'get',
10
+ url: rootUrl,
11
+ });
12
+
13
+ const $ = cheerio.load(response.data);
14
+
15
+ const list = $('.point-carousel__item')
16
+ .slice(5, 10)
17
+ .map((_, item) => {
18
+ item = $(item);
19
+ const a = item.find('.family-title a');
20
+
21
+ return {
22
+ title: a.text(),
23
+ link: `${rootUrl}${a.attr('href')}`,
24
+ pubDate: Date.parse(item.find('.time-ago').attr('data-value')),
25
+ };
26
+ })
27
+ .get();
28
+
29
+ const items = await Promise.all(
30
+ list.map(
31
+ async (item) =>
32
+ await ctx.cache.tryGet(item.link, async () => {
33
+ const detailResponse = await got({
34
+ method: 'get',
35
+ url: item.link,
36
+ });
37
+ const content = cheerio.load(detailResponse.data);
38
+
39
+ content('.newsTitle, .ads').remove();
40
+
41
+ item.description = content('div[itemprop="text"]').html();
42
+
43
+ return item;
44
+ })
45
+ )
46
+ );
47
+
48
+ ctx.state.data = {
49
+ title: `${$('.category-label').eq(0).text()} - FashionNetwork`,
50
+ link: rootUrl,
51
+ item: items,
52
+ };
53
+ };
@@ -40,7 +40,10 @@ module.exports = async (ctx, currentUrl, query) => {
40
40
  item.description = description.html();
41
41
  item.title = content('.article-title').text();
42
42
  item.pubDate = new Date(pubDate).toUTCString();
43
- item.author = info.join(' ').replace(/作者:/, '').replace(/原创/, '');
43
+ item.author = info
44
+ .join(' ')
45
+ .replace(/作者:/, '')
46
+ .replace(/原创/, '');
44
47
 
45
48
  return item;
46
49
  })
@@ -65,7 +65,11 @@ module.exports = async (ctx) => {
65
65
  const detailResponse = await got({ method: 'get', url: item.link });
66
66
  const content = cheerio.load(detailResponse.data);
67
67
  item.description = content('div.concent_center').html();
68
- item.pubDate = new Date(content('td[align="right"]').text().replace(/发布日期:/, '') + ' GMT+8').toUTCString();
68
+ item.pubDate = new Date(
69
+ content('td[align="right"]')
70
+ .text()
71
+ .replace(/发布日期:/, '') + ' GMT+8'
72
+ ).toUTCString();
69
73
  return item;
70
74
  })
71
75
  )
@@ -48,7 +48,11 @@ module.exports = async (ctx) => {
48
48
  const detailResponse = await got({ method: 'get', url: item.link });
49
49
  const content = cheerio.load(detailResponse.data);
50
50
  item.description = content('div.concent_center').html();
51
- item.pubDate = new Date(content('td[align="right"]').text().replace(/发布日期:/, '') + ' GMT+8').toUTCString();
51
+ item.pubDate = new Date(
52
+ content('td[align="right"]')
53
+ .text()
54
+ .replace(/发布日期:/, '') + ' GMT+8'
55
+ ).toUTCString();
52
56
  return item;
53
57
  })
54
58
  )
@@ -20,8 +20,7 @@ module.exports = async (ctx) => {
20
20
  count: 25,
21
21
  maxShownVoters: 0,
22
22
  },
23
- query:
24
- 'query HacktivityPageQuery($querystring: String, $orderBy: HacktivityItemOrderInput, $secureOrderBy: FiltersHacktivityItemFilterOrder, $where: FiltersHacktivityItemFilterInput, $count: Int, $cursor: String, $maxShownVoters: Int) {\n me {\n id\n __typename\n }\n hacktivity_items(first: $count, after: $cursor, query: $querystring, order_by: $orderBy, secure_order_by: $secureOrderBy, where: $where) {\n total_count\n ...HacktivityList\n __typename\n }\n}\n\nfragment HacktivityList on HacktivityItemConnection {\n total_count\n pageInfo {\n endCursor\n hasNextPage\n __typename\n }\n edges {\n node {\n ... on HacktivityItemInterface {\n id\n databaseId: _id\n ...HacktivityItem\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment HacktivityItem on HacktivityItemUnion {\n type: __typename\n ... on HacktivityItemInterface {\n id\n votes {\n total_count\n __typename\n }\n voters: votes(last: $maxShownVoters) {\n edges {\n node {\n id\n user {\n id\n username\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n upvoted: upvoted_by_current_user\n __typename\n }\n ... on Undisclosed {\n id\n ...HacktivityItemUndisclosed\n __typename\n }\n ... on Disclosed {\n id\n ...HacktivityItemDisclosed\n __typename\n }\n ... on HackerPublished {\n id\n ...HacktivityItemHackerPublished\n __typename\n }\n}\n\nfragment HacktivityItemUndisclosed on Undisclosed {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n id\n ...TeamLinkWithMiniProfile\n __typename\n }\n latest_disclosable_action\n latest_disclosable_activity_at\n requires_view_privilege\n total_awarded_amount\n currency\n __typename\n}\n\nfragment TeamLinkWithMiniProfile on Team {\n id\n handle\n name\n __typename\n}\n\nfragment UserLinkWithMiniProfile on User {\n id\n username\n __typename\n}\n\nfragment HacktivityItemDisclosed on Disclosed {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n id\n ...TeamLinkWithMiniProfile\n __typename\n }\n report {\n id\n title\n substate\n url\n __typename\n }\n latest_disclosable_action\n latest_disclosable_activity_at\n total_awarded_amount\n severity_rating\n currency\n __typename\n}\n\nfragment HacktivityItemHackerPublished on HackerPublished {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n id\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n ...TeamLinkWithMiniProfile\n __typename\n }\n report {\n id\n url\n title\n substate\n __typename\n }\n latest_disclosable_activity_at\n severity_rating\n __typename\n}',
23
+ query: 'query HacktivityPageQuery($querystring: String, $orderBy: HacktivityItemOrderInput, $secureOrderBy: FiltersHacktivityItemFilterOrder, $where: FiltersHacktivityItemFilterInput, $count: Int, $cursor: String, $maxShownVoters: Int) {\n me {\n id\n __typename\n }\n hacktivity_items(first: $count, after: $cursor, query: $querystring, order_by: $orderBy, secure_order_by: $secureOrderBy, where: $where) {\n total_count\n ...HacktivityList\n __typename\n }\n}\n\nfragment HacktivityList on HacktivityItemConnection {\n total_count\n pageInfo {\n endCursor\n hasNextPage\n __typename\n }\n edges {\n node {\n ... on HacktivityItemInterface {\n id\n databaseId: _id\n ...HacktivityItem\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment HacktivityItem on HacktivityItemUnion {\n type: __typename\n ... on HacktivityItemInterface {\n id\n votes {\n total_count\n __typename\n }\n voters: votes(last: $maxShownVoters) {\n edges {\n node {\n id\n user {\n id\n username\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n upvoted: upvoted_by_current_user\n __typename\n }\n ... on Undisclosed {\n id\n ...HacktivityItemUndisclosed\n __typename\n }\n ... on Disclosed {\n id\n ...HacktivityItemDisclosed\n __typename\n }\n ... on HackerPublished {\n id\n ...HacktivityItemHackerPublished\n __typename\n }\n}\n\nfragment HacktivityItemUndisclosed on Undisclosed {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n id\n ...TeamLinkWithMiniProfile\n __typename\n }\n latest_disclosable_action\n latest_disclosable_activity_at\n requires_view_privilege\n total_awarded_amount\n currency\n __typename\n}\n\nfragment TeamLinkWithMiniProfile on Team {\n id\n handle\n name\n __typename\n}\n\nfragment UserLinkWithMiniProfile on User {\n id\n username\n __typename\n}\n\nfragment HacktivityItemDisclosed on Disclosed {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n id\n ...TeamLinkWithMiniProfile\n __typename\n }\n report {\n id\n title\n substate\n url\n __typename\n }\n latest_disclosable_action\n latest_disclosable_activity_at\n total_awarded_amount\n severity_rating\n currency\n __typename\n}\n\nfragment HacktivityItemHackerPublished on HackerPublished {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n id\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n ...TeamLinkWithMiniProfile\n __typename\n }\n report {\n id\n url\n title\n substate\n __typename\n }\n latest_disclosable_activity_at\n severity_rating\n __typename\n}',
25
24
  },
26
25
  responseType: 'json',
27
26
  });
@@ -23,8 +23,7 @@ module.exports = async (ctx) => {
23
23
  count: 25,
24
24
  maxShownVoters: 0,
25
25
  },
26
- query:
27
- 'query HacktivityPageQuery($querystring: String, $orderBy: HacktivityItemOrderInput, $secureOrderBy: FiltersHacktivityItemFilterOrder, $where: FiltersHacktivityItemFilterInput, $count: Int, $cursor: String, $maxShownVoters: Int) {\n me {\n id\n __typename\n }\n hacktivity_items(first: $count, after: $cursor, query: $querystring, order_by: $orderBy, secure_order_by: $secureOrderBy, where: $where) {\n total_count\n ...HacktivityList\n __typename\n }\n}\n\nfragment HacktivityList on HacktivityItemConnection {\n total_count\n pageInfo {\n endCursor\n hasNextPage\n __typename\n }\n edges {\n node {\n ... on HacktivityItemInterface {\n id\n databaseId: _id\n ...HacktivityItem\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment HacktivityItem on HacktivityItemUnion {\n type: __typename\n ... on HacktivityItemInterface {\n id\n votes {\n total_count\n __typename\n }\n voters: votes(last: $maxShownVoters) {\n edges {\n node {\n id\n user {\n id\n username\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n upvoted: upvoted_by_current_user\n __typename\n }\n ... on Undisclosed {\n id\n ...HacktivityItemUndisclosed\n __typename\n }\n ... on Disclosed {\n id\n ...HacktivityItemDisclosed\n __typename\n }\n ... on HackerPublished {\n id\n ...HacktivityItemHackerPublished\n __typename\n }\n}\n\nfragment HacktivityItemUndisclosed on Undisclosed {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n id\n ...TeamLinkWithMiniProfile\n __typename\n }\n latest_disclosable_action\n latest_disclosable_activity_at\n requires_view_privilege\n total_awarded_amount\n currency\n __typename\n}\n\nfragment TeamLinkWithMiniProfile on Team {\n id\n handle\n name\n __typename\n}\n\nfragment UserLinkWithMiniProfile on User {\n id\n username\n __typename\n}\n\nfragment HacktivityItemDisclosed on Disclosed {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n id\n ...TeamLinkWithMiniProfile\n __typename\n }\n report {\n id\n title\n substate\n url\n __typename\n }\n latest_disclosable_action\n latest_disclosable_activity_at\n total_awarded_amount\n severity_rating\n currency\n __typename\n}\n\nfragment HacktivityItemHackerPublished on HackerPublished {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n id\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n ...TeamLinkWithMiniProfile\n __typename\n }\n report {\n id\n url\n title\n substate\n __typename\n }\n latest_disclosable_activity_at\n severity_rating\n __typename\n}',
26
+ query: 'query HacktivityPageQuery($querystring: String, $orderBy: HacktivityItemOrderInput, $secureOrderBy: FiltersHacktivityItemFilterOrder, $where: FiltersHacktivityItemFilterInput, $count: Int, $cursor: String, $maxShownVoters: Int) {\n me {\n id\n __typename\n }\n hacktivity_items(first: $count, after: $cursor, query: $querystring, order_by: $orderBy, secure_order_by: $secureOrderBy, where: $where) {\n total_count\n ...HacktivityList\n __typename\n }\n}\n\nfragment HacktivityList on HacktivityItemConnection {\n total_count\n pageInfo {\n endCursor\n hasNextPage\n __typename\n }\n edges {\n node {\n ... on HacktivityItemInterface {\n id\n databaseId: _id\n ...HacktivityItem\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment HacktivityItem on HacktivityItemUnion {\n type: __typename\n ... on HacktivityItemInterface {\n id\n votes {\n total_count\n __typename\n }\n voters: votes(last: $maxShownVoters) {\n edges {\n node {\n id\n user {\n id\n username\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n upvoted: upvoted_by_current_user\n __typename\n }\n ... on Undisclosed {\n id\n ...HacktivityItemUndisclosed\n __typename\n }\n ... on Disclosed {\n id\n ...HacktivityItemDisclosed\n __typename\n }\n ... on HackerPublished {\n id\n ...HacktivityItemHackerPublished\n __typename\n }\n}\n\nfragment HacktivityItemUndisclosed on Undisclosed {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n id\n ...TeamLinkWithMiniProfile\n __typename\n }\n latest_disclosable_action\n latest_disclosable_activity_at\n requires_view_privilege\n total_awarded_amount\n currency\n __typename\n}\n\nfragment TeamLinkWithMiniProfile on Team {\n id\n handle\n name\n __typename\n}\n\nfragment UserLinkWithMiniProfile on User {\n id\n username\n __typename\n}\n\nfragment HacktivityItemDisclosed on Disclosed {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n id\n ...TeamLinkWithMiniProfile\n __typename\n }\n report {\n id\n title\n substate\n url\n __typename\n }\n latest_disclosable_action\n latest_disclosable_activity_at\n total_awarded_amount\n severity_rating\n currency\n __typename\n}\n\nfragment HacktivityItemHackerPublished on HackerPublished {\n id\n reporter {\n id\n username\n ...UserLinkWithMiniProfile\n __typename\n }\n team {\n id\n handle\n name\n medium_profile_picture: profile_picture(size: medium)\n url\n ...TeamLinkWithMiniProfile\n __typename\n }\n report {\n id\n url\n title\n substate\n __typename\n }\n latest_disclosable_activity_at\n severity_rating\n __typename\n}',
28
27
  },
29
28
  responseType: 'json',
30
29
  });
@@ -30,7 +30,7 @@ module.exports = async (ctx) => {
30
30
 
31
31
  return {
32
32
  title: news.text(),
33
- link: `${rootUrl}/${news.attr('href')}`,
33
+ link: `${rootUrl}${news.attr('href')}`,
34
34
  pubDate: new Date(date.length === 8 ? `${new Date().getFullYear().toString().slice(0, 2)}${date}` : date).toUTCString(),
35
35
  };
36
36
  });
@@ -45,6 +45,10 @@ module.exports = async (ctx) => {
45
45
  const content = cheerio.load(detailResponse.data);
46
46
 
47
47
  item.description = content('.article-content').html();
48
+ // substring 2 times
49
+ // from https://hkcnews.com/article/47878/loreal歐萊雅-薇婭-李佳琦-47884/薇婭、李佳琦幫loreal帶貨引價格爭議-loreal道歉
50
+ // to https://hkcnews.com/article/47878
51
+ item.guid = item.link.substring(0, item.link.lastIndexOf('/')).substring(0, item.link.substring(0, item.link.lastIndexOf('/')).lastIndexOf('/'));
48
52
 
49
53
  return item;
50
54
  })
@@ -109,7 +109,13 @@ module.exports = async (ctx) => {
109
109
  });
110
110
  const articleImg = content('.hkej_detail_thumb_2014 .enlargeImg').html() ?? '';
111
111
 
112
- const pubDate = content('p.info span.date').text().trim().replace('日', '').replace('今', today).replace('昨', yesterday).replace(/[年月]/g, '-');
112
+ const pubDate = content('p.info span.date')
113
+ .text()
114
+ .trim()
115
+ .replace('日', '')
116
+ .replace('今', today)
117
+ .replace('昨', yesterday)
118
+ .replace(/[年月]/g, '-');
113
119
 
114
120
  item.category = content('p.info span.cate a')
115
121
  .toArray()
@@ -1,3 +1,4 @@
1
+ const config = require('@/config').value;
1
2
  const got = require('@/utils/got');
2
3
  const timezone = require('@/utils/timezone');
3
4
  const cheerio = require('cheerio');
@@ -28,26 +29,17 @@ module.exports = async (ctx) => {
28
29
  if (value) {
29
30
  description = value;
30
31
  } else {
32
+ const cookie = config.infzm.cookie;
31
33
  const response = await got({
32
34
  method: 'get',
33
- url: `http://api.infzm.com/mobile/contents/${id}`,
35
+ url: `http://www.infzm.com/content/${id}`,
36
+ headers: {
37
+ Referer: link,
38
+ Cookie: cookie || `passport_session=${Math.floor(Math.random() * 100)};`,
39
+ },
34
40
  });
35
-
36
- if (response.data.code === 200) {
37
- description = response.data.data.content.fulltext;
38
- } else {
39
- // 有时候接口会返回未发布但实际已发布
40
- const response = await got({
41
- method: 'get',
42
- url: `http://www.infzm.com/content/${id}`,
43
- headers: {
44
- Referer: link,
45
- Cookie: `PHPSESSID=${Math.floor(Math.random() * 100)};`,
46
- },
47
- });
48
- const $ = cheerio.load(response.data);
49
- description = $('#content').html();
50
- }
41
+ const $ = cheerio.load(response.data);
42
+ description = $('div.nfzm-content__content').html();
51
43
 
52
44
  ctx.cache.set(key, description);
53
45
  }
@@ -0,0 +1,53 @@
1
+ const got = require('@/utils/got');
2
+ const { parseRelativeDate } = require('@/utils/parse-date');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const dayjs = require('dayjs');
5
+ module.exports = async (ctx) => {
6
+ const uuid = ctx.params.uuid;
7
+ const url = 'https://mlol.qt.qq.com/go/mlol_news/author_feeds?author_uuid=' + uuid;
8
+ const res = await got.get(url).json();
9
+ const data = res.data.feedsInfo;
10
+ const name = data[0].feedNews.footer.source;
11
+ const newData = [];
12
+ let pubDate = [];
13
+ for (let i = 0; i < data.length; i++) {
14
+ newData[i] = data[i].feedNews.body;
15
+ newData[i].link = 'https://mlol.qt.qq.com/go/mlol_news/varcache_article?is_lqt=true&docid=' + newData[i].commentID;
16
+ pubDate[i] = getPublishedDate(newData[i].link);
17
+ }
18
+ pubDate = await Promise.all(pubDate);
19
+ for (let i = 0; i < data.length; i++) {
20
+ newData[i].pubDate = pubDate[i];
21
+ }
22
+ ctx.state.data = {
23
+ title: `${name}的文章`,
24
+ link: String(url),
25
+ description: `${name}的文章`,
26
+ item: newData.map((item) => ({
27
+ title: item.title,
28
+ description: `<img src='${item.imgUrl}'>`,
29
+ link: item.link,
30
+ pubDate: item.pubDate,
31
+ })),
32
+ };
33
+ };
34
+
35
+ async function getPublishedDate(url) {
36
+ const res = await got.get(url).text();
37
+ const start = res.indexOf('createdStr') + 15;
38
+ const end = res.indexOf('"', start);
39
+ const date = res.substring(start, end);
40
+ let publishedDate;
41
+ if (date === '刚刚') {
42
+ publishedDate = dayjs();
43
+ } else if (date.indexOf('前') > 0) {
44
+ // XX分钟/小时前
45
+ publishedDate = parseRelativeDate(date);
46
+ } else if (date.indexOf('年') > 0) {
47
+ // YYYY年MM月DD日+MM月DD日 hh:mm
48
+ publishedDate = parseDate(date, ['YYYY年MM月DD日', 'MM月DD日 hh:mm']);
49
+ } else {
50
+ publishedDate = dayjs();
51
+ }
52
+ return publishedDate;
53
+ }