Skip to content

Commit

Permalink
fix: radar.js with type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Dec 11, 2023
1 parent ad87de6 commit 7e698e2
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/v2/cste/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
title: '栏目',
docs: 'https://docs.rsshub.app/routes/study#zhong-guo-ji-shu-jing-ji-xue-hui-lan-mu',
source: ['/site/term', '/'],
target: (params, url) => `/cste/${new URL(url).match(/site\/term\/(\d+)\.html/)[1]}`,
target: (params, url) => `/cste/${url.match(/site\/term\/(\d+)\.html/)[1]}`,
},
],
},
Expand Down
42 changes: 39 additions & 3 deletions lib/v2/dahecube/radar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const utils = require('./utils');

module.exports = {
'dahecube.com': {
_name: '大河财立方',
Expand All @@ -11,7 +9,45 @@ module.exports = {
target: (_, url) => {
const id = new URL(url).searchParams.get('recid');
let type = 'recommend';
Object.entries(utils.TYPE).forEach(([key, value]) => {
const TypeMap = {
recommend: {
name: '推荐',
id: 1,
},
history: {
name: '党史',
id: 37,
},
stock: {
name: '豫股',
id: 2,
},
business: {
name: '财经',
id: 4,
},
education: {
name: '投教',
id: 36,
},
finance: {
name: '金融',
id: 5,
},
science: {
name: '科创',
id: 19,
},
invest: {
name: '投融',
id: 29,
},
column: {
name: '专栏',
id: 33,
},
};
Object.entries(TypeMap).forEach(([key, value]) => {
if (value.id === id) {
type = key;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/fosshub/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
title: 'Software Update',
docs: 'https://docs.rsshub.app/routes/program-update#fosshub-software-update',
source: ['/'],
target: (params, url) => `/fosshub/${new URL(url).match(/\/(.*?)\.html$/)[1]}`,
target: (params, url) => `/fosshub/${url.match(/\/(.*?)\.html$/)[1]}`,
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions lib/v2/gov/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ module.exports = {
title: '新闻中心',
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-hu-lian-wang-luo-xin-xi-zhong-xin-xin-wen-zhong-xin',
source: ['/'],
target: (params, url) => `/gov/cnnic/${new URL(url).match(/cnnic\.net\.cn\/(.*)/)[1]}`,
target: (params, url) => `/gov/cnnic/${url.match(/cnnic\.net\.cn\/(.*)/)[1]}`,
},
],
},
Expand Down Expand Up @@ -1255,7 +1255,7 @@ module.exports = {
title: '上海市药品监督管理局',
docs: 'https://docs.rsshub.app/routes/government#shang-hai-shi-ren-min-zheng-fu-shang-hai-shi-yao-pin-jian-du-guan-li-ju',
source: ['/'],
target: (params, url) => `/gov/shanghai/yjj/${new URL(url).match(/yjj\.sh\.gov\.cn\/(.*)\/index.html/)[1]}`,
target: (params, url) => `/gov/shanghai/yjj/${url.match(/yjj\.sh\.gov\.cn\/(.*)\/index.html/)[1]}`,
},
],
'wsbs.wgj': [
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/mihoyo/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = {
if (!gids) {
return '';
}
const { type = '2' } = new URL(url).searchParams;
const type = new URL(url).searchParams.get('type') || '1';
const page_size = '20';
const last_id = '';
return `/mihoyo/bbs/official/${gids}/${type}/${page_size}/${last_id}`;
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/nmtv/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
title: '点播',
docs: 'https://docs.rsshub.app/routes/traditional-media#nei-meng-gu-guang-bo-dian-shi-tai-dian-bo',
source: ['/'],
target: (params, url) => `/nmtv/column/${new URL(url).toString.split(/\/folder/).pop()}`,
target: (params, url) => `/nmtv/column/${url.split(/\/folder/).pop()}`,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/oo-software/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
title: 'Changelog',
docs: 'https://docs.rsshub.app/routes/program-update#oo-software-changelog',
source: ['/en/changelog'],
target: (params, url) => `/oo-software/changelog/${new URL(url).match(/\/en\/(.*?)\/changelog/)[1]}`,
target: (params, url) => `/oo-software/changelog/${url.match(/\/en\/(.*?)\/changelog/)[1]}`,
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions lib/v2/thepaper/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ module.exports = {
title: '频道',
docs: 'https://docs.rsshub.app/routes/traditional-media#peng-pai-xin-wen-pin-dao',
source: ['/'],
target: (params, url) => `/thepaper/channel/${new URL(url).search(/channel_(\d+)/)}`,
target: (params, url) => `/thepaper/channel/${url.match(/channel_(\d+)/)?.[1]}`,
},
{
title: '栏目',
docs: 'https://docs.rsshub.app/routes/traditional-media#peng-pai-xin-wen-lie-biao',
source: ['/'],
target: (params, url) => `/thepaper/list/${new URL(url).search(/list_(\d+)/)}`,
target: (params, url) => `/thepaper/list/${url.search(/list_(\d+)/)?.[1]}`,
},
{
title: '澎湃美数组作品集',
Expand Down

0 comments on commit 7e698e2

Please sign in to comment.