]>
gitweb.michael.orlitzky.com - dead/whatever-dl.git/blob - whatever-dl
c20b8bd7922e761c0bf553109381425f30830bee
3 # whatever-dl, a script to download online (web-based) videos.
5 # Copyright Michael Orlitzky
7 # http://michael.orlitzky.com/
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # http://www.fsf.org/licensing/licenses/gpl.html
22 # All of the website classes are located in one
23 # directory, so we can 'require' them automatically.
24 Dir
.glob('src/websites/*.rb').each
do |r
|
29 # Only actually do something if this script was called
30 # directly (i.e. not from the tests).
31 if (__FILE__
== $0) then
32 if (ARGV.length
< 1) then
33 # If the user didn't give us a URL, yell
35 puts
'Usage: whatever-dl <url>'
39 # Check the URL against each website's class.
40 # The class will know whether or not the URL
41 # "belongs" to its website.
45 Website
.subclasses
.each
do |w
|
46 if w
.owns_url
?(ARGV[0])
57 video_url
= site
.get_video_url(ARGV[0])
60 puts
'Error retrieving video URL.'
65 Kernel
.exec("wget \"#{video_url}\"")