#!/usr/local/bin/ruby require 'open-uri' require "pp" require 'uri' #
¥160
#https://www.google.co.jp/search?site=&q=新宿~渋谷 電車 from = "渋谷" to = "新宿" url_before_escape = "https://www.google.co.jp/search?site=&q=#{from}~#{to} 電車" url = URI.escape(url_before_escape) url_before_decode = "https://www.chintai.net/list/?rt=3&wd=%E6%B8%8B%E8%B0%B7&sj=30&ks=4&tc=99&sf=0&st=0&k=1&h=99&j=&b=1&b=2&b=3&mode=1&ct=&tm=" url2 = puts URI.unescape(url_before_decode) pp url2