Created
April 8, 2013 15:38
-
-
Save marcomontes/771071c9a9944e9b1d28 to your computer and use it in GitHub Desktop.
Nokogiri para extraer las frases de la página frasesde.org frases ordenadas por categorias
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
require 'nokogiri' | |
require 'open-uri' | |
page = 'http://www.frasesde.org/' | |
doc = Nokogiri::HTML(open("#{page}")) | |
doc.css('a').each do |link| | |
tema = Nokogiri::HTML(open("#{page}#{link['href']}")) | |
puts "\n\n=== #{link.content} === \n\n" | |
tema.css('li').each do |frase| | |
puts frase.content | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment