Skip to content

Instantly share code, notes, and snippets.

@fishman
Created December 19, 2014 13:41
Show Gist options
  • Save fishman/0e0725000efc0e47f1a8 to your computer and use it in GitHub Desktop.
Save fishman/0e0725000efc0e47f1a8 to your computer and use it in GitHub Desktop.
#!/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