This module makes for simple retrieval of search results from Craigslist.com!
npm install node-craigslist
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);
});
});
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)
});
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)
});
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' }