amazondata
A python package to get amazon product and search data in json form. The package does not require any API keys as it works by scraping the amazon page.
Reference: How To Scrape Amazon Product Details and Pricing using Python
Install
pip install amazondata
Usage
To get Amazon product details from the url, use the following function.
get_product_from_url(url)
from amazondata.product_details_extractor import ProductDetailsExtractor
product_details_extractor = ProductDetailsExtractor()
data = product_details_extractor.get_product_from_url('https://www.amazon.in/dp/B09JSYVNZ2')
print(data)
To get Amazon product details from the ASIN (Amazon Standard Identification Number) code, use the following function.
get_product_from_asin_code(asin_code)
from amazondata.product_details_extractor import ProductDetailsExtractor
product_details_extractor = ProductDetailsExtractor()
data = product_details_extractor.get_product_from_asin_code('B09JSYVNZ2')
print(data)
To get the list of products from search query use the following function
search(query, page)
from amazondata.search_result_extractor import SearchResultExtractor
search_result_extractor = SearchResultExtractor()
data = search_result_extractor.search('perfume for men', 3)
print(data)
NOTE: Optionally, you can pass custom headers to all these functions. The default headers value is:
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Sec-Fetch-Site": "none",
"Host": "www.amazon.in",
"Accept-Language": "en-IN,en-GB;q=0.9,en;q=0.8",
"Sec-Fetch-Mode": "navigate",
"Accept-Encoding": "gzip, deflate, br",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
"Sec-Fetch-Dest": "document",
"Priority": "u=0, i",
}
In case the the scraper gets blocked from Amazon, you can fetch the html code using selenium and pass the html code to the following function
data = extract_search_results(html_code)
data = extract_product_details(html_code)
Metadata
Release files for amazondata 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| amazondata-0.1.3.tar.gz | 5.9 kB | Without provenance | Details for amazondata-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| amazondata-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for amazondata-0.1.3-py3-none-any.whl |
Total release size: 13.2 kB
Release files / amazondata-0.1.3.tar.gz
| Download URL | amazondata-0.1.3.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a2f944715bf9f3dc1bc611b56490365c654c95db881f583bc62e5707af56936
|
|
BLAKE2b-256 checksum How to use checksums |
750c67f3b76324d6ab07cb3dd023fe60e99044761ae491caa9ed0de2fb5fef61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Release files / amazondata-0.1.3-py3-none-any.whl
| Download URL | amazondata-0.1.3-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d178b2d004a8df975a01d649795541b527b78f839c146bec1488c65310313bf
|
|
BLAKE2b-256 checksum How to use checksums |
67ab6375c5039dc28faf5d47bbec58ab618b977c6636b558c2072776150ce441
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for amazondata 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.