forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #293 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
29 changed files
with
401 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/whpj/:format?': ['LogicJake', 'HenryQW'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'boc.cn': { | ||
_name: '中国银行', | ||
'.': [ | ||
{ | ||
title: '外汇牌价', | ||
docs: 'https://docs.rsshub.app/routes/others#zhong-guo-yin-hang', | ||
source: ['/sourcedb/whpj', '/'], | ||
target: '/boc/whpj', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/whpj/:format?', require('./whpj')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/:id?': ['nczitzk'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'cna.com.tw': { | ||
_name: '中央通訊社', | ||
'.': [ | ||
{ | ||
title: '分类', | ||
docs: 'https://docs.rsshub.app/routes/traditional-media#zhong-yang-tong-xun-she', | ||
source: ['/list/:id', '/topic/newstopic/:id'], | ||
target: (params) => `/cna/${params.id.replace('.aspx', '')}`, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/:id?', require('./')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/whpj/:format?': ['leoleoasd'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'icbc.com.cn': { | ||
_name: '中国工商银行', | ||
'.': [ | ||
{ | ||
title: '外汇牌价', | ||
docs: 'https://docs.rsshub.app/other#zhong-guo-gong-shang-yin-hang', | ||
source: ['/column/1438058341489590354.html'], | ||
target: '/icbc/whpj', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/whpj/:format?', require('./whpj')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const got = require('@/utils/got'); | ||
|
||
module.exports = async (ctx) => { | ||
// yes, insecure | ||
// their openssl version isn't safe anyway (https://stackoverflow.com/questions/75763525/curl-35-error0a000152ssl-routinesunsafe-legacy-renegotiation-disabled) | ||
const { data } = await got('http://papi.icbc.com.cn/exchanges/ns/getLatest'); | ||
const format = ctx.params.format; | ||
|
||
ctx.state.data = { | ||
title: '中国工商银行外汇牌价', | ||
link: 'https://www.icbc.com.cn/column/1438058341489590354.html', | ||
item: data.data.map((item) => { | ||
const name = `${item.currencyCHName} ${item.currencyENName}`; | ||
|
||
const xhmr = `现汇买入价:${item.foreignBuy}`; | ||
|
||
const xcmr = `现钞买入价:${item.cashBuy}`; | ||
|
||
const xhmc = `现汇卖出价:${item.foreignSell}`; | ||
|
||
const xcmc = `现钞卖出价:${item.cashSell}`; | ||
|
||
const zs = `参考价:${item.reference}`; | ||
|
||
const content = `${xhmr} ${xcmr} ${xhmc} ${xcmc} ${zs}`; | ||
|
||
const formatTitle = () => { | ||
switch (format) { | ||
case 'short': | ||
return name; | ||
case 'xh': | ||
return `${name} ${xhmr} ${xhmc}`; | ||
case 'xc': | ||
return `${name} ${xcmr} ${xcmc}`; | ||
case 'zs': | ||
return `${name} ${zs}`; | ||
case 'xhmr': | ||
return `${name} ${xhmr}`; | ||
case 'xhmc': | ||
return `${name} ${xhmc}`; | ||
case 'xcmr': | ||
return `${name} ${xcmr}`; | ||
case 'xcmc': | ||
return `${name} ${xcmc}`; | ||
default: | ||
return `${name} ${content}`; | ||
} | ||
}; | ||
return { | ||
title: formatTitle(), | ||
pubDate: new Date(`${item.publishDate} ${item.publishTime}`), | ||
description: content.replace(/\s/g, '<br>'), | ||
guid: `${name} ${item.publishDate} ${item.publishTime}`, | ||
}; | ||
}), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
'/post/:postid': ['kt286'], | ||
'/tab/:tabid': ['liyefox'], | ||
'/topics/:type': ['WhiteWorld'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const got = require('@/utils/got'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
module.exports = async (ctx) => { | ||
const { postid } = ctx.params; | ||
const pageUrl = `https://www.v2ex.com/t/${postid}`; | ||
|
||
const { data: topicResponse } = await got('https://www.v2ex.com/api/topics/show.json', { | ||
searchParams: { | ||
id: postid, | ||
}, | ||
}); | ||
|
||
const { data: replies } = await got('https://www.v2ex.com/api/replies/show.json', { | ||
searchParams: { | ||
topic_id: postid, | ||
}, | ||
}); | ||
|
||
const topic = topicResponse[0]; | ||
|
||
ctx.state.data = { | ||
title: `V2EX-${topic.title}`, | ||
link: pageUrl, | ||
description: topic.content, | ||
item: replies.map((item, index) => ({ | ||
title: `#${index + 1} ${item.content}`, | ||
description: item.content_rendered, | ||
link: `${pageUrl}#r_${item.id}`, | ||
author: item.member.username, | ||
pubDate: parseDate(item.created, 'X'), | ||
})), | ||
allowEmpty: true, | ||
}; | ||
}; |
Oops, something went wrong.