Bookmancy is a small module to scrape abebooks.com
search results and ebay book search results for consumption in a node environment.
npm i @dillonchr/bookmancy
title
- String - The title of the bookauthor
- String - The author or editor of the book. Basically anything that a seller would potentially put as the author.publisher
- String - The name of the publisherformat
- String - options include [hardback, hardcover, softcover, paperback, h, p]year
- Number - Four digit year, filters books published<=year
includeUrl
- Boolean - optional, will append a url prop to the response object for continuing the search manually
{
results: [
<BookResult>...
]
}
const bookmancy = require('bookmancy');
bookmancy.abe({author: 'August Derleth', publisher: 'Mycroft'}, (err, data) => {
console.log(err || data.results.length);
});
{
url: 'https://abebooks...',
retults: [
<BookResult>...
]
}
All ebay requests take place with their actual API. So you will need to register to add an application and get your keys. Once you have your key you will need to be sure to include the key in your project's .env
file:
EBAY_API_KEY=xxxxxxxxxxxxxxxxxxx
Failure to include this key will result in all search calls throwing an error highlighting that this step must be completed.
title
- String - The title of the bookauthor
- String - The author or editor of the book. Basically anything that a seller would potentially put as the author.publisher
- String - The name of the publisheryear
- Number - Four digit year, filters books published<=year
sold
- Boolean - search for sold listingslive
- Boolean - search for live listings
Note: author
, title
, publisher
, year
will be joined with spaces and searched against the API. eBay doesn't have a way to search for specific authors, titles, publishers, or publication years.
The sold
and live
properties are booleans. If you omit both, then the results returned will be from both sold and live listing searches. Otherwise whichever ones are true will be searched and returned.
{
results: [
<BookResult>...
]
}
const bookmancy = require('bookmancy');
bookmancy.ebay({author: 'August Derleth', publisher: 'Mycroft'}, (err, data) => {
console.log(err || data.results.length);
});
about
- String - The description from the listingprice
- String - Unformatted priceshipping
- String|Null - Unformatted shipping priceimage
- String|Null - URL for photoyear
- String|Null - Year work was published in listingsold
- Boolean - (ebay only) if listing sold or is no longer for saleurl
- String - URL to view item listingdate
- Timestamp - (ebay only) when listing/auction expires