Reusable Scrapy spider templates plus a CLI runner.
Project description
Common Scrapy Templates
An open, well-maintained collection of Scrapy templates for harvesting structured product data from major retailers. Each template encodes the HTTP request, pagination strategy, and response extraction rules needed for a specific storefront so you can stay focused on downstream data processing.
Installation
pip install common-scrapy
CLI usage
pip install common-scrapy adds a common-scrapy console script so you can work with the packaged spider without cloning the repo.
Use your own proxy
Set the PROXY environment variable inline with the command to force all HTTP requests through your proxy of choice. Any syntax Scrapy supports will work, for example:
PROXY=http://user:pass@host:1234 common-scrapy crawl kohls_products
If you need to switch proxies between runs, just update the PROXY= prefix before invoking common-scrapy again.
List available templates
common-scrapy list
Run a crawl
common-scrapy crawl <template> [additional Scrapy args]
Examples:
common-scrapy crawl kohls_products -s LOG_LEVEL=INFOcommon-scrapy crawl sephora_products -o sephora.csv
The command wires Scrapy's common spider to the template you choose, so any flags you normally pass to scrapy crawl still work (for example, output feeds, settings overrides, or depth limits).
Available templates
kohls_products– product listing crawl for Kohl's seasonal catalog endpoints.sephora_products– product listing crawl for Sephora category APIs.
Contributing
Issues and pull requests that add or improve retailer templates, pagination logic, or extraction helpers are welcome. Please keep templates well-commented, anonymize sensitive identifiers, and include notes on any authentication or proxy requirements to keep the collection healthy for the community.
Project layout
common/spiders/common_spider.py– single parameterized spider that loads retailer-specific templates and converts API responses into normalized items.common/templates/– each retailer lives in its own folder (for example,common/templates/<retailer>/) with three files:request.json– captured HTTP request, headers, query/body params, and pagination strategy.sample.json– a trimmed API response saved from the network inspector so you can reason about the payload without re-running the crawl.extract.json– schema describing what to copy out of the payload (see “Iterating on extraction”).
common/settings/– shared Scrapy configuration; reads environment variables via.env.scrapy.cfg– entry point for thescrapyCLI.
Iterating on extraction
- Reference
sample.jsonto understand the payload shape without replaying the crawl. - Update
extract.jsonto control which fields land in the final item. Set$listto the array that contains products,$includefor top-level metadata to copy onto every record, and$itemfor nested lookups inside each product. - Save the file and re-run the spider to confirm you get the expected output.
Adding new retailer templates
- Capture a representative network request (e.g., via DevTools) and save the HAR snippet into
common/templates/<retailer>/request.json. - Grab a sample JSON response (copy/paste the network preview) and drop it into
common/templates/<retailer>/sample.json. Update it as the API evolves. - Populate
extract.jsonwith$list,$include, and$itemsections so the spider knows which fields to emit. - Run the spider with
scrapy crawl common -a name=<retailer>to verify it paginates and emits data.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file common_scrapy-0.1.0.tar.gz.
File metadata
- Download URL: common_scrapy-0.1.0.tar.gz
- Upload date:
- Size: 87.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd1389e134c698ae81a1c72a45d3aedb33b7b15a73e3e9dedfa79be1ec231a5e
|
|
| MD5 |
5b46e538f62239e17a65ed853d024021
|
|
| BLAKE2b-256 |
22c87c11dc0ad0e462a14f19da8e857a6a54bc996ce6913f7a0c37c35676f683
|
File details
Details for the file common_scrapy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: common_scrapy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 89.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b3fe4ce6b9112cd483dd8634b4510624ea2d6f6688fb863c09040e36a2803c0
|
|
| MD5 |
fafb6e0ce6dc4a24d135983ecbc5c70c
|
|
| BLAKE2b-256 |
35bb762a2e9840e58fe032fe2342b4f95239bc4c0b5b652640dcc57dac89994d
|