Skip to content
المشاريع

حول

Python library and CLI for scraping products, images and collections from Shopify, WooCommerce, Magento, BigCommerce, Squarespace and other stores.

البيانات والتحليلات

كيف تُقاس هذه الأرقام

ما يمكنك فعله

  • --help prints plain, untruncated text when piped, with every default, examples, where results go and what each exit code means.
  • Items are plain dicts with typed definitions, and help(spy.scrape) documents every library option, so an agent can write a script without reading the source.
  • --peek prints one item to stdout for a quick look at its shape; warnings go to stderr, so stdout stays valid JSONL.
  • Every run writes a machine-readable status file with each store's status and a suggested fix for some failures (such as a likely wrong platform), and the exit code says whether any store produced items.

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
+٢
خلال 15 يومًا
+٥
خلال شهر
التحديث متأخر

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل
Shopify Spy

Shopify Spy

Product and collection scraper for Shopify, WooCommerce, Magento, BigCommerce, Squarespace, PrestaShop, Wix and other stores, built for scripts and AI coding agents.

CI PyPI version Python 3.11+ License: MIT

Shopify Spy is a command-line tool and Python library for scraping product and collection data from ecommerce stores. It supports Shopify, WooCommerce, Magento, BigCommerce, Squarespace, PrestaShop, Wix and other stores out of the box, using the public JSON and GraphQL endpoints of Shopify, WooCommerce, Magento, BigCommerce and Wix, PrestaShop's category listings as JSON and, for Squarespace and any other store, the schema.org Product data (JSON-LD or microdata) on the product pages their sitemaps list or their links lead to, so it needs no API keys or store access. It's designed to be driven by AI agents as much as by people: coding agents such as Claude Code, Codex and GitHub Copilot, and personal agents such as Hermes and OpenClaw, or any agent that can run a shell command or a Python script.

Installation

# The command (spy and shopify-spy)
uv tool install shopify-spy

# The library, in a project
uv add shopify-spy        # or: pip install shopify-spy

# Or run either once, nothing to install
uvx shopify-spy scrape --peek https://www.example.com
uv run --with 'shopify-spy>=0.8' python script.py

# Excel output (--format xlsx) needs the excel extra: install 'shopify-spy[excel]'

A uv tool install provides only the command, so import shopify_spy needs the library install. With uvx, name the package (uvx shopify-spy ...), since uvx spy would fetch an unrelated package. Python 3.11 or later is required. Installation covers pipx, inline script metadata and Nix.

Quick Start

Command line

# Scrape a store, detecting its platform (the default)
spy scrape https://www.example.com

# Name the platform to skip detection, here a WooCommerce store
spy scrape --platform woocommerce https://www.example.com

# Scrape a Magento store
spy scrape --platform magento https://www.example.com

# Scrape a BigCommerce store
spy scrape --platform bigcommerce https://www.example.com

# Scrape a Squarespace store, from its product pages (one request per product)
spy scrape --platform squarespace https://www.example.com --limit 100

# Scrape a PrestaShop store, from its category listings
spy scrape --platform prestashop https://www.example.com

# Scrape a Wix store, through the catalog API its own store pages use
spy scrape --platform wix https://www.example.com

# Any other store, from its product pages' schema.org data (one request per product)
spy scrape --platform generic https://www.example.com --limit 100

# Several stores of any platforms, with collections (Shopify collections, Wix category names) and images
spy scrape https://store1.com https://store2.com --collections --images

# Sample 10 items
spy scrape https://www.example.com --limit 10

# Print one item to stdout, writing nothing, and pipe it to jq
spy scrape --peek https://www.example.com 2>/dev/null | jq '.product.title'

Results are saved as JSONL in ./output (change it with --output), with a live item counter while it runs. --format picks JSON, CSV, Excel (XLSX) or XML instead, and --schema unified gives one row per variant with the same columns on every platform. Command line lists every option and the config file, and Output describes what's written.

Python

The same engine is a library, so a script can scrape, filter and save in one pass. Install the library first (see Installation).

import shopify_spy as spy

# Items are plain dicts in their platform's shape (a Shopify store's here),
# yielded while the stores are scraped
for item in spy.scrape("https://www.example.com", max_items_per_store=100):
    print(item["product"]["title"])

# Several stores to a file, then check which ones failed and why
run = spy.scrape(["store1.com", "store2.com"], on_failure="warn")
spy.write_items(run, "products.jsonl")
for store in run.result.failed:
    print(store.input_url, store.status, store.hint)

help(spy.scrape) documents every option, and Use as a library covers failure handling, schemas, images and async use.

With a coding agent

An agent needs nothing installed. uvx shopify-spy scrape --peek URL shows an item's shape, and a script run with uv run --with 'shopify-spy>=0.8' python script.py filters and saves only what the task needs. The CLI is simpler for whole-catalog dumps and image downloads. Everything an agent needs to work this out is in spy scrape --help, which prints plain, complete text when piped, and in help(spy.scrape).

The Agent Skill goes further, with recipes, decision rules and politeness rules for the agent; install it with spy skill install, gh skill install, npx skills add or as a Claude Code plugin.

Features

  • Agent-friendly. Built for AI agents, coding or personal, as much as for people:
    • --help prints plain, untruncated text when piped, with every default, examples, where results go and what each exit code means.
    • Items are plain dicts with typed definitions, and help(spy.scrape) documents every library option, so an agent can write a script without reading the source.
    • --peek prints one item to stdout for a quick look at its shape; warnings go to stderr, so stdout stays valid JSONL.
    • Every run writes a machine-readable status file with each store's status and a suggested fix for some failures (such as a likely wrong platform), and the exit code says whether any store produced items.
  • Failure diagnostics. A failed store gets a status saying what went wrong (403, 404, robots.txt, 429 rate limits, 5xx errors, TLS errors, timeout, no response). When a run returns 0 items, the tool explains the likely cause and suggests flags to try, including the other --platform when a store looks like it runs on it. See Troubleshooting.
  • Platform detection. Each store's platform is detected by default, from /products.json and then the homepage, so one run can mix platforms; a store with no platform detected is read from its product pages, as --platform generic would.
  • Python library. import shopify_spy gives the same scraping engine as the CLI, with items as typed plain dicts and failures that are never silent.
  • Spreadsheet-ready output. JSONL, JSON, CSV, Excel and XML, with a unified schema shared by every platform.
  • Polite by default. Robots.txt and its Crawl-delay or Request-rate are honored (--ignore-robots drops both), each host gets at most one page or API request a second (slower when it struggles), and a store that produces nothing within --bail seconds (default 30) is abandoned instead of hanging the run.
  • Proxy support. HTTP, HTTPS and SOCKS5, for a company network, another region or keeping your IP address private. A proxy list (--proxy-file) gives each store its own proxy, or its own session on a rotating gateway, at the same pace; see Proxy lists.
  • Retries. Timeouts, dropped connections, transient 5xx errors and 429 rate limits are retried, honoring Retry-After. Requests use a current browser's TLS and HTTP/2 settings and headers, and a 403 or 429 is retried once as another browser after the usual backoff; see Retries and identities.

Supported Platforms

By default (--platform auto) each store's platform is detected before it is scraped, and a store with no platform detected is read as Generic; naming a platform skips detection.

Platform Mechanism Notes
Shopify /products.json bulk endpoint, then collection pages past 25,000 products, then the store's myshopify.com domain if its own 404s, sitemap fallback, then product pages' structured data when the product .json URLs 404; collections from /collections.json Products and collections
WooCommerce /wp-json/wc/store/v1/products, then each page's variations (?type=variation); product pages' structured data as a fallback No authentication required
Magento storefront GraphQL products query at /graphql, catalog-visible products plus search-only ones when the search listing counts more; product pages' structured data as a fallback No authentication required; default store view; stock_status only with the inventory GraphQL module
BigCommerce Storefront GraphQL site.products at /graphql, with the public API token from the homepage Stencil storefronts whose theme exposes the token, and headless ones whose page names its mybigcommerce.com endpoint; default currency
Squarespace product pages from the sitemap, schema.org Product JSON-LD or microdata; with --ignore-robots, collection pages' ?format=json Squarespace's robots.txt disallows ?format=json, so product pages are read by default, one request per product
PrestaShop each category's listing as JSON (?page=N&from-xhr), categories from the homepage and sitemap; product pages' structured data as a fallback PrestaShop 1.7 and 8; 1.6 and stores whose listings don't answer JSON are read from product pages, one request per product
Wix Wix Stores storefront GraphQL catalog.products, with the site's visitor token from /_api/v1/access-tokens; product pages from /store-products-sitemap.xml as a fallback Undocumented API; default language and currency; category names with --collections
Generic product pages from the sitemaps and same-site links, schema.org Product JSON-LD or microdata Best-effort fallback; one request per page

Platforms compares what each one returns and where it stops.

Documentation

  • Installation: uv, pipx, library installs, the excel extra, Nix, the agent skill
  • Command line: scrape, init and skill options, the config file, proxies
  • Platforms: how each platform is read, what it returns, its limits and when a store is partial
  • Output: files, item shapes, the unified schema, Excel, images, working with the output
  • Use as a library: the Python API, failures, options, schemas, async
  • Troubleshooting: store statuses, exit codes, the status file, logs, rate limiting, large catalogs
  • For site owners: blocking or slowing Shopify Spy with robots.txt
  • Changelog: what changed in each release

Responsible use

Shopify Spy reads public catalog data, follows robots.txt and throttles itself by default. It matches robots.txt rules against its own shopify-spy token, whatever User-Agent it sends, so a site can opt out by name; For site owners shows how. You are responsible for how you use it, including following each site's terms and the laws that apply to you. Product descriptions and images are often copyrighted; collecting them doesn't give you the right to republish them.

Shopify Spy is not affiliated with or endorsed by Shopify or any other platform it supports. If a site asks you to stop collecting data, please do. The software is provided as is under the MIT License.

Feedback

Found a bug or have a suggestion? Open an issue.

License

MIT

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…