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.
feat: add nintendo china (DIYgod#4135)
- Loading branch information
1 parent
ffda263
commit 667c3d4
Showing
5 changed files
with
236 additions
and
2 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 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,51 @@ | ||
const got = require('@/utils/got'); | ||
const util = require('./utils'); | ||
const software_url = 'https://www.nintendoswitch.com.cn/software/'; | ||
|
||
module.exports = async (ctx) => { | ||
const response = await got({ | ||
method: 'get', | ||
url: software_url, | ||
}); | ||
|
||
// 获取Nuxt对象 | ||
const result = await util.nuxtReader(response.data); | ||
|
||
/* expectedReleaseNS[] | ||
coverImageUrl: "//switch-cn.gtgres.com/global-images/c50e3390-14e5-11ea-9b40-236e671bca9e.png" | ||
expectedReleaseDate: 0 | ||
expectedReleaseDateFuzzy: "" | ||
gameName: "Mario Tennis Aces" | ||
id: 1852 | ||
newsPageUrl: "" | ||
softwareData[] | ||
gameProductCode: "HAC-P-ADALB" | ||
image: "//switch-cn.gtgres.com/global-images/c247f0e0-1654-11ea-9b40-236e671bca9e.png" | ||
name: "新 超级马力欧兄弟U 豪华版" | ||
nsUid: "70010000027088" | ||
publisher: "任天堂" | ||
releaseDatetime: 1575907200000 | ||
softcardType: (2)[] | ||
*/ | ||
if (!result.softwareData) { | ||
throw new Error('软件信息不存在,请报告这个问题'); | ||
} | ||
|
||
let data = result.softwareData.map((item) => ({ | ||
title: item.name, | ||
author: item.publisher, | ||
description: util.generateImageLink(`https${item.image}`), | ||
category: item.softcardType, | ||
link: `${software_url}${item.nsUid}`, | ||
pubDate: new Date(parseInt(item.releaseTime)).toUTCString(), | ||
})); | ||
|
||
data = await util.ProcessItemChina(data, ctx.cache); | ||
|
||
ctx.state.data = { | ||
title: `Nintendo eShop (国服) 新游戏`, | ||
link: `https://www.nintendo.com.hk/topics`, | ||
description: `Nintendo (国服) 新上架的游戏`, | ||
item: data, | ||
}; | ||
}; |
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,41 @@ | ||
const got = require('@/utils/got'); | ||
const util = require('./utils'); | ||
const news_url = 'https://www.nintendoswitch.com.cn/topics/'; | ||
|
||
module.exports = async (ctx) => { | ||
const response = await got({ | ||
method: 'get', | ||
url: news_url, | ||
}); | ||
|
||
// 获取Nuxt对象 | ||
const result = await util.nuxtReader(response.data); | ||
|
||
/* newsData[] | ||
category: "Nintendo Switch" | ||
id: "7341a73c-b4f8-4fa2-ae26-33c670743293" | ||
imgUrl: "//switch-cn.gtgres.com/global-images/05b83870-31cc-11ea-8066-7beee849b0db.png" | ||
releaseTime: 1578456319000 | ||
title: "《新 超级马力欧兄弟U 豪华版》1月15日实体游戏卡带发售" | ||
*/ | ||
if (!result.newsData) { | ||
throw new Error('新闻信息不存在,请报告这个问题'); | ||
} | ||
|
||
let data = result.newsData.map((item) => ({ | ||
title: item.title, | ||
description: util.generateImageLink(`https${item.imgUrl}`), | ||
category: item.category, | ||
link: `${news_url}${item.id}`, | ||
pubDate: new Date(parseInt(item.releaseTime)).toUTCString(), | ||
})); | ||
|
||
data = await util.ProcessNewsChina(data, ctx.cache); | ||
|
||
ctx.state.data = { | ||
title: `Nintendo (中国大陆) 主页资讯`, | ||
link: `https://www.nintendo.com.hk/topics`, | ||
description: `Nintendo 中国大陆官网刊登的资讯`, | ||
item: data, | ||
}; | ||
}; |
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