{"_id":"@akashdeepsinghal/node-craigslist-scrap","_rev":"2-2d033289e1c4c850813a95e05eb02bff","name":"@akashdeepsinghal/node-craigslist-scrap","description":"a client library for searching, retrieving and creating Craigslist.com listings","dist-tags":{"latest":"1.1.1"},"versions":{"1.1.1":{"name":"@akashdeepsinghal/node-craigslist-scrap","description":"a client library for searching, retrieving and creating Craigslist.com listings","private":false,"version":"1.1.1","author":{"name":"Akash Deep Singhal","url":"http://github.com/akigupta131"},"engine":"node >= 4","keywords":["craigslist","search"],"repository":{"type":"git","url":"git+ssh://git@github.com/akigupta131/node-craigslist-scrap.git"},"main":"./dist","scripts":{"prepublish":"gulp build","test":"gulp lint && gulp test-integration && gulp test-coverage"},"dependencies":{"babel-polyfill":"^6.13.0","cheerio":"^0.20.0","debug":"^2.2.0","source-map-support":"^0.4.2"},"devDependencies":{"babel-eslint":"^6.1.2","babel-preset-es2015":"^6.13.2","babel-preset-stage-0":"^6.5.0","chai":"^3.5.0","del":"^2.2.1","gulp":"^3.9.1","gulp-babel":"^6.1.2","gulp-coveralls":"^0.1.4","gulp-eslint":"^3.0.1","gulp-istanbul":"^1.0.0","gulp-mocha":"^3.0.0","gulp-sourcemaps":"^1.6.0","gulp-util":"^3.0.7","nock":"^8.0.0"},"directories":{"test":"test"},"license":"MIT","bugs":{"url":"https://github.com/akigupta131/node-craigslist-scrap/issues"},"homepage":"https://github.com/akigupta131/node-craigslist-scrap#readme","gitHead":"923be070a1af245a9e378602bdfa78951366d0c2","_id":"@akashdeepsinghal/node-craigslist-scrap@1.1.1","_npmVersion":"5.0.2","_nodeVersion":"7.8.0","_npmUser":{"name":"akigupta131","email":"akigupta131@gmail.com"},"dist":{"integrity":"sha512-G3un0UjObmDW4Toc4coRlRDUNz4OQGaQcx1ig7fjnbQk+bsS8RmKyeeaR1qJCWZUCyfgCxab/1IxtgujScGY3g==","shasum":"817c49bc50c08257eddc7a04a62b0ad0800877c7","tarball":"https://registry.npmjs.org/@akashdeepsinghal/node-craigslist-scrap/-/node-craigslist-scrap-1.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICF0iR4nbFq5s7L2G82l3lNXl50h1vZezRgVQQTdJeI+AiEA9nHE1ODRePcu6710a2L3UMEr8geMQWEVS10ZXsxOcXQ="}]},"maintainers":[{"name":"akigupta131","email":"akigupta131@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-craigslist-scrap-1.1.1.tgz_1496505581808_0.9427832283545285"}}},"readme":"# Craigslist Search Driver\n\nThis module makes for simple retrieval of search results from Craigslist!\n\n[![Build Status](https://travis-ci.org/brozeph/node-craigslist.png)](https://travis-ci.org/brozeph/node-craigslist)\n[![Coverage Status](https://coveralls.io/repos/brozeph/node-craigslist/badge.png?branch=master)](https://coveralls.io/r/brozeph/node-craigslist?branch=master)\n[![Dependency Status](https://gemnasium.com/brozeph/node-craigslist.png)](https://gemnasium.com/brozeph/settings-lib)\n\n## Installation\n\n```bash\nnpm install node-craigslist\n```\n\n## Usage\n\nMethods optionally accept a callback argument - when supplied, the function will execute the callback with two arguments (`err` and `results`). When omitted, the method call will return a Promise.\n\n### Constructor\n\nWhen constructing the craigslist client, options specified are used for all subsequent requests (i.e. [#list](#list) and [#search](#search)).\n\n**Usage:** `new craigslist.Client(options)`\n\n* `options` - _(optional)_ - can be used to supply additional options - see [Options](#options) for details\n  * `city` - _(optional)_ - defines the city for the search (_NOTE: this field is required by [#list](#list) and [#search](#search) when not specified in the constructor_)\n  * `baseHost` - _(optional)_ - allows for specification of the base domain (defaults to `craiglist.org`) to support other countries (i.e. for Canada, `craigslist.ca`)\n  * `maxAsk` - _(optional)_ - maximum price\n  * `minAsk` - _(optional)_ - minimum price\n  * `category` - _(optional)_ - allows for specification of the category (defaults to `sss`) to search in other categories\n\n```javascript\nconst craigslist = require('node-craigslist');\n\nlet client = new craigslist.Client({\n  baseHost : 'craigslist.ca',\n  city : 'Toronto'\n});\n```\n\n### #list\n\nThis method can be used to grab a listing of Craigslist postings.\n\n**Usage:** `client.list(options, callback)`\n\n* `options` - _(optional)_ - can be used to supply additional options - see [Options](#options) for details\n  * `city` - _(optional)_ - defines the city for the search (_NOTE: this field is required when city is not specified in the constructor_)\n  * `baseHost` - _(optional)_ - allows for specification of the base domain (defaults to `craiglist.org`) to support other countries (i.e. for Canada, `craigslist.ca`)\n  * `maxAsk` - _(optional)_ - maximum price\n  * `minAsk` - _(optional)_ - minimum price\n  * `category` - _(optional)_ - allows for specification of the category (defaults to `sss`) to search in other categories\n* `callback` - _(optional)_ - a function callback that accepts two arguments - if omitted, the function will return a Promise\n  * `err` - populated with details in the event of an error\n  * `result` - result set details\n\nTo use it, it's as simple as the following example:\n\n```javascript\nvar\n  craigslist = require('node-craigslist'),\n  client = new craigslist.Client({\n    city : 'seattle'\n  });\n\nclient\n  .list()\n  .then((listings) => {\n    // play with listings here...\n    listings.forEach((listing) => console.log(listing));\n  })\n  .catch((err) => {\n    console.error(err);\n  });\n```\n\nExample response:\n\n```javascript\n[\n  {\n    pid: '1234567890',\n    category: 'video gaming - by owner',\n    date: 'Mar  1',\n    hasPic: true,\n    price: '250',\n    title: 'NEW &amp; UNSEALED XBOX 360 - 250 GB BLACK FRIDAY BUNDLE',\n    url: 'https://seattle.craigslist.org/see/vgm/4355583965.html'\n  },\n  /* results abbreviated */\n]\n```\n\n### #search\n\nThis method can be used to search Craigslist for specific postings.\n\n**Usage:** `client.search(options, query, callback)`\n\n* `options` - _(optional)_ - can be used to supply additional options - see [Options](#options) for details\n  * `city` - _(optional)_ - defines the city for the search (_NOTE: this field is required when city is not specified in the constructor_)\n  * `baseHost` - _(optional)_ - allows for specification of the base domain (defaults to `craiglist.org`) to support other countries (i.e. for Canada, `craigslist.ca`)\n  * `maxAsk` - _(optional)_ - maximum price\n  * `minAsk` - _(optional)_ - minimum price\n  * `category` - _(optional)_ - allows for specification of the category (defaults to `sss`) to search in other categories\n* `query` - _(required)_ - a string query to search with\n* `callback` - _(optional)_ - a function callback that accepts two arguments - if omitted, the function will return a Promise\n  * `err` - populated with details in the event of an error\n  * `result` - result set details\n\nTo use it, it's as simple as the following example:\n\n```javascript\nvar\n  craigslist = require('node-craigslist'),\n  client = new craigslist.Client({\n    city : 'seattle'\n  });\n\nclient\n  .search('xbox one')\n  .then((listings) => {\n    // play with listings here...\n    listings.forEach((listing) => console.log(listing));\n  })\n  .catch((err) => {\n    console.error(err);\n  });\n```\n\nIn order to search and filter by category and by price, check out the following example:\n\n```javascript\nvar\n  craigslist = require('node-craigslist'),\n  client = new craigslist.Client({\n    city : 'seattle'\n  }),\n  options = {\n    category : 'ppa',\n    maxAsk : '200',\n    minAsk : '100'\n  };\n\nclient\n  .search(options, 'xbox one')\n  .then((listings) => {\n    // filtered listings (by price)\n    listings.forEach((listing) => console.log(listing));\n  })\n  .catch((err) => {\n    console.error(err);\n  });\n```\n\nExample response:\n\n```javascript\n[\n  {\n    pid: '1234567890',\n    category: 'video gaming - by owner',\n    date: 'Mar  1',\n    hasPic: true,\n    price: '250',\n    title: 'NEW &amp; UNSEALED XBOX 360 - 250 GB BLACK FRIDAY BUNDLE',\n    url: 'https://seattle.craigslist.org/see/vgm/4355583965.html'\n  },\n  /* results abbreviated */\n]\n```\n\n### #details\n\nThis method can be used to grab additional information for a specified listing.\n\n**Usage:** `client.details(listing, callback)`\n\n* `listing` - _(required)_ - may be a listing object from a previous [#search](#search) or [#list](#list) call or a `string` URL to the specified posting\n* `callback` - _(optional)_ - a function callback that accepts two arguments - if omitted, the function will return a Promise\n  * `err` - populated with details in the event of an error\n  * `result` - result set details\n\nTo grab details for a listing, see the following example:\n\n```javascript\nvar\n  craigslist = require('node-craigslist'),\n  client = new craigslist.Client({\n    city : 'seattle'\n  });\n\nclient\n  .list()\n  .then((listings) => client.details(listings[0]))\n  .then((details) => {\n    console.log(details);\n  })\n  .catch((err) => {\n    console.error(err);\n  });\n```\n\nExample response (_NOTE: not all fields are populated if additional information is not found, including phone, contact name, email, images, postedAt and updatedAt_):\n\n```json\n{\n  \"description\": \"My setup that taught me everything from mixing to scratching. A pair of DJ Consoles by DENON, a 2 channel mixer by Numark, all power supplies and RCA cables included, + ROAD CASE with wheels. I spent just over $1600 on this setup almost 5 years ago. Would love to see the whole thing go as a package, you can have it for $400. Come play around with it before you buy and see how awesome the scratching aspect is! Feels like real 7\\'\\' records!\\n\\nIncluded:\\nPair of DENON DN-S3000\\'s\\nNumark DM1050 2 channel Mixer (+ Power Supply)\\nRoad Read case with wheels\\nRCA Cables for hook up\\n\\nHoller at me, email, call, or text.\\nCheers,\\nBro\",\n  \"mapUrl\": \"https://maps.google.com/maps/preview/@47.690237,-122.344437,16z\",\n  \"pid\": \"XXXXXXXXXX\",\n  \"replyUrl\": \"http://seattle.craigslist.org/reply/sea/msg/XXXXXXXXXX\",\n  \"title\": \"DJ Setup (DENONS + Mixer + Case)\",\n  \"url\": \"https://seattle.craigslist.org/see/msg/XXXXXXXXXX.html\",\n  \"postedAt\": \"2016-08-01T21:39:57.000Z\",\n  \"updatedAt\": \"2016-08-11T16:44:29.000Z\",\n  \"images\":\n   [ \"http://images.craigslist.org/XX404_ggud0ZU38XX_600x450.jpg\",\n     \"http://images.craigslist.org/XXP0P_h2cCxOdjCXX_600x450.jpg,\"\n     \"http://images.craigslist.org/XXm0m_khEDbKM7fXX_600x450.jpg\",\n     \"http://images.craigslist.org/XXZ0Z_c7xXA2eiCXX_600x450.jpg\",\n     \"http://images.craigslist.org/XXp0p_1jB0EqCaqXX_600x450.jpg\" ],\n  \"contactName\": \"Bro\",\n  \"phoneNumber\": \"(XXX) XXX-XXXX\",\n  \"email\": \"XXX-XXXX@XXXX.com\"\n}\n```\n\n### Options\n\nPer request, options can be modified to specify the following:\n* a different city than whatever is specified during initialization (`city` option)\n* a different country than whatever is specified during initialization (`baseHost` option)\n* min and max price ranges (`maxAsk` and `minAsk` options)\n* category (`category` option)\n\n```javascript\nvar\n  craigslist = require('node-craigslist'),\n  client = new craigslist.Client({\n    city : 'seattle'\n  }),\n  options = {\n    baseHost : '', // defaults to craigslist.org\n    category : '', // defaults to sss (all)\n    city : '',\n    maxAsk : '200',\n    minAsk : '100'\n  };\n\nclient\n  .search(options, 'xbox one')\n  .then((listings) => {\n    // listings (from Boston instead of Seattle)\n    listings.forEach((listing) => console.log(listing));\n  })\n  .catch((err) => {\n    console.error(err);\n  });\n```\n\n#### Categories\n\nThis list may change based on Craigslist updates, but at the time of v1.9, this is the current list:\n\n* sss = all\n* ata = antiques\n* ppa = appliances\n* ara = arts+crafts\n* sna = atvs/utvs/snow\n* pta = auto parts\n* baa = baby+kids\n* bar = barter\n* haa = beauty+hlth\n* bip = bike parts\n* bia = bikes\n* bpa = boat parts\n* boo = boats\n* bka = books\n* bfa = business\n* cta = cars+trucks\n* ema = cds/dvd/vhs\n* moa = cell phones\n* cla = clothes+acc\n* cba = collectibles\n* syp = computer parts\n* sya = computers\n* ela = electronics\n* gra = farm+garden\n* zip = free stuff\n* fua = furniture\n* gms = garage sales\n* foa = general\n* hva = heavy equipment\n* hsa = household\n* jwa = jewelry\n* maa = materials\n* mpa = motorcycle parts\n* mca = motorcycles\n* msa = music instr\n* pha = photo+video\n* rva = RVs\n* sga = sporting\n* tia = tickets\n* tla = tools\n* taa = toys+games\n* vga = video gaming\n* waa = wanted\n\n### Listing Object\n\nEach listing returned has several properties... see the example below:\n\n```javascript\n{ pid: '1234567890',\n  category: 'video gaming - by owner',\n  date: 'Mar  1',\n  hasPic: true,\n  price: '250',\n  title: 'NEW &amp; UNSEALED XBOX 360 - 250 GB BLACK FRIDAY BUNDLE',\n  url: 'https://seattle.craigslist.org/see/vgm/4355583965.html' }\n```\n","maintainers":[{"email":"akigupta131@gmail.com","name":"akigupta131"},{"email":"akigupta131@gmail.com","name":"akash131"}],"time":{"modified":"2022-04-04T12:28:16.275Z","created":"2017-06-03T15:59:42.771Z","1.1.1":"2017-06-03T15:59:42.771Z"},"homepage":"https://github.com/akigupta131/node-craigslist-scrap#readme","keywords":["craigslist","search"],"repository":{"type":"git","url":"git+ssh://git@github.com/akigupta131/node-craigslist-scrap.git"},"author":{"name":"Akash Deep Singhal","url":"http://github.com/akigupta131"},"bugs":{"url":"https://github.com/akigupta131/node-craigslist-scrap/issues"},"license":"MIT","readmeFilename":"readme.md"}