Created
April 15, 2013 14:52
-
-
Save ackintosh/5388678 to your computer and use it in GitHub Desktop.
get title, keywords, description using Anemone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
require 'anemone' | |
Anemone.crawl('http://www.example.jp') do |anemone| | |
anemone.on_every_page do |page| | |
puts page.url | |
puts page.doc.xpath('//head/title/text()').first.to_s if page.doc | |
puts page.doc.xpath("//meta[@name='keywords']/@content") if page.doc | |
puts page.doc.xpath("//meta[@name='description']/@content") if page.doc | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment