viddl-rb 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aff24988a745ce18c4928aca3c4e50fb47232f1d
4
- data.tar.gz: c0fff623ca863b24999582c94d582a2de1288c1f
3
+ data.tar.gz: d497fc050ace12babbf349b9a784bc4d25f575b6
4
+ metadata.gz: f762d1748ff20ddecf6a8a243934ed8002c2bf7b
5
5
  SHA512:
6
- metadata.gz: 04af8ad42b49b38d890fb2e1536a2e8de0573c6a419c984bb3135078c18cc98a1f3fd9c760d885c540372ebdbf303d164147f240e3ca760edf0161bac16042b7
7
- data.tar.gz: 9a7b77633e663298a5ea5872afef78491de249906ff598d73401c15e9f2db4ba99635118e83e74fcebb61ca65da30d59b0955b03846595fd9720c4b70d357b63
6
+ data.tar.gz: ec1be57e9dfbb1e44489fa6cca3af761ab3433b012a7e7984a21fa09a1011155b7141939f3770e40a369a3b714f2dba8ac205630e1af9a4a98244422b4cead93
7
+ metadata.gz: 584785893e0f19ee4da9b374619e878c726297847cf3f7f2dfbd8cedf18338c1806d68a3d3f6690c9d678ad8b08bcba76de3fb3ca2204394d4bad5eddc06ef99
data/README.md CHANGED
@@ -16,15 +16,15 @@ Download a video:
16
16
 
17
17
  Viddl-rb supports the following command line options:
18
18
  ```
19
- -e, --extract-audio Save video audio to file
20
- -a, --abort-on-failure Abort download queue if one of the videos fail to download
21
- -u, --url-only Prints url without downloading
22
- -t, --title-only Prints title without downloading
19
+ -e, --extract-audio Extract the audio track of the download to a separate file
20
+ -a, --abort-on-failure Abort if one of the videos in a list fails to download
21
+ -u, --url-only Just display the download url without downloading the file.
22
+ -t, --title-only Just display the title without downloading the file.
23
23
  -f, --filter REGEX Filters a video playlist according to the regex (Youtube only right now)
24
24
  -s, --save-dir DIRECTORY Specifies the directory where videos should be saved
25
- -d, --downloader TOOL Specifies the tool to download with. Supports 'wget', 'curl' and 'net-http'
26
- -q, --quality QUALITY Specifies the video format and resolution in the following way: width:height:res (e.g. 1280:720:mp4)
27
- The width, height and resolution may be omitted with a *.
25
+ -d, --downloader TOOL Specifies the tool to download with. Supports 'wget', 'curl', 'aria2c' and 'net-http'
26
+ -q, --quality QUALITY Specifies the video format and resolution in the following way: width:height:format (e.g. 1280:720:mp4)
27
+ The width, height and format may be omitted with a *.
28
28
  For example, to match any quality with a height of 720 pixels in any format specify --quality *:720:*
29
29
  -h, --help Displays the help screen
30
30
  ```
@@ -128,6 +128,7 @@ __Co Maintainers:__
128
128
  * [farleyknight](https://github.com/farleyknight): Various small fixes and improvements
129
129
 
130
130
  __Contributors:__
131
+ * [albertoboni](https://github.com/albertoboni) bandcamp plugin, soundcloud improvements
131
132
  * [divout](https://github.com/divout) aka Ivan K: blip.tv plugin, bugfixes
132
133
  * Sniper: bugfixes
133
134
  * [Serabe](https://github.com/Serabe) aka Sergio Arbeo: packaging viddl as a binary
@@ -0,0 +1,40 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+
4
+ class Bandcamp < PluginBase
5
+
6
+ # this will be called by the main app to check whether this plugin is responsible for the url passed
7
+ def self.matches_provider?(url)
8
+ url.include?("bandcamp.com")
9
+ end
10
+
11
+
12
+ # return the url for original video file and title
13
+ def self.get_urls_and_filenames(url, options = {})
14
+ # locate the js object with all the tracks data
15
+ url_and_files = []
16
+ doc = Nokogiri::HTML(open(get_http_url(url)))
17
+ js = doc.at("script:contains('var TralbumData')").text
18
+ match = js[/trackinfo.*(\[.*\])/,1]
19
+
20
+ # parse the js object
21
+ JSON.parse(match).each do |track_data|
22
+ track_url = ''
23
+
24
+ # hopefully the last is the best
25
+ track_url = track_data["file"].values.last
26
+
27
+ # create a good mp3 name
28
+ track_name = self.make_filename_safe(track_data['title']) + '.mp3'
29
+
30
+ # add to the response
31
+ url_and_files << {url: track_url, name: track_name}
32
+ end
33
+
34
+ url_and_files
35
+ end
36
+
37
+ def self.get_http_url(url)
38
+ url.sub(/https?:\/\//, "http:\/\/")
39
+ end
40
+ end
@@ -1,40 +1,32 @@
1
+ require 'nokogiri'
1
2
  require 'open-uri'
3
+ require 'json'
4
+
2
5
  class Soundcloud < PluginBase
3
6
  # this will be called by the main app to check whether this plugin is responsible for the url passed
4
7
  def self.matches_provider?(url)
5
8
  url.include?("soundcloud.com")
6
9
  end
7
10
 
11
+
8
12
  # return the url for original video file and title
9
13
  def self.get_urls_and_filenames(url, options = {})
10
- doc = Nokogiri::HTML(open(get_http_url(url)))
11
- download_filename = doc.at("#main-content-inner img[class=waveform]").attributes["src"].value.to_s.match(/\.com\/(.+)\_/)[1]
12
- download_url = "http://media.soundcloud.com/stream/#{download_filename}"
13
- final_url = UtilityHelper.get_final_location(download_url)
14
- file_name = transliterate("#{doc.at('//h1/em').text.chomp}") + ".mp3"
15
-
16
- [{:url => final_url, :name => file_name}]
17
- end
18
-
19
- def self.transliterate(str)
20
- # Based on permalink_fu by Rick Olsen
21
-
22
- # Downcase string
23
- str.downcase!
24
-
25
- # Remove apostrophes so isn't changes to isnt
26
- str.gsub!(/'/, '')
27
-
28
- # Replace any non-letter or non-number character with a space
29
- str.gsub!(/[^A-Za-z0-9]+/, ' ')
30
-
31
- # Remove spaces from beginning and end of string
32
- str.strip!
33
-
34
- # Replace groups of spaces with single hyphen
35
- str.gsub!(/\ +/, '-')
36
-
37
- str
14
+ url_and_files = []
15
+ doc = Nokogiri::HTML(open(get_http_url(url)))
16
+
17
+ # locate the controller script that contains all the tracks data
18
+ # this will work for either artist's or track's pages
19
+ doc.css('#main-content-inner .container + script').each do |container|
20
+ match = container.text.to_s.match(/\((\{.*\})\)/).to_a
21
+ track_data = JSON.parse(match[1])
22
+
23
+ file_url = track_data['streamUrl']
24
+ file_name = self.make_filename_safe(track_data['title'].to_s) + '.mp3'
25
+
26
+ url_and_files << {url: file_url, name: file_name}
27
+ end
28
+
29
+ url_and_files
38
30
  end
39
31
 
40
32
  def self.get_http_url(url)
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: 1.0.0
4
+ version: 1.0.1
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: 2014-04-07 00:00:00 Z
12
+ date: 2014-04-27 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mime-types
@@ -79,22 +79,28 @@ extensions: []
79
79
  extra_rdoc_files: []
80
80
 
81
81
  files:
82
+ - Gemfile
83
+ - Gemfile.lock
84
+ - README.md
85
+ - Rakefile
82
86
  - bin/helper/downloader.rb
83
87
  - bin/helper/driver.rb
84
88
  - bin/helper/parameter-parser.rb
85
89
  - bin/viddl-rb
86
- - lib/viddl-rb.rb
87
90
  - helper/audio-helper.rb
88
91
  - helper/download-helper.rb
89
92
  - helper/plugin-helper.rb
90
93
  - helper/utility-helper.rb
94
+ - lib/viddl-rb.rb
91
95
  - plugins/arte_plus_seven.rb
96
+ - plugins/bandcamp.rb
92
97
  - plugins/blip.rb
93
98
  - plugins/dailymotion.rb
94
99
  - plugins/metacafe.rb
95
100
  - plugins/soundcloud.rb
96
101
  - plugins/veoh.rb
97
102
  - plugins/vimeo.rb
103
+ - plugins/youtube.rb
98
104
  - plugins/youtube/cipher_guesser.rb
99
105
  - plugins/youtube/cipher_io.rb
100
106
  - plugins/youtube/ciphers.yml
@@ -103,11 +109,6 @@ files:
103
109
  - plugins/youtube/format_picker.rb
104
110
  - plugins/youtube/url_resolver.rb
105
111
  - plugins/youtube/video_resolver.rb
106
- - plugins/youtube.rb
107
- - Gemfile
108
- - Gemfile.lock
109
- - Rakefile
110
- - README.md
111
112
  homepage: https://github.com/rb2k/viddl-rb
112
113
  licenses:
113
114
  - MIT
@@ -131,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
132
  requirements: []
132
133
 
133
134
  rubyforge_project: viddl-rb
134
- rubygems_version: 2.1.11
135
+ rubygems_version: 2.2.2
135
136
  signing_key:
136
137
  specification_version: 4
137
138
  summary: An extendable commandline video downloader for flash video sites.