Skip to content

xiaohui-zhangxh/ym4r-anonymizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages