Releases: kyle-n/unofficial-amazon-search
Upgrades jsdom
Updated dependencies
This release contains no changes to the public API for the package.
- Updates package dependencies
- Fixes a security vulnerability in a dependency
- Moves e2e test out of GitHub Actions to a separate script for running e2e tests locally
Bumps node-notifier version
Bumps node-notifier to fix a security vulnerability.
Bug fixes for sponsored results
- The logic for detecting if a result was sponsored was broken, it has been fixed
fullProductUrl
onAmazonSearchResult
now accepts values. You must pass a full URL with the Amazon domain or it will error. Assign sub-domain values toproductUrl
.- Unit test suite, should help detect future regressions
Multi-page search
🎉 2.0.0! 🎊
UAS is celebrating 2.0.0 by adding multi-page search. Now you can load as many search results as Amazon returns.
Breaking changes
searchAmazon
parameters
searchAmazon
now takes two parameters, one an optional config object.
import {searchAmazon} from 'unofficial-amazon-search';
// Loads page 2 of search results, with ads included
searchAmazon('mad max', {page: 2, includeSponsoredResults: true}).then(data => {
console.log(data.searchResults); // (search result array)
console.log(data.pageNumber); // 2
});
All config properties are optional.
searchAmazon
return shape
searchAmazon
now returns an object conforming to the interface SearchData
. SearchData
is documented in the README.
searchAmazon('mad max').then(data => {
console.log(data.searchResults) // (page 1 search result array)
return data.getNextPage();
}).then(data => {
console.log(data.searchResults) // (page 2 search result array)
});
AmazonSearchResult
properties
The productUrl
now property returns the path for an Amazon search result without the leading domain. To access the complete url, use the new fullProductUrl
computed property.
searchAmazon('mad max').then(data => {
console.log(data.searchResults[0].productUrl) // /gp/slredirect/picassoRedirect.html/ref=pa_sp_atf_next_aps_sr_pg2_1...
console.log(data.searchResults[0].fullProductUrl // https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_atf_next_aps_sr_pg2_1...
});
If you assign to productUrl
, its value should not include the leading https://www.amazon.com
.
The AmazonSearchResult
class previously used getters and setters to assign to and read from private underscored properties (e.x. get title(): string { return this._title; }
. These have been simplified to just have publicly accessible properties without get
s and and set
s. If you used the underscore-prefixed properties, for some reason, those have been removed.
Faster builds when compiling for NPM
In 1.2.5, the TypeScript source was actually transpiled three times: Once for Node, once for the minified bundle and once for the un-minified bundle.
1.2.6 simplifies the build process to:
tsc
transpiles the TS source into un-minified JS for Node, stored inlib
- webpack bundles the JS in
lib
into minified and un-minified bundles, stored in_bundles
Dependencies
- Adds
source-map-loader
to preserve original TS sources in the browser - Removes
ts-loader
, since webpack no longer transpiles
Upgrades dependencies
- The un-minified browser bundle is now not minified
- Upgrades dependencies
- Changes NPM CD workflow to run on new tag, not new release
NPM keywords
NPM keywords to help the package show up in site search
Clarifies documentation and tsconfig
- README explains how proxying browser-side requests works
- tsconfig does not include comments or unused options
- search file is better organized to handle
async
andexport default
syntax
Publishes only transpiled JS to NPM
1.2.1 1.2.1