Skip to content

taylor/ypscaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yellow Page Scraper is a library for searching various online yellow pages
providers such as switchboard.com and superpages.com.

The search method returns an array of results or an empty list.  The minimum
required arguments are keyword, city, and state (passed in that order).  The
rest of the arguments should be passed as has options 

  :provider => :switchboard
  :num_results => 10
  :num_results => :all

Currently only supports switchboard fully.  Superpages (:superpages) and
yellowpages.com (:yellowpages) are on the way.

Each result has at least the name set.  Anything missing will be set to nil.
Here is the entire list of possible data found (accessed via result.<data name>):

  url - website (often not found or some search url for the provider)
  name - business name or person's name
  phone - main phone number (sometimes they have additional numbers.  currently not getting those)
  address - main address
  city
  state
  zip - usually not there
  email
  provider - which provider was used to find the data

== Usage

    require 'ypscraper'
    yp = YPScraper.new(:switchboard)

    # See how many entires are on the first page
    print "Number of results for first page when searching dentist in austin, tx is " + 
      yp.search("dentist", "austin", "tx").size.to_s
    puts

    # Get 1st 3 yellow page entries
    results = yp.search("dentist", "austin", "tx" , :num_results=>3)
    results.each_with_index do |r,i|
      puts "#{i} - #{r.name} / #{r.url} / #{r.address} / #{r.url}"
    end


    # Get all entries for a search
    results = yp.search("Periodontics Dentists", "austin", "tx" , :num_results=>:all)
    results.each_with_index do |r,i|
      puts "#{i} - #{r.name} / #{r.url} / #{r.address} / #{r.url}"
    end

== License

Copyright (c) 2009 Taylor Carpenter <taylor@codecafe.com>

You may use, copy and redistribute this library under the same terms as
{Ruby itself}[http://www.ruby-lang.org/en/LICENSE.txt] or under the 
{MIT license}[http://mocha.rubyforge.org/files/MIT-LICENSE.html].

About

Yellow Page Scraper - search the yellow pages via various online sites

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages