Advertisement
agunq

autodl.rb

Apr 21st, 2019
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.75 KB | None | 0 0
  1. #auto direct link
  2. #file: autodl.rb
  3. #support mp4upload.com, uppit.com, clicknupload.org, racaty.com
  4. #author: agunq
  5. #chatango: agunq.chatango.com
  6. #email: idk lol :v
  7. #last test: April 21, 2019
  8.  
  9. require 'net/http'
  10. require 'net/https'
  11. require 'json'
  12. require 'uri'
  13.  
  14. class AutoDl
  15.     def getDirect(url)
  16.         uri = URI(url)
  17.         value = {
  18.             "op" =>"download2",
  19.             "id" => uri.path.split("/")[1],
  20.             "rand" => "",
  21.             "referer" => "",
  22.             "method_free" => "",
  23.             "method_premium" => ""
  24.             }
  25.         req = Net::HTTP::Post.new(uri)
  26.         req.set_form_data(value)
  27.         http = Net::HTTP.new(uri.host, uri.port)
  28.         if uri.scheme == "https"
  29.             http.use_ssl = true
  30.             http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  31.         end
  32.         response = http.request(req)
  33.         if uri.host == "uppit.com"
  34.             link = response.body.match(/<meta HTTP-EQUIV=\"REFRESH\" content=\"3; url=(.*?)\">/)
  35.            if link
  36.                link = link.captures[0]
  37.                end
  38.        elsif uri.host == "clicknupload.org"
  39.            link = response.body.match(/<button id=\"downloadbtn\" class=\"downloadbtn\" href=\"javascript:void\(0\);\" onClick=\"window.open\(\'(.*?)\'\);\"><span><i class=\"fas fa-external-link-alt\"><\/i> Click to Start Download<\/span><\/button>/)
  40.            if link
  41.                link = link.captures[0]
  42.            end
  43.        else
  44.            link = response.to_hash
  45.            if link.keys.include?("location")
  46.                link = link["location"]
  47.            else
  48.                link = ""
  49.            end
  50.        end
  51.        return link
  52.    end
  53. end    
  54.  
  55. #puts AutoDl.new.getDirect('https://clicknupload.org/5rro880uhnyg')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement