diff --git a/examples/Amazon Products.md b/examples/Amazon Products.md new file mode 100644 index 0000000..6b600fd --- /dev/null +++ b/examples/Amazon Products.md @@ -0,0 +1,63 @@ +# Amazon Products Scraper With Python + +The library provides real-time access to Amazon product pages via [Outscraper API](https://app.outscraper.com/api-docs#tag/Amazon/paths/~1amazon~1products-v2/get). +You can use Amazon products, searches, or summary page URLs. + +It supports batching by sending arrays with up to 250 queries. +It allows multiple queries to be sent in one request and to save on network latency time. + +## Installation + +Python 3+ +```bash +pip install outscraper +``` + +[Link to the Python package page](https://pypi.org/project/outscraper/) + +## Initialization +```python +from outscraper import OutscraperClient + +client = OutscraperClient(api_key='SECRET_API_KEY') +``` +[Link to the profile page to create the API key](https://app.outscraper.com/profile) + +## Usage + +```python +# Get a single product by URL +results = client.amazon_products( + ['https://www.amazon.com/dp/B0F22JJVMT', + 'https://www.amazon.com/dp/B07ZMKXMTG'], + domain='amazon.com', + postal_code='10001', + fields=['asin', 'name', 'availability', 'price_parsed'] +) + +# Get products from a search results page (summary page) +results = client.amazon_products( + ['https://www.amazon.com/s?k=wireless+earbuds'], + limit=20, + domain='amazon.com', + postal_code='11201', +) + +# Use multiple queries in one request (batching) +results = client.amazon_products( + [ + 'https://www.amazon.com/s?k=gaming+mouse', + 'https://www.amazon.com/s?k=mechanical+keyboard', + ], + limit=10, + domain='amazon.com', +) + +# Print a few key fields from the response +for query_results in results: + for product in query_results: + print('name:', product.get('name')) + print('price:', product.get('price')) + print('asin:', product.get('asin')) + print('url:', product.get('url')) +``` diff --git a/examples/Amazon Reviews.md b/examples/Amazon Reviews.md new file mode 100644 index 0000000..0c68a00 --- /dev/null +++ b/examples/Amazon Reviews.md @@ -0,0 +1,100 @@ +# Amazon Reviews Scraper With Python + +The library provides real-time access to Amazon product reviews via [Outscraper API](https://app.outscraper.com/api-docs#tag/Amazon/paths/~1amazon~1reviews/get). + +You can use Amazon product URLs or ASINs as input queries. +It supports batching by sending arrays with up to 250 queries, so you can scrape multiple products in one request. + +## Installation + +Python 3+ +```bash +pip install outscraper +``` + +[Link to the Python package page](https://pypi.org/project/outscraper/) + +## Initialization +```python +from outscraper import OutscraperClient + +client = OutscraperClient(api_key='SECRET_API_KEY') +``` +[Link to the profile page to create the API key](https://app.outscraper.com/profile) + +## Usage + +```python + +# 1) Get reviews for one product by URL +results = client.amazon_reviews( + query=['https://www.amazon.com/dp/1612680194'], + limit=10, +) + +# 2) Get reviews for one product by ASIN +results = client.amazon_reviews( + query=['1612680194'], + limit=12, +) + +# 3) Use batching (many products in one request) +results = client.amazon_reviews( + query=[ + 'https://www.amazon.com/dp/1612680194', + 'B0F22JJVMT', + ], + limit=8, +) + +# 4) Filter and sort reviews +results = client.amazon_reviews( + query=['1612680194'], + limit=12, + sort='recent', + filter_by_reviewer='avp_only_reviews', # verified purchase only + filter_by_star='positive', +) + +# 5) Use another Amazon domain +results = client.amazon_reviews( + query=['https://www.amazon.co.uk/dp/B007AIIGWE'], + limit=10, + domain='amazon.co.uk', +) + +# 6) Request only selected fields to make response lighter +results = client.amazon_reviews( + query=['1612680194'], + limit=5, + fields=['query', 'id', 'product_asin', 'title', 'rating', 'date', 'body'], +) + +# Print parsed reviews (beginner-friendly pattern) +for query_reviews in results: + for review in query_reviews: + print('asin:', review.get('product_asin')) + print('rating:', review.get('rating')) + print('title:', review.get('title')) + print('date:', review.get('date')) + print('review:', review.get('body')) + +# 7) Async mode for background scraping (useful for larger jobs) +task = client.amazon_reviews( + query=['1612680194', 'B0F22JJVMT'], + limit=12, + async_request=True, +) + +``` + +## Main Parameters + +- `query` (required): Amazon product URLs or ASINs. +- `limit`: Number of reviews per product query (default: `10`, max: `12`). +- `sort`: `helpful` or `recent`. +- `filter_by_reviewer`: `all_reviews` or `avp_only_reviews`. +- `filter_by_star`: `all_stars`, `five_star`, `four_star`, `three_star`, `two_star`, `one_star`, `positive`, `critical`. +- `domain`: Amazon domain such as `amazon.com`, `amazon.co.uk`, `amazon.de`, etc. +- `fields`: Return only specific fields. +