Skip to content
forked from rb2k/viddl-rb

An extendable commandline video downloader for flash video sites like vimeo, youtube, ...

Notifications You must be signed in to change notification settings

6farer/viddl-rb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

viddl-rb: Initially created by Marc Seeger (@rb2k)

Repo: http://github.com/rb2k/viddl-rb

Gem VersionBuild Status Dependency Status

Installation:

gem install viddl-rb

Usage:

Download a video: viddl-rb http://www.youtube.com/watch?v=QH2-TGUlwu4

Viddl-rb supports the following command line options:

-e, --extract-audio              Save video audio to file
-a, --abort-on-failure           Abort download queue if one of the videos fail to download
-u, --url-only                   Prints url without downloading
-t, --title-only                 Prints title without downloading
-f, --filter REGEX               Filters a video playlist according to the regex (Youtube only right now)
-s, --save-dir DIRECTORY         Specifies the directory where videos should be saved
-d, --downloader TOOL            Specifies the tool to download with. Supports 'wget', 'curl' and 'net-http'
-q, --quality QUALITY            Specifies the video format and resolution in the following way => resolution:extension (e.g. 720:mp4). Currently only supported by the Youtube plugin.
-h, --help                       Displays the help screen

Download a video and extract the audio: viddl-rb http://www.youtube.com/watch?v=QH2-TGUlwu4 --extract-audio

In both cases we'll name the output file according to the video title.

Setting the video save directory: viddl-rb http://vimeo.com/38372260 --save-dir C:/myvideos

The --save-dir option works with both absolute and relative paths (relative based on the directory viddl-rb is run from). If you want to save to a folder with spaces in it, you have to quote the path like this: --save-dir "C:/my videos"

Youtube plugin specifics:

Download all videos on a playlist: viddl-rb http://www.youtube.com/playlist?list=PL7E8DA0A515924126

Download all videos from a user: viddl-rb http://www.youtube.com/user/tedtalksdirector

Filter videos to download from a user/playlist: viddl-rb http://www.youtube.com/user/tedtalksdirector --filter /internet/i

The --filter argument accepts a regular expression and will only download videos where the title matches the regex. It uses the same syntax as Ruby regular expression literals do.

Library Usage:

require 'viddl-rb'

download_urls = ViddlRb.get_urls("http://www.youtube.com/watch?v=QH2-TGUlwu4")
download_urls.first     # => "http://o-o.preferred.arn06s04.v3.lscac ..."

The ViddlRb module has the following module public methods:

  • get_urls_names(url) -- Returns an array of one or more hashes that has the keys :url which points to the download url and :name which points to the name (which is a filename safe version of the video title with a file extension). Returns nil if the url is not recognized by any plugins.

  • get_urls_exts(url) -- Same as get_urls_names but with just the file extension (for example ".mp4") instead of the full filename, and the :name key is replaced with :ext. Returns nil if the url is not recognized by any plugins.

  • get_urls(url) -- Returns an array of download urls for the specified video url. Returns nil if the url is not recognized by any plugins.

  • get_names(url) -- Returns an array of filenames for the specified video url. Returns nil if the url is not recognized by any plugins.

  • io=(io_object) -- By default all plugin output to stdout will be suppressed when the library is used. If you are interested in the output of a plugin, you can set an IO object that will receive all plugin output using this method. For example:

require 'viddl-rb'

ViddlRb.io = $stdout     # plugins will now write their output to $stdout

All the get methods in the ViddlRb module will raise either a ViddlRb::PluginError or a ViddlRb::DownloadError if the plugin fails. A ViddlRb::PluginError is raised if the plugin fails in an unexpected way, and a ViddlRb::DownloadError is raised if the video could not be downloaded for some reason. An example of that is if a Youtube video is not embeddable - then it can't be downloaded.

begin
  ViddlRb.get_urls(video_url)
rescue ViddlRb::DownloadError => e
  puts "Could not get download url: #{e.message}"
rescue ViddlRb::PluginError => e
  puts "Plugin blew up! #{e.message}\n" +
       "Backtrace:\n#{e.backtrace.join("\n")}"
end

Requirements:

Co Maintainers:

  • kl: Windows support (who knew!), bug fixes, veoh plugin, metacafe plugin, refactoring it into a library, ...
  • farleyknight: Various small fixes and improvements

Contributors:

  • divout aka Ivan K: blip.tv plugin, bugfixes
  • Sniper: bugfixes
  • Serabe aka Sergio Arbeo: packaging viddl as a binary
  • laserlemon: Adding gemnasium images to readme

About

An extendable commandline video downloader for flash video sites like vimeo, youtube, ...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%