viddl-rb 0.78 → 0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.md +1 -1
  2. data/plugins/soundcloud.rb +17 -14
  3. metadata +4 -4
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  __viddl-rb:__
2
2
  Initially created by Marc Seeger (@rb2k)
3
3
  Repo: http://github.com/rb2k/viddl-rb
4
- [![Build Status](https://secure.travis-ci.org/rb2k/viddl-rb.png)](http://travis-ci.org/rb2k/viddl-rb) [![Dependency Status](https://gemnasium.com/rb2k/viddl-rb.png)](https://gemnasium.com/rb2k/viddl-rb)
4
+ [![Gem Version](https://badge.fury.io/rb/viddl-rb.png)](http://badge.fury.io/rb/viddl-rb)[![Build Status](https://secure.travis-ci.org/rb2k/viddl-rb.png)](http://travis-ci.org/rb2k/viddl-rb) [![Dependency Status](https://gemnasium.com/rb2k/viddl-rb.png)](https://gemnasium.com/rb2k/viddl-rb)
5
5
 
6
6
  __Installation:__
7
7
 
@@ -7,7 +7,7 @@ class Soundcloud < PluginBase
7
7
 
8
8
  # return the url for original video file and title
9
9
  def self.get_urls_and_filenames(url, options = {})
10
- doc = Nokogiri::HTML(open(url))
10
+ doc = Nokogiri::HTML(open(get_http_url(url)))
11
11
  download_filename = doc.at("#main-content-inner img[class=waveform]").attributes["src"].value.to_s.match(/\.com\/(.+)\_/)[1]
12
12
  download_url = "http://media.soundcloud.com/stream/#{download_filename}"
13
13
  file_name = transliterate("#{doc.at('//h1/em').text.chomp}") + ".mp3"
@@ -16,24 +16,27 @@ class Soundcloud < PluginBase
16
16
  end
17
17
 
18
18
  def self.transliterate(str)
19
- # Based on permalink_fu by Rick Olsen
19
+ # Based on permalink_fu by Rick Olsen
20
20
 
21
- # Downcase string
22
- str.downcase!
21
+ # Downcase string
22
+ str.downcase!
23
23
 
24
- # Remove apostrophes so isn't changes to isnt
25
- str.gsub!(/'/, '')
24
+ # Remove apostrophes so isn't changes to isnt
25
+ str.gsub!(/'/, '')
26
26
 
27
- # Replace any non-letter or non-number character with a space
28
- str.gsub!(/[^A-Za-z0-9]+/, ' ')
27
+ # Replace any non-letter or non-number character with a space
28
+ str.gsub!(/[^A-Za-z0-9]+/, ' ')
29
29
 
30
- # Remove spaces from beginning and end of string
31
- str.strip!
30
+ # Remove spaces from beginning and end of string
31
+ str.strip!
32
32
 
33
- # Replace groups of spaces with single hyphen
34
- str.gsub!(/\ +/, '-')
33
+ # Replace groups of spaces with single hyphen
34
+ str.gsub!(/\ +/, '-')
35
35
 
36
- str
37
- end
36
+ str
37
+ end
38
38
 
39
+ def self.get_http_url(url)
40
+ url.sub(/https?:\/\//, "http:\/\/")
41
+ end
39
42
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viddl-rb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 151
4
+ hash: 149
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 78
9
- version: "0.78"
8
+ - 79
9
+ version: "0.79"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Marc Seeger
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-03-21 00:00:00 Z
17
+ date: 2013-06-03 00:00:00 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: nokogiri