Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Scraping newspapers names from kiosko
require 'open-uri'
require 'nokogiri'
home_page = Nokogiri::HTML(open(''))
countries = {}
cities = {}
newspapers = []
home_page.css("#menu a").each do |a|
puts countries[a.content] = "" + a.attributes["href"].value
#links << a.attributes["href"].value
countries_newspapaer = {}
countries.each do |value, key|
country_page = Nokogiri::HTML(open(key))
country_page.css(".line li a img").each do |img|
puts img.attributes["alt"].value
countries_newspapaer[value] = img.attributes["alt"].value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment