diff --git a/disco.py b/disco.py index 71f1fcc..849c5c4 100644 --- a/disco.py +++ b/disco.py @@ -80,13 +80,15 @@ def extract_products_from_har(har_path: str) -> list[dict]: def rootsv_to_sku(rootsv: str) -> str: - """Convert rootSV like '0419363_1' to SKU like '41936301'.""" + """Convert rootSV like '0419363_1' to SKU like '41936301'. + + The rootSV base (minus leading zero) + '01' gives the DG item number. + The '_N' suffix is a variant/image index, not part of the SKU. + """ if not rootsv: return "" - parts = rootsv.split("_") - base = parts[0].lstrip("0") - suffix = parts[1] if len(parts) > 1 else "" - return base + suffix + base = rootsv.split("_")[0].lstrip("0") + return base + "01" def build_product_url(upc: str) -> str: