From ee1e72992b7945e39864c03c059d62dc24a9bac8 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Fri, 27 Mar 2026 08:07:05 -0700 Subject: [PATCH] fix: strip v1|...|0 Browse API item ID prefix before building /itm/ URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BTF enrichment (_fetch_item_html) was constructing invalid URLs like https://www.ebay.com/itm/v1|123456789|0 when listings came from the API adapter (Browse API itemId format). Extract the numeric segment from compound IDs before appending to EBAY_ITEM_URL — scraper IDs are already plain numeric so the split is a no-op for that adapter. --- app/platforms/ebay/scraper.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/platforms/ebay/scraper.py b/app/platforms/ebay/scraper.py index d0e7297..5c9d999 100644 --- a/app/platforms/ebay/scraper.py +++ b/app/platforms/ebay/scraper.py @@ -342,7 +342,13 @@ class ScrapedEbayAdapter(PlatformAdapter): return self._fetch_url(url) def _fetch_item_html(self, item_id: str) -> str: - """Fetch a single eBay listing page. /itm/ pages pass Kasada; /usr/ pages do not.""" + """Fetch a single eBay listing page. /itm/ pages pass Kasada; /usr/ pages do not. + + Browse API returns itemId as "v1|123456789012|0"; extract the numeric + segment so the URL resolves correctly (scraper IDs are already numeric). + """ + if "|" in item_id: + item_id = item_id.split("|")[1] return self._fetch_url(f"{EBAY_ITEM_URL}{item_id}") @staticmethod