rsshub 1.0.0-master.f7cdf8b → 1.0.0-master.f7f8b7a
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.
- package/README.md +3 -3
- package/lib/config.js +21 -8
- package/lib/middleware/cache/index.js +4 -3
- package/lib/middleware/cache/redis.js +3 -3
- package/lib/middleware/onerror.js +8 -0
- package/lib/middleware/template.js +79 -85
- package/lib/router.js +7 -7
- package/lib/routes/index.js +6 -13
- package/lib/utils/common-utils.js +2 -6
- package/lib/utils/render.js +2 -0
- package/lib/v2/1point3acres/maintainer.js +2 -2
- package/lib/v2/95mm/utils.js +3 -2
- package/lib/v2/aliyun/notice.js +1 -1
- package/lib/v2/amazon/maintainer.js +1 -1
- package/lib/v2/apnews/topics.js +1 -1
- package/lib/v2/arcteryx/maintainer.js +3 -3
- package/lib/v2/bangumi/maintainer.js +1 -0
- package/lib/v2/bangumi/radar.js +6 -0
- package/lib/v2/bangumi/router.js +1 -0
- package/lib/v2/bangumi/tv/user/wish.js +38 -0
- package/lib/v2/bellroy/maintainer.js +1 -1
- package/lib/v2/bilibili/cache.js +10 -7
- package/lib/v2/bilibili/maintainer.js +1 -0
- package/lib/v2/bilibili/platform.js +43 -0
- package/lib/v2/bilibili/radar.js +8 -0
- package/lib/v2/bilibili/router.js +1 -0
- package/lib/v2/bilibili/video.js +8 -1
- package/lib/v2/bossdesign/index.js +41 -0
- package/lib/v2/bossdesign/maintainer.js +3 -0
- package/lib/v2/bossdesign/radar.js +13 -0
- package/lib/v2/bossdesign/router.js +3 -0
- package/lib/v2/brave/latest.js +4 -2
- package/lib/v2/buaa/maintainer.js +4 -0
- package/lib/v2/buaa/news/index.js +46 -0
- package/lib/v2/buaa/radar.js +21 -0
- package/lib/v2/buaa/router.js +4 -0
- package/lib/v2/buaa/sme.js +59 -0
- package/lib/v2/cfachina/analygarden.js +60 -0
- package/lib/v2/cfachina/maintainer.js +3 -0
- package/lib/v2/cfachina/radar.js +13 -0
- package/lib/v2/cfachina/router.js +3 -0
- package/lib/v2/cna/maintainer.js +1 -0
- package/lib/v2/cna/radar.js +6 -0
- package/lib/v2/cna/router.js +1 -0
- package/lib/v2/cna/web/index.js +62 -0
- package/lib/v2/cste/radar.js +1 -1
- package/lib/v2/dahecube/radar.js +40 -4
- package/lib/v2/dongqiudi/utils.js +1 -1
- package/lib/v2/douban/maintainer.js +1 -0
- package/lib/v2/douban/other/discussion.js +58 -0
- package/lib/v2/douban/radar.js +8 -0
- package/lib/v2/douban/router.js +1 -0
- package/lib/v2/dut/defaults.js +4 -0
- package/lib/v2/dut/index.js +21 -9
- package/lib/v2/dut/maintainer.js +8 -7
- package/lib/v2/dut/radar.js +37 -29
- package/lib/v2/dut/shortcuts.js +5 -0
- package/lib/v2/egsea/flash.js +30 -0
- package/lib/v2/egsea/maintainer.js +3 -0
- package/lib/v2/egsea/radar.js +13 -0
- package/lib/v2/egsea/router.js +3 -0
- package/lib/v2/fisher-spb/news.js +1 -2
- package/lib/v2/fosshub/radar.js +1 -1
- package/lib/v2/fxiaoke/crm.js +63 -0
- package/lib/v2/fxiaoke/maintainer.js +3 -0
- package/lib/v2/fxiaoke/radar.js +37 -0
- package/lib/v2/fxiaoke/router.js +3 -0
- package/lib/v2/gdsrx/index.js +72 -0
- package/lib/v2/gdsrx/maintainer.js +3 -0
- package/lib/v2/gdsrx/radar.js +61 -0
- package/lib/v2/gdsrx/router.js +3 -0
- package/lib/v2/gogoanimehd/radar.js +1 -1
- package/lib/v2/gogoanimehd/recent-releases.js +1 -1
- package/lib/v2/google/alerts.js +33 -0
- package/lib/v2/google/maintainer.js +1 -0
- package/lib/v2/google/router.js +1 -0
- package/lib/v2/gov/maintainer.js +9 -2
- package/lib/v2/gov/moa/zdscxx.js +104 -0
- package/lib/v2/gov/mot/index.js +66 -0
- package/lib/v2/gov/nea/ghs.js +58 -0
- package/lib/v2/gov/nifdc/index.js +40 -33
- package/lib/v2/gov/radar.js +232 -4
- package/lib/v2/gov/router.js +10 -2
- package/lib/v2/gov/safe/business.js +8 -0
- package/lib/v2/gov/safe/complaint.js +8 -0
- package/lib/v2/gov/safe/templates/message.art +25 -0
- package/lib/v2/gov/safe/util.js +87 -0
- package/lib/v2/gov/zhengce/index.js +99 -0
- package/lib/v2/greasyfork/maintainer.js +1 -0
- package/lib/v2/greasyfork/router.js +1 -0
- package/lib/v2/greasyfork/scripts.js +25 -20
- package/lib/{routes/universities → v2}/harvard/health/blog.js +8 -7
- package/lib/v2/harvard/maintainer.js +3 -0
- package/lib/v2/harvard/radar.js +13 -0
- package/lib/v2/harvard/router.js +3 -0
- package/lib/v2/huxiu/briefColumn.js +13 -25
- package/lib/v2/huxiu/channel.js +28 -0
- package/lib/v2/huxiu/club.js +30 -0
- package/lib/v2/huxiu/collection.js +14 -26
- package/lib/v2/huxiu/maintainer.js +8 -5
- package/lib/v2/huxiu/member.js +27 -0
- package/lib/v2/huxiu/moment.js +11 -25
- package/lib/v2/huxiu/radar.js +24 -16
- package/lib/v2/huxiu/router.js +7 -4
- package/lib/v2/huxiu/search.js +16 -21
- package/lib/v2/huxiu/tag.js +13 -25
- package/lib/v2/huxiu/templates/description.art +46 -0
- package/lib/v2/huxiu/util.js +460 -0
- package/lib/v2/ifi-audio/maintainer.js +1 -1
- package/lib/v2/imiker/jinghua.js +87 -0
- package/lib/v2/imiker/maintainer.js +3 -0
- package/lib/v2/imiker/radar.js +13 -0
- package/lib/v2/imiker/router.js +3 -0
- package/lib/v2/imiker/templates/description.art +32 -0
- package/lib/v2/inoreader/maintainer.js +1 -1
- package/lib/v2/instagram/common-utils.js +7 -4
- package/lib/v2/instagram/templates/images.art +9 -2
- package/lib/v2/instagram/templates/video.art +4 -1
- package/lib/v2/instagram/web-api/index.js +30 -9
- package/lib/v2/instagram/web-api/utils.js +149 -25
- package/lib/v2/kemono/index.js +26 -2
- package/lib/v2/kemono/radar.js +1 -1
- package/lib/v2/kepu/live.js +89 -0
- package/lib/v2/kepu/maintainer.js +3 -0
- package/lib/v2/kepu/radar.js +13 -0
- package/lib/v2/kepu/router.js +3 -0
- package/lib/v2/kepu/templates/description.art +33 -0
- package/lib/v2/leetcode/maintainer.js +1 -1
- package/lib/v2/lightnovel/lightNovel.js +62 -0
- package/lib/v2/lightnovel/maintainer.js +3 -0
- package/lib/v2/lightnovel/radar.js +13 -0
- package/lib/v2/lightnovel/router.js +3 -0
- package/lib/v2/line/radar.js +1 -1
- package/lib/v2/liquipedia/cs_matches.js +52 -0
- package/lib/v2/liquipedia/dota2_matches.js +47 -0
- package/lib/v2/liquipedia/maintainer.js +4 -0
- package/lib/v2/liquipedia/radar.js +19 -0
- package/lib/v2/liquipedia/router.js +4 -0
- package/lib/v2/magazinelib/maintainer.js +1 -1
- package/lib/v2/mihoyo/radar.js +1 -1
- package/lib/v2/missav/maintainer.js +3 -0
- package/lib/v2/missav/new.js +36 -0
- package/lib/v2/missav/radar.js +13 -0
- package/lib/v2/missav/router.js +3 -0
- package/lib/v2/missav/templates/preview.art +3 -0
- package/lib/v2/modb/maintainer.js +3 -0
- package/lib/v2/modb/radar.js +13 -0
- package/lib/v2/modb/router.js +3 -0
- package/lib/v2/modb/topic.js +59 -0
- package/lib/v2/nature/cover.js +32 -42
- package/lib/v2/nature/highlight.js +2 -2
- package/lib/v2/nature/news-and-comment.js +2 -2
- package/lib/v2/nature/news.js +2 -2
- package/lib/v2/nature/research.js +2 -2
- package/lib/v2/nature/siteindex.js +5 -5
- package/lib/v2/nature/utils.js +124 -5
- package/lib/v2/ncu/jwc.js +33 -0
- package/lib/v2/ncu/maintainer.js +3 -0
- package/lib/v2/ncu/radar.js +13 -0
- package/lib/v2/ncu/router.js +3 -0
- package/lib/v2/nmtv/radar.js +1 -1
- package/lib/v2/oo-software/radar.js +1 -1
- package/lib/v2/patagonia/maintainer.js +1 -1
- package/lib/v2/phoronix/index.js +177 -48
- package/lib/v2/phoronix/maintainer.js +1 -1
- package/lib/v2/phoronix/radar.js +3 -3
- package/lib/v2/phoronix/router.js +1 -1
- package/lib/v2/picnob/maintainer.js +1 -1
- package/lib/v2/picnob/templates/desc.art +3 -3
- package/lib/v2/picnob/user.js +74 -37
- package/lib/v2/picnob/utils.js +24 -0
- package/lib/v2/qbitai/category.js +27 -0
- package/lib/v2/qbitai/maintainer.js +4 -0
- package/lib/v2/qbitai/radar.js +19 -0
- package/lib/v2/qbitai/router.js +4 -0
- package/lib/v2/qbitai/tag.js +27 -0
- package/lib/v2/questmobile/maintainer.js +3 -0
- package/lib/v2/questmobile/radar.js +18 -0
- package/lib/v2/questmobile/report.js +127 -0
- package/lib/v2/questmobile/router.js +3 -0
- package/lib/v2/questmobile/templates/description.art +17 -0
- package/lib/v2/readhub/daily.js +43 -0
- package/lib/v2/readhub/index.js +19 -72
- package/lib/v2/readhub/maintainer.js +1 -0
- package/lib/v2/readhub/radar.js +6 -0
- package/lib/v2/readhub/router.js +1 -0
- package/lib/v2/readhub/util.js +69 -0
- package/lib/v2/routledge/book-series.js +78 -0
- package/lib/v2/routledge/maintainer.js +3 -0
- package/lib/v2/routledge/radar.js +13 -0
- package/lib/v2/routledge/router.js +3 -0
- package/lib/v2/routledge/templates/description.art +7 -0
- package/lib/v2/showstart/artist.js +15 -0
- package/lib/v2/showstart/brand.js +15 -0
- package/lib/v2/showstart/const.js +4 -0
- package/lib/v2/showstart/event.js +18 -0
- package/lib/v2/showstart/maintainer.js +6 -0
- package/lib/v2/showstart/radar.js +40 -0
- package/lib/v2/showstart/router.js +6 -0
- package/lib/v2/showstart/search.js +51 -0
- package/lib/v2/showstart/service.js +166 -0
- package/lib/v2/showstart/utils.js +92 -0
- package/lib/v2/snowpeak/maintainer.js +1 -1
- package/lib/v2/sony/maintainer.js +1 -1
- package/lib/v2/sse/disclosure.js +4 -3
- package/lib/v2/sspu/jwc.js +44 -0
- package/lib/v2/sspu/maintainer.js +3 -0
- package/lib/v2/sspu/radar.js +13 -0
- package/lib/v2/sspu/router.js +3 -0
- package/lib/v2/techcrunch/maintainer.js +1 -1
- package/lib/v2/theatlantic/maintainer.js +1 -1
- package/lib/v2/thepaper/radar.js +2 -2
- package/lib/v2/threads/index.js +20 -150
- package/lib/v2/threads/utils.js +147 -0
- package/lib/v2/twitter/keyword.js +1 -3
- package/lib/v2/twitter/media.js +1 -5
- package/lib/v2/twitter/user.js +1 -3
- package/lib/v2/twitter/utils.js +5 -3
- package/lib/v2/twitter/web-api/constants.js +80 -68
- package/lib/v2/twitter/web-api/twitter-api.js +96 -103
- package/lib/v2/uniqlo/maintainer.js +3 -0
- package/lib/v2/uniqlo/new.js +62 -0
- package/lib/v2/uniqlo/radar.js +12 -0
- package/lib/v2/uniqlo/router.js +3 -0
- package/lib/v2/wechat/maintainer.js +1 -1
- package/lib/v2/weibo/maintainer.js +1 -1
- package/lib/v2/weibo/radar.js +1 -1
- package/lib/v2/weibo/router.js +1 -1
- package/lib/v2/weibo/search/hot.js +118 -7
- package/lib/v2/weibo/search/template/digest.art +17 -0
- package/lib/v2/xiaohongshu/util.js +17 -7
- package/lib/v2/xmnn/docs.js +0 -0
- package/lib/v2/xmnn/maintainer.js +1 -0
- package/lib/v2/xmnn/news.js +65 -0
- package/lib/v2/xmnn/radar.js +67 -1
- package/lib/v2/xmnn/router.js +1 -0
- package/lib/v2/xsijishe/maintainer.js +1 -0
- package/lib/v2/xsijishe/radar.js +12 -0
- package/lib/v2/xsijishe/rank.js +60 -0
- package/lib/v2/xsijishe/router.js +1 -0
- package/lib/v2/yahoo/maintainer.js +2 -0
- package/lib/v2/yahoo/news/tw/index.js +24 -0
- package/lib/v2/yahoo/news/tw/provider-helper.js +22 -0
- package/lib/v2/yahoo/news/tw/provider.js +24 -0
- package/lib/v2/yahoo/news/tw/utils.js +129 -0
- package/lib/v2/yahoo/radar.js +29 -1
- package/lib/v2/yahoo/router.js +4 -1
- package/lib/v2/yahoo/templates/youtube.art +1 -0
- package/lib/v2/yuque/book.js +6 -1
- package/lib/v2/yuque/utils.js +16 -0
- package/lib/v2/zagg/maintainer.js +1 -1
- package/lib/views/error.art +1 -1
- package/lib/views/rss3-ums.js +62 -0
- package/lib/views/welcome.art +1 -1
- package/package.json +45 -39
- package/lib/routes/egsea/flash.js +0 -40
- package/lib/routes/gov/moa/sjzxfb.js +0 -20
- package/lib/routes/liquipedia/dota2_matches.js +0 -50
- package/lib/routes/questmobile/report.js +0 -121
- package/lib/routes/uniqlo/stylingbook.js +0 -24
- package/lib/routes/universities/buaa/news/index.js +0 -66
- package/lib/routes/universities/buaa/utils.js +0 -57
- package/lib/v2/gov/zhengce/zuixin.js +0 -39
- package/lib/v2/huxiu/article.js +0 -33
- package/lib/v2/huxiu/author.js +0 -36
- package/lib/v2/huxiu/templates/brief.art +0 -22
- package/lib/v2/huxiu/templates/img.art +0 -3
- package/lib/v2/huxiu/templates/moment.art +0 -16
- package/lib/v2/huxiu/templates/video.art +0 -7
- package/lib/v2/huxiu/utils.js +0 -154
- package/lib/v2/twitter/web-api/twitter-got.js +0 -113
- /package/lib/{routes → v2}/gov/moa/moa.js +0 -0
- /package/lib/v2/yahoo/news/{index.js → us/index.js} +0 -0
package/lib/v2/gov/radar.js
CHANGED
|
@@ -424,7 +424,7 @@ module.exports = {
|
|
|
424
424
|
title: '新闻中心',
|
|
425
425
|
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-hu-lian-wang-luo-xin-xi-zhong-xin-xin-wen-zhong-xin',
|
|
426
426
|
source: ['/'],
|
|
427
|
-
target: (params, url) => `/gov/cnnic/${
|
|
427
|
+
target: (params, url) => `/gov/cnnic/${url.match(/cnnic\.net\.cn\/(.*)/)[1]}`,
|
|
428
428
|
},
|
|
429
429
|
],
|
|
430
430
|
},
|
|
@@ -816,6 +816,35 @@ module.exports = {
|
|
|
816
816
|
},
|
|
817
817
|
],
|
|
818
818
|
},
|
|
819
|
+
'moa.gov.cn': {
|
|
820
|
+
_name: '中华人民共和国农业农村部',
|
|
821
|
+
'.': [
|
|
822
|
+
{
|
|
823
|
+
title: '新闻',
|
|
824
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-yu-bu-xin-wen',
|
|
825
|
+
source: ['/'],
|
|
826
|
+
target: '/gov/moa/:suburl',
|
|
827
|
+
},
|
|
828
|
+
],
|
|
829
|
+
zdscxx: [
|
|
830
|
+
{
|
|
831
|
+
title: '数据',
|
|
832
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-yu-bu',
|
|
833
|
+
source: ['/nyb/pc/messageView.jsp'],
|
|
834
|
+
target: (_params, _url, document) => {
|
|
835
|
+
if (!document) {
|
|
836
|
+
return '/gov/moa/zdscxx';
|
|
837
|
+
}
|
|
838
|
+
const selected = document.querySelectorAll('.colorRed');
|
|
839
|
+
const categories = Array.from(selected)
|
|
840
|
+
.map((s) => s.getAttribute('_key'))
|
|
841
|
+
.join('/');
|
|
842
|
+
|
|
843
|
+
return `/gov/moa/zdscxx${categories ? `/${categories}` : ''}`;
|
|
844
|
+
},
|
|
845
|
+
},
|
|
846
|
+
],
|
|
847
|
+
},
|
|
819
848
|
'moe.gov.cn': {
|
|
820
849
|
_name: '中华人民共和国教育部',
|
|
821
850
|
'.': [
|
|
@@ -855,6 +884,159 @@ module.exports = {
|
|
|
855
884
|
},
|
|
856
885
|
],
|
|
857
886
|
},
|
|
887
|
+
'mot.gov.cn': {
|
|
888
|
+
_name: '中华人民共和国交通运输部',
|
|
889
|
+
'.': [
|
|
890
|
+
{
|
|
891
|
+
title: '栏目',
|
|
892
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
893
|
+
source: ['/:category*'],
|
|
894
|
+
target: (params) => {
|
|
895
|
+
const category = params.category;
|
|
896
|
+
|
|
897
|
+
return `/gov/mot${category ? `/${category}` : ''}`;
|
|
898
|
+
},
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
title: '时政要闻',
|
|
902
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
903
|
+
source: ['/shizhengyaowen'],
|
|
904
|
+
target: '/gov/mot/shizhengyaowen',
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
title: '交通要闻',
|
|
908
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
909
|
+
source: ['/jiaotongyaowen'],
|
|
910
|
+
target: '/gov/mot/jiaotongyaowen',
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
title: '重要会议',
|
|
914
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
915
|
+
source: ['/zhongyaohuiyi'],
|
|
916
|
+
target: '/gov/mot/zhongyaohuiyi',
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
title: '数据开放',
|
|
920
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
921
|
+
source: ['/sjkf'],
|
|
922
|
+
target: '/gov/mot/sjkf',
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
title: '统计数据',
|
|
926
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
927
|
+
source: ['/tongjishuju'],
|
|
928
|
+
target: '/gov/mot/tongjishuju',
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
title: '分析公报',
|
|
932
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
933
|
+
source: ['/fenxigongbao'],
|
|
934
|
+
target: '/gov/mot/fenxigongbao',
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
title: '运价指数',
|
|
938
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
939
|
+
source: ['/yunjiazhishu'],
|
|
940
|
+
target: '/gov/mot/yunjiazhishu',
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
title: '公路',
|
|
944
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
945
|
+
source: ['/tongjishuju/gonglu'],
|
|
946
|
+
target: '/gov/mot/tongjishuju/gonglu',
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
title: '水运',
|
|
950
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
951
|
+
source: ['/tongjishuju/shuiyun'],
|
|
952
|
+
target: '/gov/mot/tongjishuju/shuiyun',
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
title: '铁路',
|
|
956
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
957
|
+
source: ['/tongjishuju/tielu'],
|
|
958
|
+
target: '/gov/mot/tongjishuju/tielu',
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
title: '民航',
|
|
962
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
963
|
+
source: ['/tongjishuju/minhang'],
|
|
964
|
+
target: '/gov/mot/tongjishuju/minhang',
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
title: '邮政',
|
|
968
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
969
|
+
source: ['/tongjishuju/youzheng'],
|
|
970
|
+
target: '/gov/mot/tongjishuju/youzheng',
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
title: '城市客运',
|
|
974
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
975
|
+
source: ['/tongjishuju/chengshikeyun'],
|
|
976
|
+
target: '/gov/mot/tongjishuju/chengshikeyun',
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
title: '港口货物旅客吞吐量',
|
|
980
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
981
|
+
source: ['/tongjishuju/gangkouhuowulvkettl'],
|
|
982
|
+
target: '/gov/mot/tongjishuju/gangkouhuowulvkettl',
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
title: '固定资产投资完成情况',
|
|
986
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
987
|
+
source: ['/tongjishuju/gudingzichantouziwcqk'],
|
|
988
|
+
target: '/gov/mot/tongjishuju/gudingzichantouziwcqk',
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
title: '行业公报',
|
|
992
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
993
|
+
source: ['/fenxigongbao/hangyegongbao'],
|
|
994
|
+
target: '/gov/mot/fenxigongbao/hangyegongbao',
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
title: '经济分析',
|
|
998
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
999
|
+
source: ['/fenxigongbao/jingjifenxi'],
|
|
1000
|
+
target: '/gov/mot/fenxigongbao/jingjifenxi',
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
title: '科技统计',
|
|
1004
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
1005
|
+
source: ['/fenxigongbao/kejitongji'],
|
|
1006
|
+
target: '/gov/mot/fenxigongbao/kejitongji',
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
title: '运力分析',
|
|
1010
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
1011
|
+
source: ['/fenxigongbao/yunlifenxi'],
|
|
1012
|
+
target: '/gov/mot/fenxigongbao/yunlifenxi',
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
title: '沿海散货运价指数',
|
|
1016
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
1017
|
+
source: ['/yunjiazhishu/yanhaisanhuoyjzs'],
|
|
1018
|
+
target: '/gov/mot/yunjiazhishu/yanhaisanhuoyjzs',
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
title: '出口集装箱运价指数',
|
|
1022
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
1023
|
+
source: ['/yunjiazhishu/chukoujizhuangxiangyjzs'],
|
|
1024
|
+
target: '/gov/mot/yunjiazhishu/chukoujizhuangxiangyjzs',
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
title: '长江航运指数分析',
|
|
1028
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
1029
|
+
source: ['/yunjiazhishu/changjianghangyunzsfx'],
|
|
1030
|
+
target: '/gov/mot/yunjiazhishu/changjianghangyunzsfx',
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
title: '珠江水运经济运行分析',
|
|
1034
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-jiao-tong-yun-shu-bu-lan-mu',
|
|
1035
|
+
source: ['/yunjiazhishu/zhujiangshuiyunjjyxfx'],
|
|
1036
|
+
target: '/gov/mot/yunjiazhishu/zhujiangshuiyunjjyxfx',
|
|
1037
|
+
},
|
|
1038
|
+
],
|
|
1039
|
+
},
|
|
858
1040
|
'mztoday.gov.cn': {
|
|
859
1041
|
_name: '德阳市人民政府',
|
|
860
1042
|
www: [
|
|
@@ -866,14 +1048,25 @@ module.exports = {
|
|
|
866
1048
|
},
|
|
867
1049
|
],
|
|
868
1050
|
},
|
|
1051
|
+
'nea.gov.cn': {
|
|
1052
|
+
_name: '国家能源局',
|
|
1053
|
+
'.': [
|
|
1054
|
+
{
|
|
1055
|
+
title: '发展规划司',
|
|
1056
|
+
docs: 'https://docs.rsshub.app/routes/government#guo-jia-neng-yuan-ju-fa-zhan-gui-hua-si',
|
|
1057
|
+
source: ['/sjzz/ghs/'],
|
|
1058
|
+
target: '/gov/nea/sjzz/ghs',
|
|
1059
|
+
},
|
|
1060
|
+
],
|
|
1061
|
+
},
|
|
869
1062
|
'nifdc.gov.cn': {
|
|
870
1063
|
_name: '国家药品监督管理局医疗器械标准管理中心',
|
|
871
1064
|
'.': [
|
|
872
1065
|
{
|
|
873
1066
|
title: '通用',
|
|
874
1067
|
docs: 'https://docs.rsshub.app/routes/government#guo-jia-yao-pin-jian-du-guan-li-ju-yi-liao-qi-xie-biao-zhun-guan-li-zhong-xin',
|
|
875
|
-
source: ['/*
|
|
876
|
-
target: (params) => `/gov/nifdc/${params.path.replace(
|
|
1068
|
+
source: ['/*'],
|
|
1069
|
+
target: (params) => `/gov/nifdc/${params.path.replace(/\/index\.html$/, '')}`,
|
|
877
1070
|
},
|
|
878
1071
|
],
|
|
879
1072
|
},
|
|
@@ -1003,6 +1196,31 @@ module.exports = {
|
|
|
1003
1196
|
},
|
|
1004
1197
|
],
|
|
1005
1198
|
},
|
|
1199
|
+
'safe.gov.cn': {
|
|
1200
|
+
_name: '国家外汇管理局',
|
|
1201
|
+
'.': [
|
|
1202
|
+
{
|
|
1203
|
+
title: '业务咨询',
|
|
1204
|
+
docs: 'https://docs.rsshub.app/routes/government#guo-jia-wai-hui-guan-li-ju-ye-wu-zi-xun',
|
|
1205
|
+
source: ['/:site/ywzx/index.html'],
|
|
1206
|
+
target: (params) => {
|
|
1207
|
+
const site = params.site;
|
|
1208
|
+
|
|
1209
|
+
return `/gov/safe/business/${site}`;
|
|
1210
|
+
},
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
title: '投诉建议',
|
|
1214
|
+
docs: 'https://docs.rsshub.app/routes/government#guo-jia-wai-hui-guan-li-ju-tou-su-jian-yi',
|
|
1215
|
+
source: ['/:site/tsjy/index.html'],
|
|
1216
|
+
target: (params) => {
|
|
1217
|
+
const site = params.site;
|
|
1218
|
+
|
|
1219
|
+
return `/gov/safe/complaint/${site}`;
|
|
1220
|
+
},
|
|
1221
|
+
},
|
|
1222
|
+
],
|
|
1223
|
+
},
|
|
1006
1224
|
'sasac.gov.cn': {
|
|
1007
1225
|
_name: '国务院国有资产监督管理委员会',
|
|
1008
1226
|
'.': [
|
|
@@ -1048,7 +1266,7 @@ module.exports = {
|
|
|
1048
1266
|
title: '上海市药品监督管理局',
|
|
1049
1267
|
docs: 'https://docs.rsshub.app/routes/government#shang-hai-shi-ren-min-zheng-fu-shang-hai-shi-yao-pin-jian-du-guan-li-ju',
|
|
1050
1268
|
source: ['/'],
|
|
1051
|
-
target: (params, url) => `/gov/shanghai/yjj/${
|
|
1269
|
+
target: (params, url) => `/gov/shanghai/yjj/${url.match(/yjj\.sh\.gov\.cn\/(.*)\/index.html/)[1]}`,
|
|
1052
1270
|
},
|
|
1053
1271
|
],
|
|
1054
1272
|
'wsbs.wgj': [
|
|
@@ -1194,6 +1412,16 @@ module.exports = {
|
|
|
1194
1412
|
source: ['/pushinfo/v150203', '/'],
|
|
1195
1413
|
target: '/gov/news/gwy',
|
|
1196
1414
|
},
|
|
1415
|
+
{
|
|
1416
|
+
title: '政策',
|
|
1417
|
+
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-zheng-fu-wang-zheng-ce',
|
|
1418
|
+
source: ['/zhengce/:category*'],
|
|
1419
|
+
target: (params) => {
|
|
1420
|
+
const category = params.category;
|
|
1421
|
+
|
|
1422
|
+
return `/gov/zhengce${category ? `/${category}` : ''}`;
|
|
1423
|
+
},
|
|
1424
|
+
},
|
|
1197
1425
|
{
|
|
1198
1426
|
title: '最新政策',
|
|
1199
1427
|
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-zheng-fu-wang',
|
package/lib/v2/gov/router.js
CHANGED
|
@@ -16,17 +16,22 @@ module.exports = function (router) {
|
|
|
16
16
|
router.get('/mee/ywdt/:category?', require('./mee/ywdt'));
|
|
17
17
|
router.get('/mem/gk/sgcc/:category?', require('./mem/sgcc'));
|
|
18
18
|
router.get('/mfa/wjdt/:category?', require('./mfa/wjdt'));
|
|
19
|
+
router.get('/mot/:category*', require('./mot'));
|
|
19
20
|
router.get('/miit/wjfb/:ministry', require('./miit/wjfb'));
|
|
20
21
|
router.get('/miit/yjzj', require('./miit/yjzj'));
|
|
21
22
|
router.get('/miit/zcwj', require('./miit/zcwj'));
|
|
22
23
|
router.get('/miit/wjgs', require('./miit/wjgs'));
|
|
23
24
|
router.get('/miit/zcjd', require('./miit/zcjd'));
|
|
25
|
+
router.get('/moa/sjzxfb/:category*', require('./moa/zdscxx'));
|
|
26
|
+
router.get('/moa/zdscxx/:category*', require('./moa/zdscxx'));
|
|
27
|
+
router.get('/moa/:suburl(.*)', require('./moa/moa'));
|
|
24
28
|
router.get('/moe/:type', require('./moe/moe'));
|
|
25
29
|
router.get('/moe/s78/:column', require('./moe/s78'));
|
|
26
30
|
router.get('/mofcom/article/:suffix+', require('./mofcom/article'));
|
|
27
31
|
router.get('/moj/aac/news/:type?', require('./moj/aac/news'));
|
|
32
|
+
router.get('/nea/sjzz/ghs', require('./nea/ghs'));
|
|
28
33
|
router.get('/news/:uid', require('./news'));
|
|
29
|
-
router.get(/nifdc
|
|
34
|
+
router.get('/nifdc/:path*', require('./nifdc'));
|
|
30
35
|
router.get(/\/nmpa\/([\w][\w/]+)?/, require('./nmpa/generic'));
|
|
31
36
|
router.get(/nopss(\/[\w/-]+)?/, require('./nopss'));
|
|
32
37
|
router.get('/npc/:caty', require('./npc/index'));
|
|
@@ -37,13 +42,16 @@ module.exports = function (router) {
|
|
|
37
42
|
router.get('/pbc/gzlw', require('./pbc/gzlw'));
|
|
38
43
|
router.get('/pbc/tradeAnnouncement', require('./pbc/tradeAnnouncement'));
|
|
39
44
|
router.get('/pbc/zcyj', require('./pbc/zcyj'));
|
|
45
|
+
router.get('/safe/business/:site?', require('./safe/business'));
|
|
46
|
+
router.get('/safe/complaint/:site?', require('./safe/complaint'));
|
|
40
47
|
router.get('/samr/xgzlyhd/:category?/:department?', require('./samr/xgzlyhd'));
|
|
41
48
|
router.get('/sasac/:path+', require('./sasac/generic'));
|
|
42
49
|
router.get(/stats(\/[\w/-]+)?/, require('./stats'));
|
|
43
50
|
router.get('/zhengce/govall/:advance?', require('./zhengce/govall'));
|
|
44
51
|
router.get('/zhengce/wenjian/:pcodeJiguan?', require('./zhengce/wenjian'));
|
|
45
52
|
router.get('/zhengce/zhengceku/:department', require('./zhengce/zhengceku'));
|
|
46
|
-
router.get('/zhengce/zuixin', require('./zhengce
|
|
53
|
+
router.get('/zhengce/zuixin', require('./zhengce'));
|
|
54
|
+
router.get('/zhengce/:category*', require('./zhengce'));
|
|
47
55
|
// province
|
|
48
56
|
router.get(/anhui\/kjt\/([\w\d/-]+)?/, require('./anhui/kjt'));
|
|
49
57
|
router.get(/beijing\/bphc(\/[\w/-]+)?/, require('./beijing/bphc'));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const { processZxfkItems } = require('./util');
|
|
2
|
+
|
|
3
|
+
module.exports = async (ctx) => {
|
|
4
|
+
const { site = 'beijing' } = ctx.params;
|
|
5
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 3;
|
|
6
|
+
|
|
7
|
+
ctx.state.data = await processZxfkItems(site, 'ywzx', limit);
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const { processZxfkItems } = require('./util');
|
|
2
|
+
|
|
3
|
+
module.exports = async (ctx) => {
|
|
4
|
+
const { site = 'beijing' } = ctx.params;
|
|
5
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5;
|
|
6
|
+
|
|
7
|
+
ctx.state.data = await processZxfkItems(site, 'tsjy', limit);
|
|
8
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<table>
|
|
2
|
+
<tbody>
|
|
3
|
+
<tr>
|
|
4
|
+
<th>留言人</th>
|
|
5
|
+
<th>留言内容</th>
|
|
6
|
+
<th>留言时间</th>
|
|
7
|
+
</tr>
|
|
8
|
+
{{ if message }}
|
|
9
|
+
{{ set object = message }}
|
|
10
|
+
<tr>
|
|
11
|
+
<td>{{ object.author }}</td>
|
|
12
|
+
<td>{{ object.content }}</td>
|
|
13
|
+
<td>{{ object.date }}</td>
|
|
14
|
+
</tr>
|
|
15
|
+
{{ /if }}
|
|
16
|
+
{{ if reply }}
|
|
17
|
+
{{ set object = reply }}
|
|
18
|
+
<tr style="color: #0069ae;">
|
|
19
|
+
<td>{{ object.author }}</td>
|
|
20
|
+
<td>{{ object.content }}</td>
|
|
21
|
+
<td>{{ object.date }}</td>
|
|
22
|
+
</tr>
|
|
23
|
+
{{ /if }}
|
|
24
|
+
</tbody>
|
|
25
|
+
</table>
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
const rootUrl = 'https://www.safe.gov.cn';
|
|
8
|
+
|
|
9
|
+
const zxfkCategoryApis = {
|
|
10
|
+
// 业务咨询 https://www.safe.gov.cn/<site>/ywzx/index.html
|
|
11
|
+
ywzx: 'www/busines/businessQuery?siteid=',
|
|
12
|
+
|
|
13
|
+
// 投诉建议 https://www.safe.gov.cn/<site>/tsjy/index.html
|
|
14
|
+
tsjy: 'www/complaint/complaintQuery?siteid=',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const processZxfkItems = async (site = 'beijing', category = 'ywzx', limit = '3') => {
|
|
18
|
+
const apiUrl = new URL(`${zxfkCategoryApis[category]}${site}`, rootUrl).href;
|
|
19
|
+
const currentUrl = new URL(`${site}/${category}/index.html`, rootUrl).href;
|
|
20
|
+
|
|
21
|
+
const { data: response } = await got(apiUrl);
|
|
22
|
+
|
|
23
|
+
const $ = cheerio.load(response);
|
|
24
|
+
|
|
25
|
+
const items = $('#complaint')
|
|
26
|
+
.slice(0, limit)
|
|
27
|
+
.toArray()
|
|
28
|
+
.map((item) => {
|
|
29
|
+
item = $(item);
|
|
30
|
+
|
|
31
|
+
const spans = item.find('span[objid]');
|
|
32
|
+
|
|
33
|
+
const message = {
|
|
34
|
+
author: spans.first().text().replace(/:$/, ''),
|
|
35
|
+
content: spans.eq(1).text(),
|
|
36
|
+
date: spans.eq(2).text(),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const reply = {
|
|
40
|
+
author: spans.eq(3).text().replace(/:$/, ''),
|
|
41
|
+
content: spans.eq(4).text(),
|
|
42
|
+
date: spans.eq(5).text(),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
title: `${message.author}: ${message.content}`,
|
|
47
|
+
link: new URL(item.find('.title').prop('href'), rootUrl).href,
|
|
48
|
+
description: art(path.join(__dirname, 'templates/message.art'), {
|
|
49
|
+
message,
|
|
50
|
+
reply,
|
|
51
|
+
}),
|
|
52
|
+
author: `${message.author}/${reply.author}`,
|
|
53
|
+
guid: item.find('.id').text(),
|
|
54
|
+
pubDate: parseDate(message.date),
|
|
55
|
+
updated: parseDate(reply.date),
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const { data: currentResponse } = await got(currentUrl);
|
|
60
|
+
|
|
61
|
+
const content = cheerio.load(currentResponse);
|
|
62
|
+
|
|
63
|
+
const author = content('meta[name="ColumnName"]').prop('content');
|
|
64
|
+
const subtitle = content('meta[name="ColumnType"]').prop('content');
|
|
65
|
+
|
|
66
|
+
const imagePath = 'safe/templateresource/372b1dfdab204181b9b4f943a8e926a6';
|
|
67
|
+
const image = new URL(`${imagePath}/logo_06.png`, rootUrl).href;
|
|
68
|
+
const icon = new URL(`${imagePath}/safe.ico`, rootUrl).href;
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
item: items,
|
|
72
|
+
title: `${author} - ${subtitle}`,
|
|
73
|
+
link: currentUrl,
|
|
74
|
+
description: content('meta[name="ColumnDescription"]').prop('content'),
|
|
75
|
+
language: 'zh',
|
|
76
|
+
image,
|
|
77
|
+
icon,
|
|
78
|
+
logo: icon,
|
|
79
|
+
subtitle,
|
|
80
|
+
author,
|
|
81
|
+
allowEmpty: true,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
module.exports = {
|
|
86
|
+
processZxfkItems,
|
|
87
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const timezone = require('@/utils/timezone');
|
|
4
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
5
|
+
|
|
6
|
+
module.exports = async (ctx) => {
|
|
7
|
+
const { category = 'zuixin' } = ctx.params;
|
|
8
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 20;
|
|
9
|
+
|
|
10
|
+
const rootUrl = 'https://www.gov.cn';
|
|
11
|
+
const currentUrl = new URL(`zhengce/${category.replace(/\/$/, '')}/`, rootUrl).href;
|
|
12
|
+
|
|
13
|
+
const { data: response } = await got(currentUrl);
|
|
14
|
+
|
|
15
|
+
const $ = cheerio.load(response);
|
|
16
|
+
|
|
17
|
+
let items = $('h4 a, div.subtitle a[title]')
|
|
18
|
+
.toArray()
|
|
19
|
+
.map((item) => {
|
|
20
|
+
item = $(item);
|
|
21
|
+
|
|
22
|
+
const link = item.prop('href');
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
title: item.text(),
|
|
26
|
+
link: link.startsWith('http') ? link : new URL(link, currentUrl).href,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
items = await Promise.all(
|
|
31
|
+
items
|
|
32
|
+
.filter((item) => /https?:\/\/www\.gov\.cn\/zhengce.*content_\d+\.htm/.test(item.link))
|
|
33
|
+
.slice(0, limit)
|
|
34
|
+
.map((item) =>
|
|
35
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
36
|
+
const { data: detailResponse } = await got(item.link);
|
|
37
|
+
|
|
38
|
+
const content = cheerio.load(detailResponse);
|
|
39
|
+
|
|
40
|
+
const processElementText = (el) => content(el).text().split(/:/).pop().trim() || content(el).next().text().trim();
|
|
41
|
+
|
|
42
|
+
const author = content('meta[name="author"]').prop('content');
|
|
43
|
+
|
|
44
|
+
const agencyEl = content('table.bd1')
|
|
45
|
+
.find('td')
|
|
46
|
+
.toArray()
|
|
47
|
+
.filter((a) => content(a).text().startsWith('发文机关'))
|
|
48
|
+
.pop();
|
|
49
|
+
|
|
50
|
+
const sourceEl = content('span.font-zyygwj')
|
|
51
|
+
.toArray()
|
|
52
|
+
.filter((a) => content(a).text().startsWith('来源'))
|
|
53
|
+
.pop();
|
|
54
|
+
|
|
55
|
+
const subjectEl = content('table.bd1')
|
|
56
|
+
.find('td')
|
|
57
|
+
.toArray()
|
|
58
|
+
.filter((a) => content(a).text().startsWith('主题分类'))
|
|
59
|
+
.pop();
|
|
60
|
+
|
|
61
|
+
const agency = agencyEl ? processElementText(agencyEl) : undefined;
|
|
62
|
+
const source = sourceEl ? processElementText(sourceEl) : undefined;
|
|
63
|
+
const subject = subjectEl ? processElementText(subjectEl) : content('td.zcwj_ztfl').text();
|
|
64
|
+
|
|
65
|
+
const column = content('meta[name="lanmu"]').prop('content');
|
|
66
|
+
const keywords = content('meta[name="keywords"]').prop('content')?.split(/;|,/) ?? [];
|
|
67
|
+
const manuscriptId = content('meta[name="manuscriptId"]').prop('content');
|
|
68
|
+
|
|
69
|
+
item.title = content('div.share-title').text() || item.title;
|
|
70
|
+
item.description = content('div.TRS_UEDITOR').first().html() || content('div#UCAP-CONTENT, td#UCAP-CONTENT').first().html();
|
|
71
|
+
item.author = [agency, source, author].filter((a) => a).join('/');
|
|
72
|
+
item.category = [...new Set([subject, column, ...keywords].filter((c) => c))];
|
|
73
|
+
item.guid = `gov-zhengce-${manuscriptId}`;
|
|
74
|
+
item.pubDate = timezone(parseDate(content('meta[name="firstpublishedtime"]').prop('content'), 'YYYY-MM-DD-HH:mm:ss'), +8);
|
|
75
|
+
item.updated = timezone(parseDate(content('meta[name="lastmodifiedtime"]').prop('content'), 'YYYY-MM-DD-HH:mm:ss'), +8);
|
|
76
|
+
|
|
77
|
+
return item;
|
|
78
|
+
})
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const image = new URL($('img.wordlogo').prop('src'), rootUrl).href;
|
|
83
|
+
const icon = new URL($('link[rel="icon"]').prop('href'), rootUrl).href;
|
|
84
|
+
const subtitle = $('meta[name="lanmu"]').prop('content');
|
|
85
|
+
const author = $('div.header_logo a[aria-label]').prop('aria-label');
|
|
86
|
+
|
|
87
|
+
ctx.state.data = {
|
|
88
|
+
item: items,
|
|
89
|
+
title: author && subtitle ? `${author} - ${subtitle}` : $('title').text(),
|
|
90
|
+
link: currentUrl,
|
|
91
|
+
description: $('meta[name="description"]').prop('content'),
|
|
92
|
+
language: 'zh-CN',
|
|
93
|
+
image,
|
|
94
|
+
icon,
|
|
95
|
+
logo: icon,
|
|
96
|
+
subtitle,
|
|
97
|
+
author,
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -2,4 +2,5 @@ module.exports = (router) => {
|
|
|
2
2
|
router.get('/:language/:domain?', require('./scripts'));
|
|
3
3
|
router.get('/scripts/:script/feedback', require('./feedback'));
|
|
4
4
|
router.get('/scripts/:script/versions', require('./versions'));
|
|
5
|
+
router.get('/scripts/sort/:sort/:language?', require('./scripts'));
|
|
5
6
|
};
|
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
|
-
const
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
4
|
|
|
5
5
|
module.exports = async (ctx) => {
|
|
6
|
-
const language = ctx.params.language === 'all' ? 'zh-CN' : ctx.params.language;
|
|
6
|
+
const language = ctx.params.language === 'all' ? 'zh-CN' : ctx.params.language || 'zh-CN';
|
|
7
7
|
const domain = ctx.params.domain;
|
|
8
8
|
const filter_locale = ctx.params.language === 'all' ? 0 : 1;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const sort = ctx.params.sort ? ctx.params.sort : 'updated';
|
|
10
|
+
const url = domain ? `/by-site/${domain}` : '';
|
|
11
|
+
const currentUrl = `https://greasyfork.org/${language}/scripts${url}`;
|
|
11
12
|
const res = await got({
|
|
12
13
|
method: 'get',
|
|
13
14
|
url: currentUrl,
|
|
14
|
-
searchParams:
|
|
15
|
+
searchParams: {
|
|
15
16
|
filter_locale,
|
|
16
|
-
sort
|
|
17
|
-
}
|
|
17
|
+
sort,
|
|
18
|
+
},
|
|
18
19
|
});
|
|
19
20
|
const $ = cheerio.load(res.data);
|
|
20
|
-
const list = $('.script-list').find('
|
|
21
|
+
const list = $('.script-list').find('article');
|
|
21
22
|
|
|
22
23
|
ctx.state.data = {
|
|
23
24
|
title: $('title').first().text(),
|
|
24
25
|
link: currentUrl,
|
|
25
26
|
description: $('meta[name=description]').attr('content'),
|
|
26
|
-
item:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
item: list?.toArray().map((item) => {
|
|
28
|
+
item = $(item);
|
|
29
|
+
const h2 = item.find('h2');
|
|
30
|
+
return {
|
|
31
|
+
title: h2.find('a').text(),
|
|
32
|
+
description: h2.find('.description').text(),
|
|
33
|
+
link: new URL(h2.find('a').attr('href'), 'https://greasyfork.org').href,
|
|
34
|
+
pubDate: parseDate(item.find('.script-list-created-date relative-time').attr('datetime')),
|
|
35
|
+
updated: parseDate(item.find('.script-list-updated-date relative-time').attr('datetime')),
|
|
36
|
+
author: item
|
|
37
|
+
.find('.script-list-author a')
|
|
38
|
+
.toArray()
|
|
39
|
+
.map((a) => $(a).text())
|
|
40
|
+
.join(', '),
|
|
41
|
+
};
|
|
42
|
+
}),
|
|
38
43
|
};
|
|
39
44
|
};
|