1.0.0 • Published 8 years ago
craigslist.js v1.0.0
craigslist.js
A Javascript API wrapper for craigslist.org.
Getting Started
npm install --save craigslist.js
import craigslist from 'craigslist.js';
- Invoke API methods
Methods
getRegions()
This method will return an array of regions, scraped from http://www.craigslist.org/about/sites. The results will be of the format:
[
{
"name": "san francisco bay area",
"identifier": "sfbay"
},
...
]
The identifier
property should be used when invoking other methods that require a region.
getCategories(regionIdentifier)
This method will return an array of categories, scraped from the provided region's index page. The results will be of the format:
[
{
"name": "books",
"identifier": "bka"
},
...
]
The identifier
property should be used when invoking other methods that require a category.
getListings(regionIdentifier, categoryIdentifier, query = null, limit = 50)
This method will return an array of listing results within the specified region and category, also matching an optional query. It will return up to limit
results, which defaults to 50. The results will be of the format:
{
"title": "",
"price": "$50.99",
"location": "",
"image": "",
"url": ""
}
Running Tests
git clone https://github.com/jakemmarsh/craigslist.js.git
npm install
npm test
1.0.0
8 years ago