Jump to content
McKay Development

Getting item name & image from inspect link data


SnaBe

Recommended Posts

Below is a set of data that I got from using the inspectItem() method from node-globaloffensive.

{
    "stickers": [],
    "accountid": null,
    "itemid": "17981383956",
    "defindex": 5035,
    "paintindex": 10059,
    "rarity": 6,
    "quality": 3,
    "paintwear": 0.19330522418022156,
    "paintseed": 904,
    "killeaterscoretype": null,
    "killeatervalue": null,
    "customname": null,
    "inventory": 3221225475,
    "origin": 8,
    "questid": null,
    "dropreason": null,
    "musicindex": null
}

Now I'm wondering, how do I get the item name & image? Is there some library or middleware I can use?

I assume that defindex & paintseed are used to identify the unique item. But how exactly?

I would like to get the item name and generate an image that represents the item data above.

I hope that someone can help!

Best regards, SnaBe.

 

 

Link to comment
Share on other sites

There isn't really a way to do that. You'd need to retrieve the user's inventory from Steam and get the name and image that way.

Well, you could download the item schema and work out the item's name at least, but getting the image is entirely impractical. You'd need to reimplement the entire algorithm used by the game client to render items, which I promise you, you don't want to do.

Link to comment
Share on other sites

First of all, thank you for the great answer!

Alright, so all I really need is to extract the owner's steamid from the inspect link.

const groups = /^steam:\/\/rungame\/730\/\d+\/[+ ]csgo_econ_action_preview[%20 ]*?([SM])(\d+)A(\d+)D(\d+)$/.exec(inspectLink); 

Using the regex above I can get the item's owner and assetid, along with two other values I have no idea what are used for.

[ 'steam://rungame/730/76561202255233023/+csgo_econ_action_preview S76561198964582249A17986946021D14442516311341693499',
  'S',
  '76561198964582249',
  '17986946021',
  '14442516311341693499',
  index: 0,
  input: 'steam://rungame/730/76561202255233023/+csgo_econ_action_preview S76561198964582249A17986946021D14442516311341693499',
  groups: undefined ]

The owner's steamid is right after the 'S' and the item's assetid is the one after that.  (In the inspect link they are seperated by S, A and D)

Now that I've the SteamID I can retrieve the user's inventory from Steam and filter the inventory for an assetid match.

But is there a smarter way to extract the steamid from an inspect link alone? And what is 'D14442516311341693499' & index used for? Are they just part of the inspect link in some way?

 

Best regards, SnaBe.

Link to comment
Share on other sites

The "D" value seems to be just some key used by the GC to make sure that people can't just guess at values to get item data. I've yet to find any way to extract any meaning out of it, only that it's required to retrieve the item's data.

The index property is just the position of the first character in your string where the regex matched. Since you're regexing the entire inspect link, that's 0, or the very first character.

Do note that if an item is listed on the market, then the "M" value is the market listing ID and not the owner's SteamID. And I guess you've figured out by now that the SteamID in the link (76561202255233023) is meaningless.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...