Hello I have an error message which is the following :
warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
I don't understand why there is this message, I also tried the URI.open ("link") command. Read
But I have to use Nokogiri.
Here is my code:
require 'nokogiri'
require 'open-uri'
puts "Wait a second data is coming..."
PAGE_URL = "https://coinmarketcap.com/all/views/all/"
page = Nokogiri::HTML(open(PAGE_URL))
currency_name_array = page.xpath("//tr/td/a[contains(@class, 'currency-name-container')]/text()").map {|x| x.to_s }
currency_value_array = page.xpath("//tr/td/a[contains(@class, 'price')]/text()").map {|x| x.to_s }
currency_result = Hash[currency_name_array.zip(currency_value_array)]
puts currency_result
Thanks in advance.