Skip to content

A plugin useful for aggregating Craigslist postings, worldwide. Originally written to collect "internet engineer" jobs specifically for Ruby on Rails telecommuting.

License

Notifications You must be signed in to change notification settings

uid0/craigslist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Craigslist Plugin

A plugin useful for aggregating Craigslist postings, worldwide. Originally written to collect “internet engineer” jobs specifically for Ruby on Rails telecommuting.

Setup

Requirements:

Rails 3.x

Create the craigslist_postings table

rails generate craigslist

Migrate

rake db:migrate

Usage

Instantiate a Craigslist::Parser object, and call get_postings

parser = Craigslist::Parser.new
postings = parser.get_postings

Rails Usage

The Craigslist::Parser::get_postings method is a long operation. We recommend installing Tobi’s delayed_job gem, so your user’s don’t wait for 10 minutes. After all, you are searching through craigslist worldwide!

Then subclass the Craigslist::Parser model in RAILS_ROOT/app/models/my_parser.rb

class MyParser < Craigslist::Parser
  handle_asynchronously :get_postings

  def before_get_postings
    puts ">>> BEFORE_GET"
    # Code here gets executed BEFORE "get_postings" is called
  end

  def after_get_postings
    puts ">>> AFTER_GET"
    # Code here gets executed AFTER "get_postings" is called
  end
end

Other Types of Postings

If you want to aggregate other types of jobs you’ll need to pass in the :search_path. For example, let’s say you want to look for “systems / network” contract jobs and search for “linux” within that category.

parser = Craigslist::Parser.new(:search_path => "/search/sad?query=linux&srchType=A&addTwo=contract&format=rss")

In the above search_path we dissect:

  • “sad” for the job type “systems / network”

  • “query=linux” for the search term

  • “addTwo=contract” for contracting jobs only

The way you determine the search_path parameters is to go to a state or area specific craigslist page and walk through a manual HTML search first. After you perform a manual search using the form, take note of the URL in the address bar. Just copy everything from “/search” to the end of the query string, and use that as your “search_path” passed into the Craigslist::Parser.

Updates

Fork it, tweak it, check it in and send me a pull request. I’ll merge it if it makes sense.

We hope someone finds it useful.

Copyright © 2011 Midwire Technologies, LLC, released under the MIT license

About

A plugin useful for aggregating Craigslist postings, worldwide. Originally written to collect "internet engineer" jobs specifically for Ruby on Rails telecommuting.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published