Skip to content

Instantly share code, notes, and snippets.

View gresbtim's full-sized avatar
🚀
moon

Tim gresbtim

🚀
moon
View GitHub Profile
@cupnoodle
cupnoodle / mechanize_user_agent.rb
Created July 7, 2016 15:44
Random legit user agent when web scraping
agent = Mechanize.new
# randomly choose one user agent aside from Mechanize itself
agent.user_agent = Mechanize::AGENT_ALIASES[(Mechanize::AGENT_ALIASES.keys - ['Mechanize']).sample]