Skip to content

Instantly share code, notes, and snippets.

@marcomontes
Created April 8, 2013 15:38
Show Gist options
  • Save marcomontes/771071c9a9944e9b1d28 to your computer and use it in GitHub Desktop.
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
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