Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created December 4, 2015 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/ac0fc5e622966c54fbe0 to your computer and use it in GitHub Desktop.
Save chuck0523/ac0fc5e622966c54fbe0 to your computer and use it in GitHub Desktop.
def get
opts = {
depth_limit: 1
}
@lawson_oden = []
Anemone.crawl("http://www.lawson.co.jp/recommend/original/oden/", opts) do |anemone|
anemone.on_pages_like(/http:\/\/www.lawson.co.jp\/recommend\/original\/oden\//) do |page|
page.doc.xpath("/html//article[@id='oden']/section[@id='sec-02']/ul/li").each do |node|
item = node.xpath("./p[@class='ttl']/text()").to_s
price = node.xpath("./p[@class='price']/text()").to_s
@lawson_oden << Oden.new(item, price)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment