How can I see the gem value of an item that I do not own?

A simple search in google would direct you to the "Gems by Game" section of the Steam Trading Card Wiki.

You can both find the value of the cards theirselves and the craftable items (Emoticons, Backgrounds). Additionally the needed amount of gems to craft a booster pack is also displayed.

Keep in mind, that the entries in the wikis aren't displayed dynamically, means that some values might be not up to date. Furthermore I assume that there are many games missing, but the list is very long though.

Very interesting is following, what I copied & pasted from the source above:

Assuming that n = # cards in set, c = value of single card, g = value of emoticon/background, and b = gems to craft booster, any one of the four can be calculated if any two other values are known. This doesn't hold true for every game, but is accurate for the vast majority:

n = 6000/b

n = 2g/c

c = bg/3000

c = 2g/n

g = 3000c/b

g = n * c/2

b = 6000/n

b = g/3000c


tl;dr

Here's a bookmarklet that you can run on the Community Market page for an item to get its gem value:

javascript:var a=g_rgAssets[Object.keys(g_rgAssets)[0]],b=a[Object.keys(a)[0]],c=b[Object.keys(b)[0]],gem_action=c.owner_actions&&c.owner_actions.filter(function(d){return/javascript:GetGooValue/.test(d.link)})[0];if(gem_action){var matches=gem_action.link.match(/javascript:GetGooValue\( '%contextid%', '%assetid%', (\d+), (\d+), \d+ \)/);fetch("https://steamcommunity.com/auction/ajaxgetgoovalueforitemtype/?appid="+matches[1]+"&item_type="+matches[2]+"&border_color=0").then(function(d){return d.json()}).then(function(d){alert("This is worth "+d.goo_value+" gems")})["catch"](function(d){return console.error(d)})}else alert("This is worth 0 gems");

When you're on the Community Market page for an item, paste this into the URL bar (you might have to retype the javascript: portion). You can also save it as a bookmark, which you can just click on to run.


Explanation

As noted by Wok, you can get the number of gems an item is worth by passing the appropriate appid and item_type to this endpoint:

https://steamcommunity.com/auction/ajaxgetgoovalueforitemtype/?appid=219890&item_type=16

which in this example corresponds to my favorite profile background from the game Antichamber and returns this response:

{"success":1,"goo_value":"80"}

But as noted by Wok and an answer to a similar question, item_type isn't exactly predictable and depends on the game and the relative amounts of item types that they have.

How does the Steam inventory webpage figure out what item_type is?

It's pretty gross.

When you load your inventory, the webpage makes a few requests (one for each context in that inventory) to get a list of inventory items. These JSON responses contain the item_type for each item, but in the worst format possible.

Each inventory object in the descriptions array of the JSON response contains an owner_actions array, where each object has a link and a name. item_type is stored in that link.

Sticking to the Antichamber profile background example, here's the link with its item_type:

"owner_actions":
[
  {
    "link": "javascript:GetGooValue( '%contextid%', '%assetid%', 219890, 16, 0 )",
    "name": "Turn into Gems..."
  }
]

The click events on the Steam inventory page parse out that JavaScript URL to figure out what event handler to run. The function GetGooValue() doesn't actually exist.

In case you didn't see it, the third argument to this nonexistent function provides appid and the fourth argument provides item_type.

vomits

What about items not in your inventory?

The previous web requests depend on a user's inventory, which isn't helpful if you want to find the gem value of some arbitrary item.

However, Community Market pages have a global variable called g_rgAssets. Here's a truncated sample for our example:

{
  "753":
  {
    "6":
    {
      "6298989828":
      {
        ... [truncated]
        "owner_actions":
        [
          {
            "link": "javascript:GetGooValue( '%contextid%', '%assetid%', 219890, 16, 0 )",
            "name": "Turn into Gems..."
          }
        ],
        ... [truncated]

So there's a sole child called the inventory ID, which itself has a sole child corresponding to the context ID. That in turn has a sole child called something (I don't know what it corresponds to), and inside of that is the same owner_actions we saw earlier (among other things).

From there it's pretty easy to find that link, parse out the appid and item_type, and make the web request to find the gem value of that item.

Something to watch out for: you can't just select the link of the first object in owner_actions:

  • There can be more than one action in there, such as the "View badge progress" action for trading cards.
  • The "Turn into Gems..." action doesn't show up on items that don't have gem values.
  • Sometimes g_rgAssets doesn't have owner_actions at all.

The bookmarklet above has some rudimentary handling for these cases.


  1. Find the appID of the game, e.g. 239350 for Spelunky.

appID

  1. Check the gem amount corresponding to a normal card (item_type=2) at:

https://steamcommunity.com/auction/ajaxgetgoovalueforitemtype/?appid=239350&item_type=2

normal card

  1. Check the gem amount corresponding to a foil card (item_type=2, border_color=1) at:

https://steamcommunity.com/auction/ajaxgetgoovalueforitemtype/?appid=239350&item_type=2&border_color=1

foil card

  1. Check the gem amount corresponding to an emoticon (item_type=10) at:

https://steamcommunity.com/auction/ajaxgetgoovalueforitemtype/?appid=239350&item_type=10

emoticon

  1. Check the gem amount corresponding to a profile background (item_type=17) at:

https://steamcommunity.com/auction/ajaxgetgoovalueforitemtype/?appid=239350&item_type=17

profile background

Caveat: item_type numbering can differ from one game to another:

  • the index of the first card is always 2,
  • the index of the first emoticon can change depending on the number of cards,
  • the index of the first profile background can change depending on the number of cards, the number of emoticons, and the existence of gaps in the numbering for unknown reasons.

So, adjust accordingly and check the other values if you have any doubt.