require 'mechanize' agent = Mechanize.new agent.user_agent = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)' url = 'http://www.tele.soumu.go.jp/musen/SearchServlet?SK=2&DC=100&SC=1&pageID=3&CONFIRM=0&SelectID=1&SelectOW=01' page = agent.get(url) next_page = page.form_with(:name => 'select_condition') do |form| form.MA = 'JA1YRL' end.submit print next_page.css('form[name="result"] td')[8].text
% ruby mechanize.rb 東京都豊島区
You put a call sign, and get the QTH of the station. Unfortunately, if the call sign is a shorter one, like JA1RL, the code here does not work, because the site will give you all the QTHs for JA1RL*.