Created
August 19, 2013 16:07
-
-
Save lfzawacki/6270826 to your computer and use it in GitHub Desktop.
Get title from a lot of links
This file contains 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
#/usr/bin/ruby | |
require 'open-uri' | |
require 'nokogiri' | |
links = IO.read('links.txt').split("\n") | |
links.each do |link| | |
f = open(link) | |
doc = Nokogiri::HTML(f) | |
title = doc.xpath('//html/head/title') | |
title = /(.*?) - www.soldafria.com.br/.match(title.text) | |
title = title[1] | |
puts title | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment