viddl-rb 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/plugins/soundcloud.rb +20 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f458e70cdcb02d38e9d58dae9def3f9e2f8024e4
4
- data.tar.gz: d9a8034ca3cf2cb2e40b1b950dc0b99f9dde15e3
3
+ metadata.gz: 8410fb215d58b74b6942b35ac12121004925095f
4
+ data.tar.gz: 6fbf24f9bd13ba0a39c89a933bee86c20c448c42
5
5
  SHA512:
6
- metadata.gz: f4c875d9f2d1f3ba8327d17f884809f982072277f859dcc3808d6ad1708fcb09dc163a0c72c41cdfdfbf171b614872f7ebe180be287e987cc2b51b782f2222d0
7
- data.tar.gz: 3f8409ba0a9fec178a2851924e787da667c5afc6b89018b78e2cf7aa04f19b7c97848c38c5465f8c63a2fe24cbd54ae5a24b52e43b8c9249f9603a183e03c80a
6
+ metadata.gz: 84227fae10d7ca9b3ffa77a3a505c39e36596503b1da1ce379ef5da49033749b8ee9a3722bfaed65e6185cc59b9554acde76ba442b042f10bc58a5588423a5d4
7
+ data.tar.gz: 60a7bb221aa8fd75368ddbeafd6a1e52dab74bf7aa5533141b626c5244f9b248aa047534f8dd5409cb58df494dbc6c69b57027b36a0f3760a3112d621e8d2e84
@@ -1,5 +1,5 @@
1
1
  require 'nokogiri'
2
- require 'open-uri'
2
+ require 'uri'
3
3
  require 'json'
4
4
 
5
5
  class Soundcloud < PluginBase
@@ -12,7 +12,23 @@ class Soundcloud < PluginBase
12
12
  # return the url for original video file and title
13
13
  def self.get_urls_and_filenames(url, options = {})
14
14
  url_and_files = []
15
- doc = Nokogiri::HTML(open(get_http_url(url)))
15
+
16
+ doc = Nokogiri::HTML(open(get_http_url(url)))
17
+ js = doc.at("script:contains('_scPreload')").text
18
+
19
+ track_data = JSON.parse js[/_scPreload\s*?=\s*?([\s\S]*?)$/,1].to_s
20
+
21
+ track_data['data']['models/audible'].each do |track_data|
22
+ params = URI.encode_www_form 'app_version' => '6749d1a0',
23
+ 'client_id' => 'b45b1aa10f1ac2941910a7f0d10f8e28',
24
+ 'policy' => 'ALLOW'
25
+
26
+ url_and_files << {
27
+ url: URI("#{track_data['stream_url']}?#{params}").to_s.to_s,
28
+ name: self.make_filename_safe(track_data['title'].to_s) + '.mp3'
29
+ }
30
+ end
31
+
16
32
 
17
33
  # locate the controller script that contains all the tracks data
18
34
  # this will work for either artist's or track's pages
@@ -30,6 +46,6 @@ class Soundcloud < PluginBase
30
46
  end
31
47
 
32
48
  def self.get_http_url(url)
33
- url.sub(/https?:\/\//, "http:\/\/")
49
+ url.sub(/http:\/\//, "https:\/\/")
34
50
  end
35
- end
51
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viddl-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Seeger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-02 00:00:00.000000000 Z
11
+ date: 2014-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri