@@ -488,22 +488,34 @@ async function fetchFloatData(inspectLink) {
488488}
489489
490490/**
491- * Build working Steam CDN image URL from defindex and paintindex
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)
493+ * @param {number } defindex - Weapon definition index
494+ * @param {number } paintindex - Paint/skin index
495+ * @returns {Array<string> } Array of image URLs to try in order
492496 */
493- function buildImageUrl ( defindex , paintindex , assetid ) {
494- // Build multiple URL options (in priority order)
497+ function buildImageUrl ( oldImageUrl , defindex , paintindex ) {
495498 const urls = [ ] ;
496499
497- // Option 1: Modern Steam Community CDN (most reliable)
498- if ( assetid ) {
499- urls . push ( `https://community.akamai.steamstatic.com/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpou-6kejhz2v_Nfz5H_uO1gb-Gw_alDLPIhm5D18d0i_r--Y3nj1H6qUc-fWD0Z9fNdw%20${ assetid } ` ) ;
500+ // Option 1: Transform old API URL to modern CDN domains
501+ if ( oldImageUrl ) {
502+ // Extract path after domain
503+ // Old: https://steamcdn-a.akamaihd.net/apps/730/icons/econ/...
504+ // New: https://community.akamai.steamstatic.com/apps/730/icons/econ/...
505+ const urlMatch = oldImageUrl . match ( / h t t p s ? : \/ \/ [ ^ \/ ] + \/ ( .* ) / ) ;
506+ if ( urlMatch ) {
507+ const path = urlMatch [ 1 ] ;
508+
509+ // Try multiple modern CDN endpoints
510+ urls . push ( `https://community.akamai.steamstatic.com/${ path } ` ) ;
511+ urls . push ( `https://community.cloudflare.steamstatic.com/${ path } ` ) ;
512+ urls . push ( `https://steamcommunity-a.akamaihd.net/${ path } ` ) ;
513+ }
500514 }
501515
502- // Option 2: Static Steam Community image endpoint
503- urls . push ( `https://community.cloudflare.steamstatic.com/economy/image/class/730/${ defindex } _${ paintindex } ` ) ;
504-
505- // Option 3: Fallback to generic weapon image
506- urls . push ( `https://steamcdn-a.akamaihd.net/apps/730/icons/econ/weapons/base_weapons/weapon_${ getWeaponCodename ( defindex ) } .png` ) ;
516+ // Option 2: Fallback to generic weapon image (last resort)
517+ const weaponCodename = getWeaponCodename ( defindex ) ;
518+ urls . push ( `https://community.akamai.steamstatic.com/economy/image/fWFc82js0fmoRAP-qOIPu5THSWqfSmTELLqcUywGkijVjZYMUrsm1j-9xgEObwgfEh_nvjlWhNzZCveCDfIBj98xqodQ2CZknz5-OOqhNQhvKzvCEKJKV8o14YTbTyYh_ZFXBq9hpj5T-7TjpOCPJ7klTtFMGpjUDKeAYgCp40hog6RaKUKKqy3qiSy6azqEDEi5q2wChKfMm_dHag/330fx248f` ) ;
507519
508520 return urls ;
509521}
@@ -558,8 +570,8 @@ async function processFloatRequest(inspectLink, precision = 4) {
558570 // Get fade percentage for fade knives
559571 const fadePercentage = getFadePercentage ( rawData . weapon_type , rawData . item_name , rawData . paintseed , rawData . full_item_name ) ;
560572
561- // Build working image URLs (API returns old CDN that 404s)
562- const imageUrls = buildImageUrl ( rawData . defindex , rawData . paintindex , rawData . a ) ;
573+ // Build working image URLs (API returns old CDN that 404s - transform to modern CDNs )
574+ const imageUrls = buildImageUrl ( rawData . imageurl , rawData . defindex , rawData . paintindex ) ;
563575
564576 // Create enhanced data using CSGOFloat API fields
565577 const enhancedData = {
0 commit comments