Skip to content

Instantly share code, notes, and snippets.

@kalarani
Created June 18, 2012 12:50
Show Gist options
  • Save kalarani/2948232 to your computer and use it in GitHub Desktop.
Save kalarani/2948232 to your computer and use it in GitHub Desktop.
Define blocks to parse scrapify attribute
class Pmadurai
include Scrapify::Base
html "http://www.projectmadurai.org/pmworks.tscii.html"
attribute :name, xpath: "//table[@id = 'sortabletable']/tbody/tr/td[2]"
attribute :author, xpath: "//table[@id = 'sortabletable']/tbody/tr/td[3]"
attribute :urls, xpath: "//table[@id = 'sortabletable']/tbody/tr/td[7]" do |element|
element.children.map do |child|
child.xpath('@href').map(&:value)
end
end
end
key :name
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment