/amazon-api

Serverless Amazon Search and Product API, runs on Cloudflare worker. Supports multiple country's amazon version.

Primary LanguageTypeScript

Amazon API

This project is a comprehensive edge API for Amazon. It supports search and product endpoints. The search endpoint allows you to search for products on Amazon. The product endpoint allows you to get product details by ASIN. This API supports both REST and GraphQL endpoints.

Changelog πŸ””

1. May 5, 2024 - Amazon blocked Cloudflare ASN

It seems like Amazon has blocked Cloudflare ASN. So, the API will work in development mode only. It uses hono, so it is possible to deploy the project on any other cloud provider.

2. May 5, 2024 - Don't use the hosted API

Please don't use the hosted API. Deploy your own instance of the project. The hosted API is for demonstration purposes only. The hosted API may be taken down at any time.

3. May 5, 2024 - V2 is here

I rewrite the full project from scratch. The new version is written in TypeScript and uses Cloudflare Workers. This version is faster and more reliable and also supports GraphQL.

Changes:

  • Rewrite the full project in TypeScript
  • Used Hono
  • Add GraphQL support
  • Add support for multiple country versions of Amazon
  • Add support for pagination

Cheers πŸŽ‰

Features πŸ“–

  • Support multiple country versions of Amazon
  • Search for products on Amazon
  • Get product details by ASIN
  • Supports both REST and GraphQL endpoints
  • Supports pagination

Tech Stack πŸ’»

  • Cloudflare Workers
  • Hono
  • TypeScript
  • GraphQL
  • REST

REST API 🌐

Path Method Description Try it out
/api/[country]/search GET The country code of the Amazon website Try it out
/api/[country]/product/[asin] GET The country code of the Amazon website Try it out

GraphQL API 🌐

  • The graphql endpoint is available at /graphql.
  • Try out the playground at /graphql/playground.

Deployment πŸš€

Deploy to Cloudflare Workers

Implented country versions 🌍

Country Code Base URL Implementation
India in amazon.in Full βœ…
USA us amazon.com Partial 🚧
England uk amazon.co.uk Partial 🚧
Canada ca amazon.ca Partial 🚧
Germany de amazon.de Partial 🚧
France fr amazon.fr Partial 🚧
Italy it amazon.it Partial 🚧
España es amazon.es Partial 🚧
Australia au amazon.com.au Partial 🚧
Japan jp amazon.co.jp Partial 🚧
Brazil br amazon.com.br Partial 🚧
Saudi Arabia sa amazon.sa Partial 🚧
UAE ae amazon.ae Partial 🚧

Legal Disclaimer βš–οΈ

Accroding to some website it is not illegal to scrape public data from Amazon. I am not responsible for any misuse of this API. Use it at your own risk. This project comply with these terms:

  • Not making excessive requests to Amazon website
  • Not interfering with Amazon’s website or services
  • Not using Amazon’s trademarks or logos

Are you from Amazon? and want to take down this project? Sure, I will happy to do that. Well, see the new version of the project was written just to test, how fast I can write a production ready scraper (BTW it took 3 hours only). So my mission was accomplished. Just create an issue and I will make this project private.