Skip to content

Instantly share code, notes, and snippets.

@neurotech
Created March 2, 2013 13:39
Show Gist options
  • Select an option

  • Save neurotech/5071025 to your computer and use it in GitHub Desktop.

Select an option

Save neurotech/5071025 to your computer and use it in GitHub Desktop.
require "viddl-rb"
ViddlRb.io = $stdout
Shoes.app :title => 'Viddl', :width => 300, :height => 150, :margin => 10, :resizable => false do
stack do
para "Enter Video URL:"
edit_line do |e|
@url = e.text
end
button "Save to..." do
destination = ask_open_folder
end
end
button "Download!" do
begin
ViddlRb.get_urls(@url)
rescue ViddlRb::DownloadError => e
alert "Could not get download url: #{e.message}"
rescue ViddlRb::PluginError => e
alert "Plugin blew up! #{e.message}\n" + "Backtrace:\n#{e.backtrace.join("\n")}"
end
end
end
@rb2k
Copy link
Copy Markdown

rb2k commented Mar 2, 2013

You MIGHT run into problems trying to download this yourself.
Some providers expect certain User-Agents when downloading (and youtube needs a few retries sometimes).

You can certainly give the shoes downloader a try, but depending on what you try to do in the end, shelling out to viddl-rb might not be the worst thing.
The "library"-functionality of viddl-rb is more of an afterthought :)

@neurotech
Copy link
Copy Markdown
Author

This is mainly a personal "hobby" program to make it easy to get YouTube videos as audio files.

Is it possible to call the CLI for viddl-rb from ruby?

@rb2k
Copy link
Copy Markdown

rb2k commented Mar 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment