1.0.0 • Published 8 years ago

craigslist.js v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

craigslist.js npm version Build Status Dependency Status devDependency Status

A Javascript API wrapper for craigslist.org.

Getting Started

  1. npm install --save craigslist.js
  2. import craigslist from 'craigslist.js';
  3. 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

  1. git clone https://github.com/jakemmarsh/craigslist.js.git
  2. npm install
  3. npm test