Created
December 19, 2014 13:41
Revisions
-
Reza Jelveh created this gist
Dec 19, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/usr/bin/env ruby require "net/http" # regexp = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix # regexp = /(https?:\/\/embed.vidwootcom([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/ regexp = /"(https?:\/\/[^"]*(?:vidwoot|mp4upload|vidbull|yourupload).*?)"/ if ARGV[0] uri = URI(ARGV[0]) res = Net::HTTP.get(uri) url = res.scan(regexp).first if ARGV[1] && ARGV[1] == 'play' exec "mpvx11 '#{url[0]}'" elsif ARGV[1] && ARGV[1] == 'info' puts url[0] else if ENV['DISPLAY'] `dunstify 'starting anime download'` end exec "mkdir -p ~/Movies/Anime ; cd ~/Movies/Anime ; quvi get '#{url[0]}'" if ENV['DISPLAY'] `dunstify 'download completed... i think'` end end end