0

I am parsing a web page using nokogiri gem like the code below:

require 'open-uri'

url = 'https://www.google.com/' # example url
Nokogiri::HTML(URI.open(url))

# ... some other codes

I would like to use proxy with open-uri. I have looked through the documentation, but the example code is without using proxy.

How can I use proxy when using URI.open? I would appreciate any help with syntax explanation or some example code. Thank you!

Judy
  • 99
  • 1
  • 2
  • 8

1 Answers1

2

URI.open is designed to be an easy to use wrapper for Net::Http but I think you have at least a couple of options: