craigslist-utils

0.0.7 • Public • Published

craigslist-utils

Nodejs utilities for scraping/crawling/working with craigslist

lookup_city(subdomain, area_code)

Lookup a city and optionally a neighborhood's information on craigslist by the city's subdomain, and the three letter representation of the neighborhood.

cl.lookup_city("seattle", "tac")

 > { city: 'seattle-tacoma',
 >   subdomain: 'seattle',
 >   state: 'Washington',
 >   continent: 'US',
 >   areas: 
 >   [ { name: 'seattle', path: 'see' },
 >     { name: 'eastside', path: 'est' },
 >     { name: 'snohomish co', path: 'sno' },
 >     { name: 'kitsap co', path: 'kit' },
 >     { name: 'tacoma', path: 'tac' },
 >     { name: 'olympia', path: 'oly' },
 >     { name: 'south king', path: 'skc' } ],
 >   area_name: 'tacoma',
 >   area_path: 'tac' });

lookup_category(code)

Lookup the category and subcategory name given it's three-letter code.

cl.lookup_category('muc');

 > {code: 'muc',
 >  name: 'musicians',
 >  parent: {code: 'ccc',
 >    name: 'community'}});

lookup_discussion_forum(id)

Lookup a discussion form name given it's numerical ID

lookup_discussion_forum(3232)

 > {name: "apple",
 >  id: "3232",
 >  path: "/forums/?forumID=3232"}

get_url(subdomain, cat_code, sub_area_code, options)

Returns the url on craigslist corresponding to the given subdomain, category code, and optionally the code for the sub-location (ie for seattle's eastside neighborhood subdomain would be 'seattle', and sub_area_code would be 'est').

get_posts(next, subdomain, cat_code, sub_area_code, options)

call next() with a list of posts scraped from the url in the format:

  { coords: { latitude: '47.235087', longitude: '-122.351711' },
    pid: '4277229725',
    href: 'http://seattlecraigslist.org/tac/apa/4277229725.html',
    title: '2 Bedroom/ 1 Bath, Includes W/D, Extra Storage Room, Free Carport',
    date: Tue Dec 31 2013 00:00:00 GMT-0800 (PST),
    price: '785',
    location: 'Fife WA' } ]

all_cities(continent)

Return a list of a cities, optionally matching a specific country/continent

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.7
    2
    • latest

Version History

Package Sidebar

Install

npm i craigslist-utils

Weekly Downloads

1

Version

0.0.7

License

MIT

Last publish

Collaborators

  • davidkarn