fix: strip v1|...|0 Browse API item ID prefix before building /itm/ URL

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.
This commit is contained in:
pyr0ball 2026-03-27 08:07:05 -07:00
parent 9e20759dbe
commit ee1e72992b

View file

@ -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