Skip to content

Instantly share code, notes, and snippets.

@ackintosh
Created April 15, 2013 14:52
Show Gist options
  • Save ackintosh/5388678 to your computer and use it in GitHub Desktop.
Save ackintosh/5388678 to your computer and use it in GitHub Desktop.
get title, keywords, description using Anemone.
# -*- 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