Skip to main content

A Parser for Amazon Pages

Project description

AmazonParser

Python Library for Parsing Amazon Pages

Description

AmazonParser is a Python library designed to parse product information from Amazon product pages. It extracts useful data such as product title, price, ratings, and more.

Prerequisites

  • Python 3.6 or higher
  • lxml library: pip install lxml

Installation

You can install the library using pip:

pip install AmazonParser

Usage

Here is an example of how to use the AmazonParser module:

from amazonparser import AmazonParser

# Create an instance of the parser
parser = AmazonParser()

# Parse a product page
path = 'tests/archives/page-ASIN.html'
html = AmazonAEProductPageParser.get_html_from_file(path)
product_data = AmazonAEProductPageParser(html=html, base_url="https://www.amazon.ae/")

# Print the parsed data
print(product_data)

Example Output

The parse_product_page method returns a dictionary with the following structure:

{'best_sellers_rank': [{'category': 'Mobile Phones & Communication Products',
                        'category_url': 'https://...',
                        'rank': 5},
                       {'category': 'Mobile Phone Screen Protectors',
                        'category_url': 'https://...',
                        'rank': 2}],
 'bought_past_mounth': '500+',
 'brand': 'JETech',
 'bullet_points': 'STRING',
 'customers_reviews': {'count': 21049, 'rate': 4.3},
 'date_first_available': datetime.date(2024, 8, 6),
 'image': 'https://m.media-amazon.com/images/I/71B7WFLtovL._AC_SL1500_.jpg',
 'price': {'currency': 'AED', 'value': 30.99},
 'product_bundles': {'B09BVR4LFY': 'iPhone 13/13 Pro 6.1-Inch',
                     'B09BZ2YD6F': 'iPhone 13 Pro Max 6.7-Inch',
                     'B0B2L6R586': 'iPhone 12/12 Pro 6.1-Inch',
                     'B0B2RQP8MK': 'iPhone 12 Pro Max 6.7-Inch',
                     'B0DBZNC8DL': 'iPhone 16 Pro 6.3-Inch',
                     'B0DBZPXJRH': 'iPhone 16 Pro Max 6.9-Inch',
                     'B0DBZQ2WR3': 'iPhone 16 Plus 6.7-Inch',
                     'B0DBZR3TX7': 'iPhone 16 6.1-Inch'},
 'seller_detail': {'seller_id': 'A11TDSN2MJL3GW',
                   'seller_name': 'JE Products AE',
                   'seller_profile_url': 'https://www.amazon.ae/sp/?seller=A11TDSN2MJL3GW'},
 'stock_availability': {'quantity': 50, 'status': True},
 'title': 'JETech Screen Protector for iPhone 16 Pro Max 6.9-Inch, Tempered '
          'Glass Film with Easy Installation Tool, Case-Friendly, HD Clear, '
          '3-Pack'}

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amazonparser-0.1.3.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

AmazonParser-0.1.3-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file amazonparser-0.1.3.tar.gz.

File metadata

  • Download URL: amazonparser-0.1.3.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for amazonparser-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8af99925b1dc65c0f917107641ba9d855f65e647a5f67b615b8da3684c6444ba
MD5 b5381020c6fb602d92e3d5a36aba4342
BLAKE2b-256 7e5773989ada9fcc6bbe20f6f6cf64b98d676cd46acbd7ad41260f150ed38dbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for amazonparser-0.1.3.tar.gz:

Publisher: python-publish.yml on a4fr/AmazonParser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file AmazonParser-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: AmazonParser-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for AmazonParser-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6ab0c156a5315086daff9e02e9304779e7620c23d5a294acaaef598d2b8996e6
MD5 726cc812be37bf66bcc6ecf11bc35499
BLAKE2b-256 3347e1522bccf1de782889508e66628dbe107dc6960a15ed4879688ad7a1ea42

See more details on using hashes here.

Provenance

The following attestation bundles were made for AmazonParser-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on a4fr/AmazonParser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page