Skip to content

Commit b955258

Browse files
rainerstudiosclaude
andcommitted
Use Steam economy API for images instead of transforming URLs
- Changed to: /economy/image/class/730/{defindex}/{paintindex} - This is the proper Steam CDN endpoint that works reliably - Old "default_generated" URLs only exist on deprecated CDN - Fixes 404 errors by using correct API format 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cacdac4 commit b955258

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

background.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -488,28 +488,19 @@ async function fetchFloatData(inspectLink) {
488488
}
489489

490490
/**
491-
* Build working Steam CDN image URL by transforming old API URLs
492-
* @param {string} oldImageUrl - Old imageurl from API (steamcdn-a.akamaihd.net format)
491+
* Build working Steam CDN image URL using item metadata
492+
* @param {string} oldImageUrl - Old imageurl from API (not used, kept for compatibility)
493493
* @param {number} defindex - Weapon definition index
494494
* @param {number} paintindex - Paint/skin index
495495
* @returns {Array<string>} Array of image URLs to try in order
496496
*/
497497
function buildImageUrl(oldImageUrl, defindex, paintindex) {
498498
const urls = [];
499499

500-
// Option 1: Transform old API URL to modern CDN domains
501-
if (oldImageUrl) {
502-
const urlMatch = oldImageUrl.match(/https?:\/\/[^\/]+\/(.*)/);
503-
if (urlMatch) {
504-
const path = urlMatch[1];
505-
506-
// Try modern CDN endpoints in priority order
507-
urls.push(`https://community.cloudflare.steamstatic.com/${path}`);
508-
urls.push(`https://steamcommunity-a.akamaihd.net/${path}`);
509-
510-
// Also try the old URL as-is (might still work)
511-
urls.push(oldImageUrl);
512-
}
500+
// Option 1: Use Steam's economy/image API with defindex/paintindex (most reliable)
501+
if (defindex && paintindex) {
502+
urls.push(`https://community.akamai.steamstatic.com/economy/image/class/730/${defindex}/${paintindex}`);
503+
urls.push(`https://community.cloudflare.steamstatic.com/economy/image/class/730/${defindex}/${paintindex}`);
513504
}
514505

515506
// Option 2: Generic CS2 placeholder (always works as fallback)

0 commit comments

Comments
 (0)