Skip to content

Support the new market page in getMarketItem (fixes #373) - #374

Open
tarikermis wants to merge 1 commit into
DoctorMcKay:masterfrom
tarikermis:fix-new-market-getmarketitem
Open

Support the new market page in getMarketItem (fixes #373)#374
tarikermis wants to merge 1 commit into
DoctorMcKay:masterfrom
tarikermis:fix-new-market-getmarketitem

Conversation

@tarikermis

@tarikermis tarikermis commented Aug 9, 2026

Copy link
Copy Markdown

Fixes #373

Steam's new Community Market page is server-side rendered and no longer contains the markup CMarketItem used to scrape. The old /render/ endpoint now redirects to HTML and item_nameid is gone, so getMarketItem() fails with Error undefined.

This builds on the approach @ianw11 posted in the issue: parse the JSON embedded in the new page while leaving the legacy paths unchanged.

What changed

  • Detect SSR.loaderData and read the country, language, commodity flag, and embedded order book.
  • Preserve the existing field shapes for commodity and non-commodity items.
  • Use the item's min_price for non-fallback items on grouped market pages.
  • Keep the existing no-listings error for invalid items.
  • Disable response compression for this request because Steam only includes the JSON in uncompressed responses. With an Accept-Encoding header, it consistently returns a lightweight shell instead.

Verification

Checked live anonymous requests for:

  • a commodity item;
  • a single-bucket non-commodity item;
  • grouped fallback and non-fallback items;
  • an invalid item.

The returned prices and quantities matched the embedded data. A synthetic old-format page still uses the legacy histogram path and preserves its existing fields. The repository has no configured test suite or linter, so I also ran node --check.

Limits

  • On the new page, Steam chooses the embedded currency from the request context; I could not make the currency argument affect an anonymous request.
  • Grouped non-fallback items do not expose a per-item listing count, so quantity remains 0.
  • Price history and asset data are not mapped yet.
  • Logged-in and market-restricted sessions were not available for testing.

Thanks to @ianw11 for the initial direction and co-authored patch.

Best Regards, Tarik

Steam's new Community Market page is server-side rendered and no longer
contains the markup CMarketItem scraped (g_strCountryCode,
Market_LoadOrderSpread, g_rgAssets, market_listing_table_message), so
getMarketItem() failed for every item.

Read the JSON the new page embeds instead: country/language and
bCommodity from SSR.loaderData, and the order book from the embedded
query data in SSR.renderContext. Group pages only embed an order book
for the group's fallback item, so for other group items the lowest
price is read from the item's bucket min_price. The page only embeds
its data when the request doesn't accept compressed responses, so the
listing request now sends no Accept-Encoding.

Legacy code paths are unchanged and still used when the old page
structure is served.

Co-authored-by: Ian Washburne <ianw11@gmail.com>
@ianw11

ianw11 commented Aug 27, 2026

Copy link
Copy Markdown

Is this waiting on anything to get merged?

@tarikermis

Copy link
Copy Markdown
Author

Not that I know of - just waiting on DoctorMcKay to review. Best Regards, Tarik

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

Successfully merging this pull request may close these issues.

New Steam Marketplace causes getMarketItem() to fail

2 participants