Project

scrapie

0.0
No commit activity in last 3 years
No release in over 3 years
Scrapie is a tool that allows you to really simply and quickly fab up a class that translates CSS selectors into attributes, and lets you specify your own translations on query params.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.6.4
>= 0
>= 0

Runtime

 Project Readme

scrapie¶ ↑

Hey, it’s Scrapie! It’s 2011, we should be able to scrape sites for their juicy data in a delicious fashion instead of having to hack something together every time.

It’s basically a tool that allows you to really simply and quickly fab up a class that translates CSS selectors into attributes, and lets you specify your own translations on query params.

Example¶ ↑

class Airplane < Scrapie
  url 'http://registry.faa.gov/aircraftinquiry/NNum_Results.aspx'
  params({
    :n_number => 'NNumbertxt'
  })
  attributes({
    'serial_number' => 'div#serial_number',
    'classname' => '.class_name'
  })
  before_fetch do |agent|
    # Do stuff with my agent, like log in or hax the gibson
  end
  after_fetch do |agent|
    # Do more neatu stuff with my agent
  end

  # Other posisbilities
  method :get
  agent_options { :options_to_send_to_my_new_mechanize_agent => 'BE COOL MAN' }
end

a = Airplane.find(:n_number => '12345') # => Fetches http://registry.faa.gov/aircraftinquiry/NNum_Results.aspx?NNumbertxt=12345
a.serial_number = 'a cool serial number'

Todo¶ ↑

  • Set up the callbacks

  • Programmatically specify a valid record vs. invalid.

  • Sanitize

  • Refactor

Contributing to scrapie¶ ↑

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Adrian Pike. See LICENSE.txt for further details.