Created
July 7, 2016 15:44
-
-
Save cupnoodle/25326dd3d35c6a2d002e01ad84b9a7de to your computer and use it in GitHub Desktop.
Random legit user agent when web scraping
This file contains hidden or 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
agent = Mechanize.new | |
# randomly choose one user agent aside from Mechanize itself | |
agent.user_agent = Mechanize::AGENT_ALIASES[(Mechanize::AGENT_ALIASES.keys - ['Mechanize']).sample] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment