viddl-rb 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -27,7 +27,7 @@ __Requirements:__
27
27
 
28
28
  __Contributors:__
29
29
 
30
- * [kl](https://github.com/kl): Windows support (who knew!) and bug fixes
30
+ * [kl](https://github.com/kl): Windows support (who knew!), bug fixes, veho plugin
31
31
  * [divout](https://github.com/divout) aka Ivan K: blip.tv plugin, bugfixes
32
32
  * Sniper: bugfixes
33
33
  * [Serabe](https://github.com/Serabe) aka Sergio Arbeo: packaging viddl as a binary
@@ -46,7 +46,7 @@ class DownloadHelper
46
46
  return `which #{utility}`.include?(utility)
47
47
  else
48
48
  begin
49
- `#{utility}` #if running the command does not thow an error, Windows has it
49
+ `#{utility}` #if running the command does not throw an error, Windows has it
50
50
  return true
51
51
  rescue Errno::ENOENT
52
52
  return false
data/plugins/blip.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Blip < PluginBase
2
- # this will be called by the main app to check weather this plugin is responsible for the url passed
2
+ # this will be called by the main app to check whether this plugin is responsible for the url passed
3
3
  def self.matches_provider?(url)
4
4
  url.include?("blip.tv")
5
5
  end
data/plugins/megavideo.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Megavideo < PluginBase
2
- #this will be called by the main app to check weather this plugin is responsible for the url passed
2
+ #this will be called by the main app to check whether this plugin is responsible for the url passed
3
3
  def self.matches_provider?(url)
4
4
  url.include?("megavideo.com")
5
5
  end
data/plugins/veoh.rb ADDED
@@ -0,0 +1,46 @@
1
+ class Veoh < PluginBase
2
+ VEOH_API_BASE = "http://www.veoh.com/api/"
3
+ PREFERRED_FORMATS = [:mp4, :flash] # mp4 is preferred because it enables downloading full videos and not just previews
4
+
5
+ #this will be called by the main app to check whether this plugin is responsible for the url passed
6
+ def self.matches_provider?(url)
7
+ url.include?("veoh.com")
8
+ end
9
+
10
+ def self.get_urls_and_filenames(url)
11
+ veoh_id = url[/\/watch\/([\w\d]+)/, 1]
12
+ info_url = "#{VEOH_API_BASE}findByPermalink?permalink=#{veoh_id}"
13
+ info_doc = Nokogiri::XML(open(info_url))
14
+
15
+ download_url = get_download_url(info_doc)
16
+ file_name = get_file_name(info_doc, download_url)
17
+
18
+ [{:url => download_url, :name => file_name}]
19
+ end
20
+
21
+ #returns the first valid download url string, in order of the prefered formats, that is found for the video
22
+ def self.get_download_url(info_doc)
23
+ PREFERRED_FORMATS.each do |format|
24
+ a = get_attribute(format)
25
+ download_attr = info_doc.xpath('//rsp/videoList/video').first.attributes[a]
26
+ return(download_attr.content) unless download_attr.nil? || download_attr.content.empty?
27
+ end
28
+ end
29
+
30
+ #the file name string is a combination of the video name and the extension
31
+ def self.get_file_name(info_doc, download_url)
32
+ name = info_doc.xpath('//rsp/videoList/video').first.attributes['title'].content
33
+ name.gsub!(" ", "_") # replace spaces with underscores
34
+ extension = download_url[/\/[\w\d]+(\.[\w\d]+)\?ct/, 1]
35
+ name + extension
36
+ end
37
+
38
+ def self.get_attribute(format)
39
+ case format
40
+ when :mp4
41
+ "ipodUrl"
42
+ when :flash
43
+ "previewUrl"
44
+ end
45
+ end
46
+ end
data/plugins/vimeo.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Vimeo < PluginBase
2
- #this will be called by the main app to check weather this plugin is responsible for the url passed
2
+ #this will be called by the main app to check whether this plugin is responsible for the url passed
3
3
  def self.matches_provider?(url)
4
4
  url.include?("vimeo.com")
5
5
  end
@@ -22,4 +22,4 @@ class Vimeo < PluginBase
22
22
  puts "downloading to " + file_name
23
23
  [{:url => download_url, :name => file_name}]
24
24
  end
25
- end
25
+ end
data/plugins/youtube.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Youtube < PluginBase
2
- #this will be called by the main app to check weather this plugin is responsible for the url passed
2
+ #this will be called by the main app to check whether this plugin is responsible for the url passed
3
3
  def self.matches_provider?(url)
4
4
  url.include?("youtube.com") || url.include?("youtu.be")
5
5
  end
@@ -134,7 +134,7 @@ class Youtube < PluginBase
134
134
 
135
135
  #video_info_hash.keys.sort.each{|key| puts "#{key} : #{video_info_hash[key]}" }
136
136
  download_url = video_info_hash["url_encoded_fmt_stream_map"][selected_format]
137
- #if download url ends with a ';' followed by a codec string remove that part because stops URI.parse from working
137
+ #if download url ends with a ';' followed by a codec string remove that part because it stops URI.parse from working
138
138
  download_url = $1 if download_url =~ /(.*?);\scodecs=/
139
139
  file_name = title.delete("\"'").gsub(/[^0-9A-Za-z]/, '_') + "." + format_ext[selected_format][:extension]
140
140
  puts "downloading to " + file_name
metadata CHANGED
@@ -1,66 +1,89 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: viddl-rb
3
- version: !ruby/object:Gem::Version
4
- version: 0.5.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 2
10
+ version: 0.5.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Marc Seeger
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-11-19 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2011-11-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: nokogiri
16
- requirement: &70242056051380 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
22
32
  type: :runtime
23
- prerelease: false
24
- version_requirements: *70242056051380
25
- description: An extendable commandline video downloader for flash video sites. Includes
26
- plugins for vimeo, youtube and megavideo
33
+ version_requirements: *id001
34
+ description: An extendable commandline video downloader for flash video sites. Includes plugins for vimeo, youtube and megavideo
27
35
  email: mail@marc-seeger.de
28
- executables:
36
+ executables:
29
37
  - viddl-rb
30
38
  extensions: []
39
+
31
40
  extra_rdoc_files: []
32
- files:
41
+
42
+ files:
33
43
  - bin/viddl-rb
34
44
  - helper/download-helper.rb
35
45
  - helper/plugin-helper.rb
36
46
  - plugins/blip.rb
37
47
  - plugins/megavideo.rb
48
+ - plugins/veoh.rb
38
49
  - plugins/vimeo.rb
39
50
  - plugins/youtube.rb
40
51
  - CHANGELOG.txt
41
52
  - README.md
42
53
  homepage: https://github.com/rb2k/viddl-rb
43
54
  licenses: []
55
+
44
56
  post_install_message:
45
57
  rdoc_options: []
46
- require_paths:
58
+
59
+ require_paths:
47
60
  - .
48
- required_ruby_version: !ruby/object:Gem::Requirement
61
+ required_ruby_version: !ruby/object:Gem::Requirement
49
62
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
71
  none: false
56
- requirements:
57
- - - ! '>='
58
- - !ruby/object:Gem::Version
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 19
76
+ segments:
77
+ - 1
78
+ - 3
79
+ - 4
59
80
  version: 1.3.4
60
81
  requirements: []
82
+
61
83
  rubyforge_project: viddl-rb
62
- rubygems_version: 1.8.10
84
+ rubygems_version: 1.8.6
63
85
  signing_key:
64
86
  specification_version: 3
65
87
  summary: An extendable commandline video downloader for flash video sites.
66
88
  test_files: []
89
+