Skip to content

Instantly share code, notes, and snippets.

@lfzawacki
Created August 19, 2013 16:07
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 lfzawacki/6270826 to your computer and use it in GitHub Desktop.
Save lfzawacki/6270826 to your computer and use it in GitHub Desktop.
Get title from a lot of links
#/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