grooveshark 0.2.8.2 → 0.2.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d353bdcd6c8de12ac82635d8cf21b4aff0a0398
4
- data.tar.gz: 23702348073546abd32c472875a36b6b427fa9bb
3
+ metadata.gz: b4b7dfe5b1d75551f6d9991500bd51410105bbf6
4
+ data.tar.gz: a0e90517ea68482399f001c63c9e92f2108c0fc5
5
5
  SHA512:
6
- metadata.gz: ac645b069fd9956049d8c982c7b2cf74d275d40c50c64f56095a7132c4ab1e038fe7ec31d53d622e2305110a1ff0a1ef7ac8a1e0f9af9d3df3ec3434a87778a1
7
- data.tar.gz: a5d38d2e45caa98a721eaf6142a75cbc458e9862ade9310a170e04a4168be09a7eecab3e848007561ac657b58e9e75ed696cd2665b28e941c5c8f077fe3a0f5f
6
+ metadata.gz: 203b0405c3b0d4b4c9d95aedb3a5665c3219914943306e927ad48c7a4eb3b97cb1c99ee756660140fa201814787af668b1f1f7efb9be01f8f01f60bb17ccbf7f
7
+ data.tar.gz: 2458b45328a4a59b8876043196b72ab7c62ad8edc3ff9a284be0da13adc57314225bb5d5fbb628b1f5c1a199135a27ff7fc2aa3a6a1eb04dbc3c703b3c60a377
@@ -92,9 +92,15 @@ module Grooveshark
92
92
  def get_session_and_country
93
93
  response = RestClient.get('http://grooveshark.com')
94
94
  session = response.headers[:set_cookie].to_s.scan(/PHPSESSID=([a-z\d]{32});/i).flatten.first
95
- config_json = response.to_s.scan(/window.gsConfig = (\{.*?\});/).flatten.first
95
+
96
+ preload_regex = /gsPreloadAjax\(\{url: '\/preload.php\?(.*)&hash=' \+ clientPage\}\)/
97
+ preload_id = response.to_s.scan(preload_regex).flatten.first
98
+ preload_url = "http://grooveshark.com/preload.php?#{preload_id}&getCommunicationToken=1&hash=%2F"
99
+ preload_response = RestClient.get(preload_url)
100
+
101
+ config_json = preload_response.to_s.scan(/window.tokenData = (.*);/).flatten.first
96
102
  raise GeneralError, "gsConfig not found" if not config_json
97
- config = JSON.parse(config_json)
103
+ config = JSON.parse(config_json)['getGSConfig']
98
104
  [session, config['country']]
99
105
  end
100
106
 
@@ -1,3 +1,3 @@
1
1
  module Grooveshark
2
- VERSION = "0.2.8.2"
2
+ VERSION = "0.2.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grooveshark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8.2
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Sosedoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-23 00:00:00.000000000 Z
11
+ date: 2013-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec