Created
December 19, 2014 13:41
-
-
Save fishman/0e0725000efc0e47f1a8 to your computer and use it in GitHub Desktop.
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 characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment