Created
January 29, 2015 19:16
-
-
Save ridiculous/56d0032b8ae71871bdfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USER_AGENT_ALIASES = ['Windows Mozilla', 'Mac Safari', 'Mac FireFox', 'Mac Mozilla', 'Linux Mozilla', 'Linux Firefox'] | |
agent = Mechanize.new do |mech| | |
mech.open_timeout = 10 | |
mech.read_timeout = 10 | |
mech.follow_meta_refresh = true | |
mech.keep_alive = true | |
mech.max_history = 1 | |
mech.user_agent_alias = USER_AGENT_ALIASES.sample | |
end | |
agent.set_proxy(proxy_ip, proxy_port, AppConfig.http_proxy.username, AppConfig.http_proxy.password) | |
agent.get(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment