17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/scraper.rb', line 17
def self.scraper_detailled_info(url)
details = Nokogiri::HTML(open(url))
prices = details.css("div.carousel__scrollContainer___hDjMb")
array_of_prices_info = details.css("div.carousel__scrollContainer___hDjMb").css("div.GasPriceCollection__fuelTypePriceSection___3iGR-")
new_array = array_of_prices_info.collect do |price|
type_of_gas = price.css("span").first.text
price_of_gas = price.css("span")[price.css("span").index(price.css("span").first) + 1 ].text
last_report = price.css("p").text
{:type_of_gas => type_of_gas, :price_of_gas => price_of_gas, :last_report => last_report}
end
rating = details.css("div.Reviews__reviewComponentContainer___3Njgz").css("div.panel__panel___3Q2zW.panel__white___19KTz.colors__bgWhite___1stjL.panel__bordered___1Xe-S.panel__rounded___2etNE").css("span").first.text
{new_array:new_array,rating:rating}
end
|