1.0.23 • Published 9 months ago
hexo-steam-plugin v1.0.23
本项目魔改于hexo-steam-games
hexo-steam-plugin
介绍
为Hexo添加Steam游戏库页面.
安装
npm i hexo-steam-plugin
配置
将下面的配置写入站点的配置文件 _config.yml
里(不是主题的配置文件).
steam:
enable: true
steamId: 'xxx' #steam 64位Id
apiKey: 'xxx' #steam api key
steamInfos:
freeGames: true
path: 'games/index.html'
title: 游戏
quote: '欢迎光临小站游戏'
tab: recent
length: 1000
imgUrl:
proxy:
host:
port:
extra_options:
top_img: https://unpkg.com/private-source/absinthe-blog/images/page-bgi/games.jpeg
- enable: 是否启用
- apiKey: Steam 网页 API Key(新版需要API Key才能获取到游戏信息,点此注册 API Key),或者手动获取游戏库数据
- steamId: steam 64位Id(需要放在引号里面,不然会有BUG), 需要将steam库设置为公开!
- steamInfos: 多账号配置
- path: 游戏页面路径,默认
steamgames/index.html
- title: 该页面的标题
- quote: 写在页面开头的一段话,支持html语法
- tab:
all
或recent
,all: 所有游戏
,recent: 最近游玩的游戏
- length: 要显示游戏的数量,游戏太多的话可以限制一下
- imgUrl: 图片链接,在
quote
下面放一张图片,图片链接到Steam个人资料,可留空 - proxy: 如果无法访问steam社区的话请使用代理
- host: 代理ip或域名
- port: 代理端口
- extra_options: 此配置会扩展到Hexo的
page
变量中
使用
- 在
hexo generate
或hexo deploy
之前使用hexo steam -u
命令更新steam游戏库数据! - 删除游戏库数据指令:
hexo steam -d
手动获取游戏库数据
如果hexo steam -u
命令一直获取游戏库数据失败,可以用一下方法手动获取游戏库数据:
- 浏览器打开
https://steamcommunity.com/profiles/{steamId}/games?tab={tab}
,{steamId}
和{tab}
分别替换为上面配置中提到的steamId
和tab
网页加载完成后,打开浏览器控制台(按
F12
),输入以下代码并回车:const data = document.querySelector('#gameslist_config').getAttribute('data-profile-gameslist'); const games = JSON.parse(data.replace(/\n/g, '')).rgGames; document.write(JSON.stringify(games).replace(/\n/g, ''));
将生成的内容复制到
博客根目录/source/_data/steamID.json
文件内,如果没有对应的文件或目录,请自行创建
1.0.19
9 months ago
1.0.18
9 months ago
1.0.22
9 months ago
1.0.21
9 months ago
1.0.20
9 months ago
1.0.23
9 months ago
1.0.17
10 months ago
1.0.16
10 months ago
1.0.15
10 months ago
1.0.14
10 months ago
1.0.13
10 months ago
1.0.12
10 months ago
1.0.11
10 months ago
1.0.10
10 months ago
1.0.9
10 months ago
1.0.8
10 months ago
1.0.7
10 months ago
1.0.6
10 months ago
1.0.5
10 months ago
1.0.4
10 months ago
1.0.3
10 months ago
1.0.2
10 months ago
1.0.1
10 months ago
1.0.0
10 months ago