viddl-rb 0.92 → 0.93
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/plugins/vimeo.rb +20 -14
- data/plugins/youtube.rb +37 -15
- metadata +16 -15
- data/Gemfile.lock +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fb50f14d1549e3f6db7dd502c8fc912f3d55f27
|
4
|
+
data.tar.gz: 0a4dcc19bb0d2fc17f28722041aa7ea930c2b6a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99fd447ea4287875aca446e1e8fad11cd56d9f2a899d1fa06c53dd964247a8c90c6227e9e0ac8508ddde2af3be4e082abbf85d5ff771dc793ce87c76c84f1073
|
7
|
+
data.tar.gz: 30f6225573ac116c54c04f090b296ffc4eaca2c0f06569d268f3e6834e4315235f775985a95fc1f517c6758b375a3e2748d0825459c44968d0fe06f874ae937c
|
data/plugins/vimeo.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
|
1
2
|
class Vimeo < PluginBase
|
3
|
+
|
2
4
|
#this will be called by the main app to check whether this plugin is responsible for the url passed
|
3
5
|
def self.matches_provider?(url)
|
4
6
|
url.include?("vimeo.com")
|
@@ -8,25 +10,29 @@ class Vimeo < PluginBase
|
|
8
10
|
#the vimeo ID consists of 7 decimal numbers in the URL
|
9
11
|
vimeo_id = url[/\d{7,8}/]
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
video_url = "http://player.vimeo.com/v2/video/#{vimeo_id}"
|
14
|
+
video_page = open(video_url).read
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
doc = Nokogiri::HTML(page_html)
|
17
|
-
title = doc.at('meta[property="og:title"]').attributes['content'].value
|
18
|
-
puts "[VIMEO] Title: #{title.inspect}"
|
16
|
+
info_json = video_page[/a=(\{.+?);/, 1]
|
17
|
+
parsed = MultiJson.load(info_json)
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
signature = page_html[/"signature":"([\d\w]+)",/, 1]
|
19
|
+
files = parsed["request"]["files"]
|
20
|
+
codecs = files["codecs"]
|
23
21
|
|
24
|
-
|
22
|
+
unless codecs.include?("h264")
|
23
|
+
raise CouldNotDownloadVideoError, "Unexpected codecs: #{codecs.inspect}\n" +
|
24
|
+
"Please report this bug at github.com/rb2k/viddl-rb so it can be fixed!"
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
h264 = files["h264"]
|
28
|
+
quality = ["hd", "sd"].find { |q| h264.keys.include?(q) }
|
29
|
+
quality = h264.keys.first if quality.nil?
|
30
|
+
|
31
|
+
download_url = h264[quality]["url"]
|
32
|
+
extension = download_url[/.+?(\.[\w\d]+?)\?/, 1]
|
33
|
+
file_name = PluginBase.make_filename_safe(parsed["video"]["title"]) + extension
|
29
34
|
|
30
35
|
[{:url => download_url, :name => file_name}]
|
31
36
|
end
|
32
37
|
end
|
38
|
+
|
data/plugins/youtube.rb
CHANGED
@@ -5,21 +5,43 @@ class Youtube < PluginBase
|
|
5
5
|
# see http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs
|
6
6
|
# TODO: we don't have all the formats from the wiki article here
|
7
7
|
VIDEO_FORMATS = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
8
|
+
"38" => {:extension => "mp4", :name => "MP4 Highest Quality 4096x3027 (H.264, AAC)"},
|
9
|
+
"37" => {:extension => "mp4", :name => "MP4 Highest Quality 1920x1080 (H.264, AAC)"},
|
10
|
+
"22" => {:extension => "mp4", :name => "MP4 1280x720 (H.264, AAC)"},
|
11
|
+
"46" => {:extension => "webm", :name => "WebM 1920x1080 (VP8, Vorbis)"},
|
12
|
+
"45" => {:extension => "webm", :name => "WebM 1280x720 (VP8, Vorbis)"},
|
13
|
+
"44" => {:extension => "webm", :name => "WebM 854x480 (VP8, Vorbis)"},
|
14
|
+
"43" => {:extension => "webm", :name => "WebM 480x360 (VP8, Vorbis)"},
|
15
|
+
"18" => {:extension => "mp4", :name => "MP4 640x360 (H.264, AAC)"},
|
16
|
+
"35" => {:extension => "flv", :name => "FLV 854x480 (H.264, AAC)"},
|
17
|
+
"34" => {:extension => "flv", :name => "FLV 640x360 (H.264, AAC)"},
|
18
|
+
"6" => {:extension => "flv", :name => "FLV 640x360 (Soerenson H.263)"},
|
19
|
+
"5" => {:extension => "flv", :name => "FLV 400x240 (Soerenson H.263)"},
|
20
|
+
"36" => {:extension => "3gp", :name => "3gp Medium Quality - 320x240 (MPEG-4 Visual, AAC)"},
|
21
|
+
"17" => {:extension => "3gp", :name => "3gp Medium Quality - 176x144 (MPEG-4 Visual, AAC)"},
|
22
|
+
"13" => {:extension => "3gp", :name => "3gp Low Quality - 176x144 (MPEG-4 Visual, AAC)"},
|
23
|
+
"82" => {:extension => "mp4", :name => "MP4 360p (H.264 AAC)"},
|
24
|
+
"83" => {:extension => "mp4", :name => "MP4 240p (H.264 AAC)"},
|
25
|
+
"84" => {:extension => "mp4", :name => "MP4 720p (H.264 AAC)"},
|
26
|
+
"85" => {:extension => "mp4", :name => "MP4 520p (H.264 AAC)"},
|
27
|
+
"100" => {:extension => "webm", :name => "WebM 360p (VP8 Vorbis)"},
|
28
|
+
"101" => {:extension => "webm", :name => "WebM 360p (VP8 Vorbis)"},
|
29
|
+
"102" => {:extension => "webm", :name => "WebM 720p (VP8 Vorbis)"},
|
30
|
+
"120" => {:extension => "flv", :name => "FLV 720p (H.264 AAC)"},
|
31
|
+
"133" => {:extension => "mp4", :name => "MP4 240p (H.264)"},
|
32
|
+
"134" => {:extension => "mp4", :name => "MP4 360p (H.264)"},
|
33
|
+
"135" => {:extension => "mp4", :name => "MP4 480p (H.264)"},
|
34
|
+
"136" => {:extension => "mp4", :name => "MP4 720p (H.264)"},
|
35
|
+
"137" => {:extension => "mp4", :name => "MP4 1080p (H.264)"},
|
36
|
+
"139" => {:extension => "mp4", :name => "MP4 (AAC)"},
|
37
|
+
"140" => {:extension => "mp4", :name => "MP4 (AAC"},
|
38
|
+
"141" => {:extension => "mp4", :name => "MP4 (AAC)"},
|
39
|
+
"160" => {:extension => "mp4", :name => "MP4 (H.264)"},
|
40
|
+
"171" => {:extension => "webm", :name => "WebM (Vorbis)"},
|
41
|
+
"172" => {:extension => "webm", :name => "WebM (Vorbis)"}
|
20
42
|
}
|
21
43
|
|
22
|
-
DEFAULT_FORMAT_ORDER = %w[38 37 22 46 45 44 43 18 35 34 5 17]
|
44
|
+
DEFAULT_FORMAT_ORDER = %w[38 37 22 46 45 44 43 18 35 34 6 5 36 17 13 82 83 84 85 100 101 102 120 133 134 135 136 137 139 140 141 160 171 172]
|
23
45
|
VIDEO_INFO_URL = "http://www.youtube.com/get_video_info?video_id="
|
24
46
|
VIDEO_INFO_PARMS = "&ps=default&eurl=&gl=US&hl=en"
|
25
47
|
|
@@ -146,9 +168,9 @@ class Youtube < PluginBase
|
|
146
168
|
|
147
169
|
if @quality #if the user specified a format
|
148
170
|
ext = @quality[:extension]
|
149
|
-
res = @quality[:resolution]
|
171
|
+
res = @quality[:resolution] || ""
|
150
172
|
#gets a nested array with all the formats of the same res as the user wanted
|
151
|
-
requested = VIDEO_FORMATS.select { |id, format| format[:name].include?(res) }.to_a
|
173
|
+
requested = VIDEO_FORMATS.select { |id, format| available_formats.include?(id) && format[:name].include?(res) }.to_a
|
152
174
|
|
153
175
|
if requested.empty?
|
154
176
|
Youtube.notify "Requested format \"#{res}:#{ext}\" not found. Downloading default format."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viddl-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.93"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Seeger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2014-01-21 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mime-types
|
@@ -36,26 +36,28 @@ dependencies:
|
|
36
36
|
prerelease: false
|
37
37
|
requirement: &id003 !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
-
|
40
|
-
- ">="
|
39
|
+
- - "="
|
41
40
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
41
|
+
version: 2.7.2
|
43
42
|
type: :runtime
|
44
43
|
version_requirements: *id003
|
45
44
|
- !ruby/object:Gem::Dependency
|
46
45
|
name: progressbar
|
47
46
|
prerelease: false
|
48
|
-
requirement: &
|
47
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
49
48
|
requirements:
|
50
|
-
-
|
49
|
+
- &id005
|
50
|
+
- ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
51
53
|
type: :runtime
|
52
|
-
version_requirements: *
|
54
|
+
version_requirements: *id004
|
53
55
|
- !ruby/object:Gem::Dependency
|
54
56
|
name: multi_json
|
55
57
|
prerelease: false
|
56
58
|
requirement: &id006 !ruby/object:Gem::Requirement
|
57
59
|
requirements:
|
58
|
-
- *
|
60
|
+
- *id005
|
59
61
|
type: :runtime
|
60
62
|
version_requirements: *id006
|
61
63
|
- !ruby/object:Gem::Dependency
|
@@ -63,7 +65,7 @@ dependencies:
|
|
63
65
|
prerelease: false
|
64
66
|
requirement: &id007 !ruby/object:Gem::Requirement
|
65
67
|
requirements:
|
66
|
-
- *
|
68
|
+
- *id005
|
67
69
|
type: :development
|
68
70
|
version_requirements: *id007
|
69
71
|
- !ruby/object:Gem::Dependency
|
@@ -71,7 +73,7 @@ dependencies:
|
|
71
73
|
prerelease: false
|
72
74
|
requirement: &id008 !ruby/object:Gem::Requirement
|
73
75
|
requirements:
|
74
|
-
- *
|
76
|
+
- *id005
|
75
77
|
type: :development
|
76
78
|
version_requirements: *id008
|
77
79
|
- !ruby/object:Gem::Dependency
|
@@ -79,7 +81,7 @@ dependencies:
|
|
79
81
|
prerelease: false
|
80
82
|
requirement: &id009 !ruby/object:Gem::Requirement
|
81
83
|
requirements:
|
82
|
-
- *
|
84
|
+
- *id005
|
83
85
|
type: :development
|
84
86
|
version_requirements: *id009
|
85
87
|
description: An extendable commandline video downloader for flash video sites. Includes plugins for vimeo, youtube, dailymotion and more
|
@@ -109,7 +111,6 @@ files:
|
|
109
111
|
- plugins/vimeo.rb
|
110
112
|
- plugins/youtube.rb
|
111
113
|
- Gemfile
|
112
|
-
- Gemfile.lock
|
113
114
|
- Rakefile
|
114
115
|
- README.md
|
115
116
|
homepage: https://github.com/rb2k/viddl-rb
|
@@ -124,7 +125,7 @@ require_paths:
|
|
124
125
|
- lib
|
125
126
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
127
|
requirements:
|
127
|
-
- *
|
128
|
+
- *id005
|
128
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
130
|
requirements:
|
130
131
|
- - ">="
|
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
134
|
requirements: []
|
134
135
|
|
135
136
|
rubyforge_project: viddl-rb
|
136
|
-
rubygems_version: 2.0.
|
137
|
+
rubygems_version: 2.0.14
|
137
138
|
signing_key:
|
138
139
|
specification_version: 4
|
139
140
|
summary: An extendable commandline video downloader for flash video sites.
|
data/Gemfile.lock
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
viddl-rb (0.84)
|
5
|
-
mechanize
|
6
|
-
multi_json
|
7
|
-
nokogiri (~> 1.5.0)
|
8
|
-
progressbar
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: http://rubygems.org/
|
12
|
-
specs:
|
13
|
-
domain_name (0.5.13)
|
14
|
-
unf (>= 0.0.5, < 1.0.0)
|
15
|
-
http-cookie (1.0.1)
|
16
|
-
domain_name (~> 0.5)
|
17
|
-
mechanize (2.7.2)
|
18
|
-
domain_name (~> 0.5, >= 0.5.1)
|
19
|
-
http-cookie (~> 1.0.0)
|
20
|
-
mime-types (~> 1.17, >= 1.17.2)
|
21
|
-
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
22
|
-
net-http-persistent (~> 2.5, >= 2.5.2)
|
23
|
-
nokogiri (~> 1.4)
|
24
|
-
ntlm-http (~> 0.1, >= 0.1.1)
|
25
|
-
webrobots (>= 0.0.9, < 0.2)
|
26
|
-
mime-types (1.24)
|
27
|
-
minitest (5.0.6)
|
28
|
-
multi_json (1.8.0)
|
29
|
-
net-http-digest_auth (1.4)
|
30
|
-
net-http-persistent (2.9)
|
31
|
-
nokogiri (1.5.10)
|
32
|
-
ntlm-http (0.1.1)
|
33
|
-
progressbar (0.20.0)
|
34
|
-
rake (10.1.0)
|
35
|
-
rest-client (1.6.7)
|
36
|
-
mime-types (>= 1.16)
|
37
|
-
unf (0.1.2)
|
38
|
-
unf_ext
|
39
|
-
unf_ext (0.0.6)
|
40
|
-
webrobots (0.1.1)
|
41
|
-
|
42
|
-
PLATFORMS
|
43
|
-
ruby
|
44
|
-
|
45
|
-
DEPENDENCIES
|
46
|
-
minitest
|
47
|
-
rake
|
48
|
-
rest-client
|
49
|
-
viddl-rb!
|