NativePort
← All use cases

Read product listings from eBay

Turn an eBay item URL into product details your agent can inspect and compare.

The problem

An eBay comparison depends on the individual listing. Two listings with similar titles can describe different conditions, bundles, or offers. An agent cannot infer those details from the product name, and an ordinary page download does not reliably separate the item from the surrounding page.

How NativePort helps

NativePort connects the agent to Zyte, which reads the listing and extracts product information. Your agent receives a record it can compare with another listing while keeping the original link available for inspection.

Technical implementation

Use Python 3 with requests installed (python -m pip install requests). Set NATIVEPORT_API_KEY in your environment to your NativePort key. Run the snippets on your server, where your key stays private.

Set EBAY_ITEM_URL to the full URL of one public eBay item page. The request asks for Zyte’s product extraction and preserves the source URL.

python
import json
import os
import requests

BASE = "https://api.nativeport.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}

url = os.environ["EBAY_ITEM_URL"]
response = requests.post(
    BASE + "/zyte",
    headers=HEADERS,
    json={"url": url, "product": True},
    timeout=120,
)
response.raise_for_status()
product = response.json().get("product")
if not isinstance(product, dict) or not product.get("name"):
    raise RuntimeError("No product details extracted from this URL")
print(json.dumps({"source_url": url, "product": product},
                 indent=2, ensure_ascii=False))

Inspect the returned fields before comparing offers. If condition, shipping, seller terms, or auction details are absent, your agent should say they are unknown. Treat the result as a snapshot of one listing; this example does not search the eBay catalog or place bids. Repeat the request for another item URL when you need a comparison.

Tool costs

Tool used in the examplePrice per call
Zyte — product extraction from one eBay listing $0.00211 / call

Prices in USD. Usage-based tools have no fixed per-call price. View pricing.

Let your agent build it

You don’t need to write this code yourself. Copy this page’s link and paste it into your agent. Ask it to follow the guide and implement the feature for you.