Skip to content

Instantly share code, notes, and snippets.

@fishman
Created December 19, 2014 13:41

Revisions

  1. Reza Jelveh created this gist Dec 19, 2014.
    26 changes: 26 additions & 0 deletions animeget
    Original 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