{"id":16695011,"url":"https://github.com/kyle-n/unofficial-amazon-search","last_synced_at":"2025-03-21T19:31:10.497Z","repository":{"id":40286189,"uuid":"262196494","full_name":"kyle-n/unofficial-amazon-search","owner":"kyle-n","description":"A simple client for searching Amazon","archived":false,"fork":false,"pushed_at":"2023-03-14T17:45:00.000Z","size":1094,"stargazers_count":8,"open_issues_count":8,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T21:35:14.027Z","etag":null,"topics":["amazon","amazon-search","javascript","nodejs","scraper","scraping","typescript","web"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/unofficial-amazon-search","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kyle-n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-08T01:24:09.000Z","updated_at":"2024-05-15T20:40:12.000Z","dependencies_parsed_at":"2023-02-05T10:02:26.026Z","dependency_job_id":null,"html_url":"https://github.com/kyle-n/unofficial-amazon-search","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyle-n%2Funofficial-amazon-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyle-n%2Funofficial-amazon-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyle-n%2Funofficial-amazon-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyle-n%2Funofficial-amazon-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyle-n","download_url":"https://codeload.github.com/kyle-n/unofficial-amazon-search/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221817784,"owners_count":16885627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon","amazon-search","javascript","nodejs","scraper","scraping","typescript","web"],"created_at":"2024-10-12T17:04:55.010Z","updated_at":"2024-10-28T10:38:46.074Z","avatar_url":"https://github.com/kyle-n.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unofficial-amazon-search\nA simple client for searching Amazon\n\n## Install\n\n`npm install unofficial-amazon-search`\n\nor\n\n`yarn add unofficial-amazon-search`\n\n## How to use\n\n`searchAmazon` returns `Promise\u003cSearchData\u003e`.\n\n```typescript\nimport {searchAmazon, AmazonSearchResult} from 'unofficial-amazon-search';\n// OR\nconst {searchAmazon, AmazonSearchResult} = require('unofficial-amazon-search');\n\nsearchAmazon('anything you would put in the search bar').then(data =\u003e {\n  console.log(data);\n  console.log(data.pageNumber)    // 1\n  console.log(data.searchResults[0].title, data.searchResults[0].imageUrl);\n});\n\n// load other pages by specifying a page number\n// or calling getNextPage()\nsearchAmazon('mad max', {page: 2, includeSponsoredResults: true}).then(data =\u003e {\n  console.log(data.pageNumber)    // 2\n  console.log(data.searchResults) // (page 2 results)\n  return data.getNextPage();\n}).then(data =\u003e {\n  console.log(data.searchResults) // (page 3 results)\n});\n```\n\nThe above works in Node and frontend environments with compiled code.\n\n`unofficial-amazon-search` can also be imported from a `\u003cscript\u003e` tag and used in raw JS. Importing it will attach the\nmodule to the `window` object. Browser queries are proxied through AllOrigins.win, a limit-free proxy, to avoid CORS issues.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003ctitle\u003eMy beautiful webpage\u003c/title\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\u003c/body\u003e\n\u003cscript src=\"path/to/unofficial-amazon-search/_bundles/unofficial-amazon-search.min.js\" rel=\"script\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var searchAmazon = window.UnofficialAmazonSearch.searchAmazon;\n  searchAmazon('123').then(function (data) {\n    console.log(data.searchResults);\n  });\n\u003c/script\u003e\n\u003c/html\u003e\n```\n\nThe bundle contains minified and non-minified bundles of the compiled search code.\n\nThis is a Promise-based API and does not support callbacks, so you will have to roll your own solution for Internet Explorer.\n\n## API\n\n### Function `searchAmazon`\n\nParameters:\n\n- `query` - string that you'd put into the Amazon website search bar\n- `config` - optional object, can specify any (or none) of the properties on `SearchConfig`.\n\nReturns a `Promise\u003cSearchData\u003e`.\n\n### Interface `SearchConfig`\n\n- `page` - desired page of results\n- `includeSponsoredResults` - set `true` to include ads\n\n### Interface `SearchData`\n\nAn object with properties:\n\n- `searchResults` - `Array\u003cAmazonSearchResult\u003e`\n- `pageNumber` - Page number of current set of `searchResults`\n- `getNextPage` - If there is another page of results for the given query, this function returns a Promise for that next page. If there is no next page, this is undefined.\n\n### Class `AmazonSearchResult`\n\n![A diagram of an Amazon search result annotated by property (includes price labels)](./assets/example-1.png)\n\n![A diagram of an Amazon search ad annotated by property (no price labels)](./assets/example-2.png)\n\n1. `imageUrl` - lead product image that shows in search results\n2. `title` - name of product  \n`productUrl` - URL for product details page\n3. `rating` - x out of y possible score (e.x. 4.2 out of 5)\n4. `prices` - Search often lists multiple prices for versions of an item. This is a set of all found prices, some of \nwhich have labels attached (for example, if you search a DVD barcode number, there are multiple prices, for DVD, Blu-ray\nand 4K, and each has a label like \"4K\"). Price label is null if cannot find it on page\n5. `sponsored` - whether result is an ad. `searchAmazon` filters out these by default\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyle-n%2Funofficial-amazon-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyle-n%2Funofficial-amazon-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyle-n%2Funofficial-amazon-search/lists"}