Steam Web API: I'm not sure what to do with this hash looking url to generate an image with it

瘦欲@ 提交于 2019-12-11 11:14:09

问题


Using the Steam Web API I load my trade partners inventory which returns an array filled with objects like this:

{ id: '2063512233',
  classid: '520025252',
  instanceid: '0',
  amount: '1',
  pos: 2,
  appid: '730',
  icon_url: 'fWFc82js0fmoRAP-qOIPu5THSWqfSmTELLqcUywGkijVjZYMUrsm1j-9xgEObwgfEgznuShMhvflDOGJG68Didsh4K9W1jtmhA9yIPqKZHlhIgCQUvgKBKBoowq7CyJi7pZlV47jou0EeFrs4dGQYbEtOdsZSsTQRLbYMa0PH-14',
  icon_drag_url: '',
  name: 'Operation Breakout Weapon Case',
  market_hash_name: 'Operation Breakout Weapon Case',
  market_name: 'Operation Breakout Weapon Case',
  name_color: 'D2D2D2',
  background_color: '',
  type: 'Base Grade Container',
  tradable: 1,
  marketable: 1,
  commodity: 1,
  descriptions:
   [ { type: 'html', value: ' ' },
     { type: 'html', value: 'Container Series #18', color: '99ccff' },
     { type: 'html', value: ' ' },
     { type: 'html', value: 'Contains one of the following:' },
     { type: 'html', value: 'MP7 | Urban Hazard', color: '4b69ff' },
     { type: 'html', value: 'Negev | Desert-Strike', color: '4b69ff' },
     { type: 'html', value: 'P2000 | Ivory', color: '4b69ff' },
     { type: 'html', value: 'SSG 08 | Abyss', color: '4b69ff' },
     { type: 'html', value: 'UMP-45 | Labyrinth', color: '4b69ff' },
     { type: 'html', value: 'PP-Bizon | Osiris', color: '8847ff' },
     { type: 'html', value: 'CZ75-Auto | Tigris', color: '8847ff' },
     { type: 'html', value: 'Nova | Koi', color: '8847ff' },
     { type: 'html', value: 'P250 | Supernova', color: '8847ff' },
     { type: 'html',
       value: 'Desert Eagle | Conspiracy',
       color: 'd32ce6' },
     { type: 'html',
       value: 'Five-SeveN | Fowl Play',
       color: 'd32ce6' },
     { type: 'html',
       value: 'Glock-18 | Water Elemental',
       color: 'd32ce6' },
     { type: 'html', value: 'P90 | Asiimov', color: 'eb4b4b' },
     { type: 'html', value: 'M4A1-S | Cyrex', color: 'eb4b4b' },
     { type: 'html',
       value: 'or an Exceedingly Rare Butterfly Knife!',
       color: 'ffd700' },
     { type: 'html', value: ' ' },
     { type: 'html', value: '', color: '00a000', app_data: [Object] } ],
  tags:
   [ { internal_name: 'CSGO_Type_WeaponCase',
       name: 'Container',
       category: 'Type',
       category_name: 'Type' },
     { internal_name: 'set_community_4',
       name: 'The Breakout Collection',
       category: 'ItemSet',
       category_name: 'Collection' },
     { internal_name: 'normal',
       name: 'Normal',
       category: 'Quality',
       category_name: 'Category' },
     { internal_name: 'Rarity_Common',
       name: 'Base Grade',
       category: 'Rarity',
       color: 'b0c3d9',
       category_name: 'Quality' } ],
  contextid: 2 
}

Which is fine and works great, my only problem is when I want to render the icon of the item on the site, I'm not sure what kind of prefix to link to the icon_url. After reading through the Web API a few more times I can't really find anything on what the full URL is supposed to look like. If anybody can help that'd be grrrreeaatt. Thanks!


回答1:


Put http://cdn.steamcommunity.com/economy/image/ in front of it.

Source: google



来源:https://stackoverflow.com/questions/29523210/steam-web-api-im-not-sure-what-to-do-with-this-hash-looking-url-to-generate-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!