如何通过Steam游戏获取图片的哈希值? [英] How do I get a hash for a picture form a Steam Game?

查看:273
本文介绍了如何通过Steam游戏获取图片的哈希值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Steam Web API从Steam游戏中获取图像/徽标/图标,但该API的问题在于,他们要求在网址中输入哈希值.我在哪里可以得到哈希值?

I want to get a image/logo/icon from steam games with the steam web api, but the problem with the api is, they ask for a hash in the url. Where can I get the hash?

Steam API链接: http://media.steampowered.com/steamcommunity/public/images/apps/ {appid}/{hash} .jpg

Steam api link: http://media.steampowered.com/steamcommunity/public/images/apps/{appid}/{hash}.jpg

示例: http://media.steampowered.com/steamcommunity/public/images/apps/440/07385eb55b5ba974aebbe74d3c99626bda7920b8.jpg

推荐答案

大多数官方API端点,例如记录在

Most of their official API endpoints, such as GetOwnedGames documented here , to get owned games for an user, return application details when setting the include_appinfo query parameter.

然后返回的详细信息包括您要查找的哈希,例如游戏对象中的img_icon_urlimg_logo_url.

The returned details then include the hashes you were looking for, as img_icon_url and img_logo_url in a game's object.

如他们的文档中所述,

这些是游戏中各种图像的文件名.要构造图像的URL,请使用以下格式:

these are the filenames of various images for the game. To construct the URL to the image, use this format:

http://media.steampowered.com/steamcommunity/public/images/apps/ {appid}/{hash} .jpg

http://media.steampowered.com/steamcommunity/public/images/apps/{appid}/{hash}.jpg

这是请求http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=YOUR_API_KEY&steamid=YOUR_STEAM_ID&include_appinfo=true&format=json

以及这个请求的游戏结果键.

And a game's result key from this very request.

         {
            "appid": 400,
            "name": "Portal",
            ...
            "img_icon_url": "cfa928ab4119dd137e50d728e8fe703e4e970aff",
            "img_logo_url": "4184d4c0d915bd3a45210667f7b25361352acd8f",
            ...
        },

因此,对于门户徽标,生成的URL为 http://media.steampowered.com/steamcommunity/public/images/apps/400/4184d4c0d915bd3a45210667f7b25361352acd8f.jpg

So, for the portal logo the resulting URL would be http://media.steampowered.com/steamcommunity/public/images/apps/400/4184d4c0d915bd3a45210667f7b25361352acd8f.jpg

这篇关于如何通过Steam游戏获取图片的哈希值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆