Sha256: 90cda4590bfd0ccbf35e2c001f874171118f529d67442c6db55fcbc5fd6627c8
Contents?: true
Size: 575 Bytes
Versions: 1
Compression:
Stored size: 575 Bytes
Contents
class GeoScraper @@pattern << [/http:\/\/r\.gnavi\.co\.jp\/(\w+)\//, "Gnavi"] module Gnavi def scrape uri = "http://r.gnavi.co.jp/#{@matches[1]}/map/" doc = get_doc(uri) if figureCanvas = doc.xpath("//div[@id='figureCanvas']") value = figureCanvas[0].attributes["class"].value geo = value.split(" ").inject({}){|s, v| values = v.split(":") s[values[0]] = values[1] s } end { "longitude" => geo["lng"], "latitude" => geo["lat"] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
GeoScraper-0.0.1 | lib/GeoScraper/gnavi.rb |