Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.
/ node-craigslist Public archive
forked from pgmemk/node-craigslist

Node driver for searching Craigslist.com listings

License

Notifications You must be signed in to change notification settings

tradle/node-craigslist

 
 

Repository files navigation

Craigslist Search Driver

This module makes for simple retrieval of search results from Craigslist.com!

Build Status Coverage Status Dependency Status

Installation

npm install node-craigslist

Usage

Search

To use it, it's as simple as the following example:

var
  craigslist = require('node-craigslist');
  client = craigslist({
    city : 'seattle'
  });

client.search('xbox one', function (err, listings) {
  // play with listings here...
  listings.forEach(function (listing) {
    console.log(listing);
  });
});

Advanced Search

Do you want to filter by price? Check out the following example:

var
  craigslist = require('node-craigslist');
  client = craigslist({
    city : 'seattle'
  }),
  options = {
    maxAsk : '200',
    minAsk : '100'
  };

client.search(options, 'xbox one', function (err, listings) {
  // filtered listings (by price)
});

Options

Per request, options can be modified to specify a different city than whatever is specified during initialization:

var
  craigslist = require('node-craigslist');
  client = craigslist({
    city : 'seattle'
  }),
  options = {
    city : 'boston'
  };

client.search(options, 'xbox one', function (err, listings) {
  // listings (from Boston instead of Seattle)
});

Listing Object

Each listing returned has several properties... see the example below:

{ pid: '1234567890',
  category: 'video gaming - by owner',
  date: 'Mar  1',
  hasPic: true,
  location: 'Seattle',
  price: '250',
  title: 'NEW & UNSEALED XBOX 360 - 250 GB BLACK FRIDAY BUNDLE',
  url: 'https://seattle.craigslist.org/see/vgm/4355583965.html' }

About

Node driver for searching Craigslist.com listings

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%