feat(route): add MyGoPen (#8484)
This commit is contained in:
parent
798aa9157f
commit
119b07a3e1
|
|
@ -661,6 +661,17 @@ IPFS 网关有可能失效,那时候换成其他网关。
|
|||
|
||||
<Route author="EsuRt queensferryme" example="/mittrchina/hot" path="/mittrchina/:type" :paramsDesc="['类型 type,可以是 index(首页资讯)或 hot(本周热榜)']"/>
|
||||
|
||||
## MyGoPen
|
||||
|
||||
### 分類
|
||||
|
||||
<Route author="nczitzk" example="/mygopen" path="/mygopen/:label?" :paramsDesc="['分類,见下表,默认为首页']">
|
||||
|
||||
| 謠言 | 詐騙 | 真實資訊 | 教學 |
|
||||
| ---- | ---- | -------- | ---- |
|
||||
|
||||
</Route>
|
||||
|
||||
## Nautilus
|
||||
|
||||
### 话题
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const label = ctx.params.label ?? '';
|
||||
|
||||
const rootUrl = 'https://www.mygopen.com';
|
||||
const currentUrl = `${rootUrl}${label ? `/search/label/${label}` : ''}`;
|
||||
const apiUrl = `${rootUrl}/feeds/posts/default${label ? `/-/${label}` : ''}?alt=json-in-script&max-results=${ctx.query.limit ? parseInt(ctx.query.limit) : 50}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
});
|
||||
|
||||
const items = JSON.parse(response.data.match(/gdata\.io\.handleScriptLoaded\((.*)\);/)[1]).feed.entry.map((item) => ({
|
||||
title: item.title.$t,
|
||||
description: item.content.$t,
|
||||
pubDate: parseDate(item.published.$t),
|
||||
link: item.link.pop().href,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `MyGoPen${label ? `: ${label}` : ''}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
description: '詐騙與謠言頻傳的年代,「MyGoPen|這是假消息」提醒網路使用者隨時要用謹慎懷疑的態度面對網路上的消息。',
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/:label?': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'mygopen.com': {
|
||||
_name: 'MyGoPen',
|
||||
'.': [
|
||||
{
|
||||
title: '分類',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#mygopen-fen-lei',
|
||||
source: ['/search/label/:label', '/'],
|
||||
target: '/mygopen/:label?',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/:label?', require('./index'));
|
||||
};
|
||||
Loading…
Reference in New Issue