Ym4r is a useful gem that help us get geocode data with less code, but this is a problem when we frequently fetch the geocode data from Google Maps API, it will ban us then ask typing the captcha. In order to git rid of the API request limitation, we can use an anonymize proxy(Tor is great), or generate a lot of API keys for geocoding. Here this gem Ym4r-Anonymizer will help you fix the API request problem: 1. create ym4r_anonymizer.yml :proxy: :host: 127.0.0.1 :port: 8123 # :username: user # :password: pwd :google_api_keys: - ABQIAAAAzMUFFnT9uH0xq39J0Y4kbhTJQa0g3IQ9GZqIMmInSLzwtGDKaBR6j135zrztfTGVOm2QlWnkaidDIQ - ABQIAAAADJ6dxjPhPP3j4JMcarDN1RS3zpQkq3Dy2kJjwfk7zLSQDM4mqxRSmAnhPMLC-mwJSRi2Kd5iUlHW6w :yahoo_app_ids: - YellowMaps4R 2. code in your script require 'rubygems' require 'ym4r/anonymizer' Ym4r::Anonymizer.config = YAML.load_file(File.expand_path('../ym4r_anonymizer.yml', __FILE__)) Ym4r::Anonymizer.verbos = true Ym4r::GoogleMaps::Geocoding.get('Chengdu, Sichuan, China') Ym4r::GoogleMaps::Geocoding.get('Beijing, China') Ym4r::GoogleMaps::Geocoding.get('Chongqing, China') Ym4r::Anonymizer.config[:proxy] = nil Ym4r::GoogleMaps::Geocoding.get('Chengdu, Sichuan, China') Ym4r::GoogleMaps::Geocoding.get('Beijing, China') Ym4r::GoogleMaps::Geocoding.get('Chongqing, China')
Project
ym4r-anonymizer
An extension of Ym4r, allow us geocode address with proxy and automatically iterate API keys
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Development
Project Readme