Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'net/http'
- require 'net/https'
- path = "https://2ch.hk/pr/res/380039.html"
- uri = URI(path)
- http = Net::HTTP.new(uri.host, uri.port)
- http.use_ssl = true
- def get_cookie(header)
- header.slice(0, header.index(";"))
- end
- res = http.get(uri.path)
- cfduid = get_cookie res["set-cookie"]
- wtf_is_this_url = "https://2ch.hk/cdn-cgi/l/chk_jschl?jschl_vc=cb51d68ec5e478745fa6617e6c5ac683&jschl_answer=314"
- res = http.get(wtf_is_this_url, { "cookie" => cfduid })
- cf_clearance = get_cookie res["set-cookie"]
- res = http.get(path, { "cookie" => "#{cfduid}; #{cf_clearance}" })
- p res # <Net::HTTPOK 200 OK readbody=true>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement