""" main.py — Steam CS2 Inventory Scraper Usage: python main.py python main.py https://steamcommunity.com/profiles//inventory/ """ import sys from fetcher import fetch_inventory_from_site, convert_to_steamdt_url from parser import extract_and_enrich_items from reporter import print_inventory_summary # ══════════════════════════════════════════════════════════════════════════════ # ENTRY POINT # ══════════════════════════════════════════════════════════════════════════════ DEFAULT_URL = "https://steamcommunity.com/profiles/76561198080075870/inventory/" def scrape_steam_inventory(steam_url: str) -> list[dict] | None: """ Full pipeline: 1. Convert Steam URL → SteamDT URL 2. Fetch raw API JSON via headless browser 3. Parse + enrich items 4. Print summary 5. Return item list """ steamdt_url = convert_to_steamdt_url(steam_url) print(f"Steam URL : {steam_url}") print(f"SteamDT URL: {steamdt_url}") raw_data = fetch_inventory_from_site(steamdt_url) if not raw_data: print("ERROR: No data received from SteamDT.") return None items = extract_and_enrich_items(raw_data) if not items: print("ERROR: No items found in API response.") return None print_inventory_summary(items) return items if __name__ == "__main__": url = sys.argv[1] if len(sys.argv) > 1 else DEFAULT_URL scrape_steam_inventory(url)