Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to check StatTrak items. #10

Open
DevItsMB opened this issue Mar 9, 2021 · 2 comments
Open

Not able to check StatTrak items. #10

DevItsMB opened this issue Mar 9, 2021 · 2 comments

Comments

@DevItsMB
Copy link

DevItsMB commented Mar 9, 2021

I tried to check StatTrak CSGO items with my command but that isnt working, however all other items work just fine, maybe it has something to do with the TM behind the StatTrak.
Anyone got it working for these kind of items?

~ DevItsMB :).

@nekiro
Copy link

nekiro commented Jan 14, 2022

Bit late, but...
Yeah, seems like ™ is wrongly encoded into the path (when using query of got), which results in wrongly formatted url, so steam doesn't know what you are asking for.

I was actually curious why it doesn't work, tested a bit and wrote method that properly returns the values for StatTrak items.

/**
 * Retrieve price for single item.
 *
 * @param {number} appid - Steam application id
 * @param {String} name - Item name, market hashed
 * @param {number} [currency=1] - Currency code number, default USD (https://github.com/SteamRE/SteamKit/blob/master/Resources/SteamLanguage/enums.steamd#L696)
 */
async function getItemPrice(appid, name, currency = 1) {
  const response = await got(
    encodeURI(
      `http://steamcommunity.com/market/priceoverview?appid=${appid}&currency=${currency}&market_hash_name=${name}`
    ),
    {
      json: true,
    }
  );

  return { ...response.body, market_hash_name: name };
}

output:

{
  success: true,
  lowest_price: '$6.87',
  volume: '12',
  median_price: '$5.20',
  market_hash_name: 'StatTrak™ MAC-10 | Heat (Minimal Wear)'
}

Usage is exactly the same.

@DevItsMB
Copy link
Author

Alright, thanks for the quick response 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants