ruby に 404 エラーをエスケープ/バイパスさせようとしていますが、うまくいかないようです。これまでの私のコードは次のとおりです。
require 'rubygems'
require 'simple_oauth'
require 'cloudsight'
require 'rubygems'
require 'net/http'
require 'uri'
require 'json'
require 'open-uri'
require 'openssl'
require 'hpricot'
require 'nokogiri'
#T FILE TO JPG
webby = 'https://t.co/5h92pCmoPM'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
doc = Hpricot(open(webby)).to_s
jpgstart = '<meta property=\"og:image\" content=\"'
jpgstop = '" />'
jpglink = doc[/#{jpgstart}(.*?)#{jpgstop}/m, 1]
print jpglink
これは私が得るエラーです:
C:/Users/User/Desktop/test89:18: warning: already initialized constant OpenSSL::SSL::VERIFY_PEER
C:/Ruby21/lib/ruby/2.1.0/open-uri.rb:353:in `open_http': 404 NOT FOUND (OpenURI::HTTPError)
from C:/Ruby21/lib/ruby/2.1.0/open-uri.rb:724:in `buffer_open'
from C:/Ruby21/lib/ruby/2.1.0/open-uri.rb:210:in `block in open_loop'
from C:/Ruby21/lib/ruby/2.1.0/open-uri.rb:208:in `catch'
from C:/Ruby21/lib/ruby/2.1.0/open-uri.rb:208:in `open_loop'
from C:/Ruby21/lib/ruby/2.1.0/open-uri.rb:149:in `open_uri'
from C:/Ruby21/lib/ruby/2.1.0/open-uri.rb:704:in `open'
from C:/Ruby21/lib/ruby/2.1.0/open-uri.rb:34:in `open'
from C:/Users/KVadher/Desktop/test89:20:in `<main>'
[Finished in 2.7s with exit code 1]
エラーを回避する方法を知っている人はいますか?