Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # encoding: utf-8
- # https://www.meteoservice.ru/content/export.html
- require 'net/http'
- require 'uri'
- require 'rexml/document'
- require 'mechanize'
- require 'json'
- #require_relative "../../lib/decoder.rb"
- agent = Mechanize.new()
- town = "Москва"
- page = agent.get("https://www.meteoservice.ru/location/cities.html?country_id=1")
- city_list_str = page.search("body").text
- city_list = JSON.parse(city_list_str)
- puts city_list['181']
- el = city_list.select{|key, hash| hash["name"] == town}
- puts el
- puts el.values[0]["point"]
Advertisement
Add Comment
Please, Sign In to add comment