Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakemmarsh/craigslist.js
A Javascript API wrapper for craigslist.org.
https://github.com/jakemmarsh/craigslist.js
Last synced: about 5 hours ago
JSON representation
A Javascript API wrapper for craigslist.org.
- Host: GitHub
- URL: https://github.com/jakemmarsh/craigslist.js
- Owner: jakemmarsh
- License: mit
- Created: 2016-03-21T01:09:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-03-28T20:59:52.000Z (over 8 years ago)
- Last Synced: 2024-09-18T09:38:14.485Z (about 2 months ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# craigslist.js [![npm version](https://badge.fury.io/js/craigslist.js.svg)](https://badge.fury.io/js/craigslist.js) [![Build Status](https://travis-ci.org/jakemmarsh/craigslist.js.svg?branch=master)](https://travis-ci.org/jakemmarsh/craigslist.js) [![Dependency Status](https://david-dm.org/jakemmarsh/craigslist.js.svg)](https://david-dm.org/jakemmarsh/craigslist.js) [![devDependency Status](https://david-dm.org/jakemmarsh/craigslist.js/dev-status.svg)](https://david-dm.org/jakemmarsh/craigslist.js#info=devDependencies)
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](http://www.craigslist.org/about/sites). The results will be of the format:
```json
[
{
"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:
```json
[
{
"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:
```json
{
"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`