npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

craigslist-searcher

v1.0.4

Published

The library helps users to search and parse the CraigsList.

Downloads

15

Readme

CraigsList-searcher

The library helps users to search and parse the CraigsList.

Build Status Coverage Status Codacy Badge

Version 1.0.2 does not have any breaking change. You can safely update it to the new version.

Installing

npm install craigslist-searcher --save

Usage

When you use ES6

Searching items from a giving city and category with a query keyword. If an item does not set a price, it will not be showed in the search result.

search function:

import { search } from 'craigslist-searcher';

//search function will return a promise with a result array
search({
  city: 'seattle', //City's name. Optional. If no city is given, the function will search worldwidely.
  query: 'computer', //Keword for the query. Using a white space to separate multiple key words. (e.g. 'computer book')  Optional.
  category: 'sss', //Category's keyword (Please see below). Optional.
  offset: 0 //The number of skipping itmes. Optional.
  }).then(resultArray => {
    console.log(resultArray);
    //resultArray will be an array that contains result data.
    /*It will be like [{
                        datetime: '',
                        url: '',
                        dataId: '',
                        title: '',
                        price: '',
                        region: ''
                      },
                      ...]
    */
  });

detail function: get detailed information from an items

import { detail } from 'craigslist-searcher';
// detail function takes a url that returns from search function as the parameter. Required.
detail('https://seattle.craigslist.org/oly/pts/d/car-truck-emblems/6562329918.html').then(result => {
  console.log(result);
  // The result is an object that contains item's detailed information.
  // The format will look like below:
  // {
  //   title: 'Item's title text,
  //   price: 'Item's price',
  //   location: 'Item's location',
  //   images: ['The first image url', 'The second image url', ...],
  //   latitude: 'Latitude', // Will return null if no latitude information
  //   longitude: 'Longitude', // Will return null if no longitude information
  //   accuracy: 'Location accuracy', // Will return null if no accuracy information
  //   googleMap: 'Google map's url', // Will return null if no Google map information
  //   description: 'Item's description',
  //   postedDate: 'Posted date and time',
  //   dataId: 'post id'
  // }
});

When you use ES5

var { search, detail } = require('craigslist-searcher');

// Same with the example above....

Categories' keyword list They may change in the future.

  • sss = all
  • ata = antiques
  • ppa = appliances
  • ara = arts+crafts
  • sna = atvs/utvs/snow
  • pta = auto parts
  • baa = baby+kids
  • bar = barter
  • haa = beauty+hlth
  • bip = bike parts
  • bia = bikes
  • bpa = boat parts
  • boo = boats
  • bka = books
  • bfa = business
  • cta = cars+trucks
  • ema = cds/dvd/vhs
  • moa = cell phones
  • cla = clothes+acc
  • cba = collectibles
  • syp = computer parts
  • sya = computers
  • ela = electronics
  • gra = farm+garden
  • zip = free stuff
  • fua = furniture
  • gms = garage sales
  • foa = general
  • hva = heavy equipment
  • hsa = household
  • jwa = jewelry
  • maa = materials
  • mpa = motorcycle parts
  • mca = motorcycles
  • msa = music instr
  • pha = photo+video
  • rva = RVs
  • sga = sporting
  • tia = tickets
  • tla = tools
  • taa = toys+games
  • vga = video gaming
  • waa = wanted

Existing bugs

Using both query and category parameter in search function will return null.

License

CraigsList-searcher is licensed under MIT License - see the License file.