이 사진이 네비게이터에 표시됩니다하지만 난 점점 오류를 유지 웹 브라우저에서 작동하는 링크를 열 수 없습니다 내가 가지고있는, 지금까지 루비 : 나는이 사이트 mangafox에서 사진을 얻기 위해 노력하고
루비
오순절require 'open-uri'
require 'pp'
def get_page(link)
page = nil
begin
page = open(link, 'User-Agent' => "Ruby/#{RUBY_VERSION}")
rescue Exception => e
puts e.class.to_s
puts e.message
end
return page
end
link = 'http://h.mfcdn.net/store/manga/9/14-116.0/compressed/Bleach-14-116[manga-rain]._manga_rain_bleach_ch116_01.jpg?token=24530ad3411b28ed7f5ef17f932e8713&ttl=1494853200'
# tried this after researching on internet because some characters are refused in links (such as '[' or ']')
link2 = link.gsub(/[\[\]]/) { '%%%s' % $&.ord.to_s(16) }.chomp
pp get_page(link)
pp get_page(link2)
하지만이 출력을 얻을 :
URI :: InvalidURIError
나쁜 URI가 (URI하지?) :이 시도 http://h.mfcdn.net/store/manga/9/14-116.0/compressed/Bleach-14-116[manga-rain]._manga_rain_bleach_ch116_01.jpg?token=24530ad3411b28ed7f5ef17f932e8713&ttl=1494853200
전무
OpenURI :: HTTPError
403 OpenURI가 핀치에 괜찮 사용
전무
. 오류 처리에 대한 설명서를 살펴야합니다. –