chore(route): Remove steam news (#7764)

This commit is contained in:
MisteryMonster
2021-06-26 17:08:56 -07:00
committed by GitHub
parent 560a173956
commit 87980a9e5b
5 changed files with 11 additions and 65 deletions
-6
View File
@@ -1144,12 +1144,6 @@
source: '/search/',
target: (params, url) => `/steam/search/${new URL(url).searchParams}`,
},
{
title: 'news',
docs: 'https://docs.rsshub.app/game.html#steam',
source: '/news/',
target: (params, url) => `/steam/news/${new URL(url).searchParams.get('appids')}`,
},
],
},
'baijingapp.com': {
+3 -7
View File
@@ -172,17 +172,13 @@ For instance, in `https://store.steampowered.com/search/?specials=1&term=atelier
### Steam news
<RouteEn author="maple3142" example="/steam/news/282800" path="/steam/news/:appids" :paramsDesc="['game id']" radar="1" rssbud="1"/>
::: tip
Steam provides some official RSS feeds:
- Game News: https://store.steampowered.com/feeds/news/app/412830/
- Curator/Group/Publisher/Developer News: https://store.steampowered.com/feeds/news/group/35143931/
Game News use the AppID while the rest are only available in the Steam News UI, it seems.
- News home page: [https://store.steampowered.com/feeds/news/?l=english](https://store.steampowered.com/feeds/news/?l=english) the parameter `l=english` specifiy the language.
- Game news rss can get from the rss buttom in page like this: [https://store.steampowered.com/news/app/648800/](https://store.steampowered.com/news/app/648800/) , rss link will looks like: [https://store.steampowered.com/feeds/news/app/648800/?cc=US&l=english](https://store.steampowered.com/feeds/news/app/648800/?cc=US&l=english)
- Steam group can add `/rss` behind Steam community URL to subscribe: [https://steamcommunity.com/groups/SteamLabs/rss](https://steamcommunity.com/groups/SteamLabs/rss) or add the `/feeds` in Steam News : [https://store.steampowered.com/feeds/news/group/35143931/](https://store.steampowered.com/feeds/news/group/35143931/)
:::
+8 -6
View File
@@ -342,15 +342,17 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
</Route>
### Steam news
### Steam 新闻中心
<Route author="maple3142" example="/steam/news/1091500/schinese" path="/steam/news/:appid/:language?" :paramsDesc="['游戏 id', '语言,默认简体中文']" radar="1" rssbud="1">
::: tip
| 语言 (Language) | 简体中文 (Simplified Chinese) | 繁體中文 (Traditional Chinese) | 日本語 (Japanese) | 한국어 (Korean) | Български (Bulgarian) | Čeština (Czech) | Dansk (Danish) | Deutsch (German) | Español - España (Spanish - Spain) | Español - Latinoamérica (Spanish - Latin America), | Ελληνικά (Greek) | Français (French) | Italiano (Italian) | Magyar (Hungarian) | Nederlands (Dutch) | Norsk (Norwegian) | Polski (Polish) | Português (Portuguese) | Português - Brasil (Portuguese - Brazil) | Română (Romanian) | Русский (Russian) | Suomi (Finnish) | Svenska (Swedish) | Türkçe (Turkish) | Tiếng Việt (Vietnamese) | Українська (Ukrainian) |
| --------------- | ----------------------------- | ------------------------------ | ----------------- | --------------- | --------------------- | --------------- | -------------- | ---------------- | ---------------------------------- | -------------------------------------------------- | ---------------- | ----------------- | ------------------ | ------------------ | ------------------ | ----------------- | --------------- | ---------------------- | ---------------------------------------- | ----------------- | ----------------- | --------------- | ----------------- | ---------------- | ----------------------- | ---------------------- |
| | schinese | tchinese | japanese | koreana | bulgarian | czech | danish | german | spanish | latam | greek | french | italian | hungarian | dutch | norwegian | polish | portuguese | brazilian | romanian | russian | finnish | swedish | turkish | vietnamese | ukrainian |
Steam 新闻中心支持官方的 RSS 订阅:
</Route>
- 新闻中心首页订阅地址为:[https://store.steampowered.com/feeds/news/?l=schinese](https://store.steampowered.com/feeds/news/?l=schinese) 其中参数 `l=english` 指定语言,`l=schinese` 为简体中文。
- Steam 游戏新闻可以在该游戏的 RSS 按钮订阅: [https://store.steampowered.com/news/app/648800/](https://store.steampowered.com/news/app/648800/) ,获取的订阅链接类似为: [https://store.steampowered.com/feeds/news/app/648800/?cc=US&l=english](https://store.steampowered.com/feeds/news/app/648800/?cc=US&l=english)
- STEAM 组可以在 Steam 社区链接尾部添加 `/rss` 订阅: [https://steamcommunity.com/groups/SteamLabs/rss](https://steamcommunity.com/groups/SteamLabs/rss) 或者在 Steam 新闻中心的 URL 里添加 `/feeds` 订阅 [https://store.steampowered.com/feeds/news/group/35143931/](https://store.steampowered.com/feeds/news/group/35143931/)
:::
## SteamGifts
-1
View File
@@ -1242,7 +1242,6 @@ router.get('/huxiu/collection/:id', require('./routes/huxiu/collection'));
// Steam
router.get('/steam/search/:params', require('./routes/steam/search'));
router.get('/steam/news/:appid/:language?', require('./routes/steam/news'));
// Steamgifts
router.get('/steamgifts/discussions/:category?', require('./routes/steam/steamgifts/discussions'));
-45
View File
@@ -1,45 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const { appid, language = 'schinese' } = ctx.params;
const response = await got.get(`https://store.steampowered.com/news/app/${appid}`, {
headers: {
cookie: `Steam_Language=${language}`,
},
});
const $ = cheerio.load(response.data);
const { events } = JSON.parse($('#application_config').attr('data-initialevents'));
const item = events.map((event) => {
event.announcement_body.body = event.announcement_body.body
.replace(/\[img]\{STEAM_CLAN_IMAGE}/g, '<img noopener noreferer style="max-width:100%;" src="https://cdn.cloudflare.steamstatic.com/steamcommunity/public/images/clans')
.replace(/\[\/img]/g, '"/>')
.replace(/\[h1]/g, '<h1>')
.replace(/\[\/h1]/g, '</h1>')
.replace(/\[h2]/g, '<h2>')
.replace(/\[\/h2]/g, '</h2>')
.replace(/\[b]/g, '<b>')
.replace(/\[\/b]/g, '</b>')
.replace(/\[i]/g, '<i>')
.replace(/\[\/i]/g, '</i>')
.replace(/\[url=\s?(http.*?)]/g, '<a href="$1">')
.replace(/\[\/url]/g, '</a>')
.replace(/\[list]/g, '<ul>')
.replace(/\[\/list]/g, '</ul>')
.replace(/\[\*]/g, '<li>');
return {
title: event.event_name,
link: `https://store.steampowered.com/news/app/${appid}/view/${event.gid}`,
pubDate: new Date(event.announcement_body.posttime * 1000),
description: event.announcement_body.body,
};
});
ctx.state.data = {
title: $('head title').text(),
link: `https://store.steampowered.com/news/app/${appid}`,
item,
};
};