class Destinations::TravelDestinationsLists
Public Class Methods
puts_cities()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 35 def self.puts_cities self.scrape_cities.css(".marketing-article__header h1").each do |lists| puts lists.text end end
puts_countries()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 29 def self.puts_countries self.scrape_countries.css(".marketing-article__header h1").each do |lists| puts lists.text end end
puts_regions()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 41 def self.puts_regions self.scrape_regions.css(".marketing-article__header h1").each do |lists| puts lists.text end end
puts_value()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 48 def self.puts_value self.scrape_value.css(".marketing-article__header h1").each do |lists| puts lists.text end end
scrape_cities()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 16 def self.scrape_cities Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/cities")).css(".marketing-article") end
scrape_countries()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 12 def self.scrape_countries Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/countries")).css(".marketing-article") end
scrape_list()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 5 def self.scrape_list Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/")).css("a.js-page-navigation-spot span").each_with_index do |list, index| puts "#{index+1}. #{list.text}" end puts "5. List of All Destinations" end
scrape_regions()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 20 def self.scrape_regions Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/regions")).css(".marketing-article") end
scrape_value()
click to toggle source
# File lib/destinations/travel_destinations.rb, line 24 def self.scrape_value Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/value")).css(".marketing-article") end