rsocial 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/lib/rsocial.rb +5 -1
- data/lib/rsocial/runner.rb +1 -4
- data/lib/rsocial/shazam.rb +7 -0
- data/lib/rsocial/shazam/client.rb +8 -0
- data/lib/rsocial/shazam/client/users.rb +22 -0
- data/lib/rsocial/soundcloud.rb +7 -0
- data/lib/rsocial/soundcloud/client.rb +8 -0
- data/lib/rsocial/soundcloud/client/users.rb +23 -0
- data/spec/rsocial/shazam/client/users_spec.rb +15 -0
- data/spec/rsocial/soundcloud/client/users_spec.rb +16 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74fa551e5ed8e6ae7e21b0a8c3acd9ca63ef5e19
|
4
|
+
data.tar.gz: ee0292c47c123323322d6d725dc66dae281172f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09a10d4381172c2f214577762906ed8c145660f5d85aa5f6e7d43f6835c1408b5322911d9640e32440c2add7a4a89e4a957c468e07eff60b94354fb6e2000ffd
|
7
|
+
data.tar.gz: 5b776ee6a18066ff8ddc898a18eda122b9d93b28029bb0f0a6356fdd3fb7c5387f0b750c3e86d29c40b1e5f75350e2ed999b2a3058ff1211dc8b29ddda4142e8
|
data/README.md
CHANGED
@@ -58,6 +58,27 @@ client = RSocial::Youtube.client(:requesting_handle => "my_handle")
|
|
58
58
|
client.user("TransworldSKATEmag") #=> {:subscribers=>195811, :handle=>"TransworldSKATEmag"}
|
59
59
|
```
|
60
60
|
|
61
|
+
|
62
|
+
#### Shazam
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
require 'rsocial'
|
66
|
+
|
67
|
+
client = RSocial::Shazam.client(:requesting_handle => "my_handle")
|
68
|
+
|
69
|
+
client.page("40229308") #=> {:followers=>189000, :id=>"40229308"}
|
70
|
+
```
|
71
|
+
|
72
|
+
#### Soundcloud
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
require 'rsocial'
|
76
|
+
|
77
|
+
client = RSocial::Soundcloud.client(:requesting_handle => "my_handle")
|
78
|
+
|
79
|
+
client.page("ryan-bingham") #=> {:followers=>189000, :tracks=>5, :handle=>"ryan-bingham"}
|
80
|
+
```
|
81
|
+
|
61
82
|
## Contributing
|
62
83
|
|
63
84
|
* Fork the project.
|
data/lib/rsocial.rb
CHANGED
@@ -9,7 +9,11 @@ require 'rsocial/twitter'
|
|
9
9
|
require 'rsocial/twitter/client'
|
10
10
|
require 'rsocial/youtube'
|
11
11
|
require 'rsocial/youtube/client'
|
12
|
+
require 'rsocial/shazam'
|
13
|
+
require 'rsocial/shazam/client'
|
14
|
+
require 'rsocial/soundcloud'
|
15
|
+
require 'rsocial/soundcloud/client'
|
12
16
|
|
13
17
|
module RSocial
|
14
|
-
VERSION = '0.
|
18
|
+
VERSION = '0.7.0'
|
15
19
|
end
|
data/lib/rsocial/runner.rb
CHANGED
@@ -4,16 +4,13 @@ module RSocial
|
|
4
4
|
class Runner < Utils
|
5
5
|
def initialize(options={})
|
6
6
|
@options = options
|
7
|
-
puts "Runner"
|
8
|
-
puts @options
|
9
7
|
end
|
10
8
|
|
11
9
|
def run(url, injections)
|
12
10
|
begin
|
13
11
|
#Headless::Exception: Xvfb not found on your system
|
14
12
|
Headless.ly do
|
15
|
-
|
16
|
-
@wd = Driver.instance.send( @options[:browser] )
|
13
|
+
@wd = Driver.instance.send( "firefox" ) #@options[:browser]
|
17
14
|
@wd.navigate.to url
|
18
15
|
inject_each do
|
19
16
|
injections
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RSocial
|
2
|
+
module Shazam
|
3
|
+
class Client
|
4
|
+
module Users
|
5
|
+
def user(id)
|
6
|
+
run(
|
7
|
+
"https://www.shazam.com/artist/#{id}",
|
8
|
+
user_injections
|
9
|
+
).merge(:id => id)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def user_injections
|
15
|
+
{
|
16
|
+
:followers => "return document.getElementsByClassName('js-followers')[0].textContent"
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RSocial
|
2
|
+
module Soundcloud
|
3
|
+
class Client
|
4
|
+
module Users
|
5
|
+
def user(handle)
|
6
|
+
run(
|
7
|
+
"https://soundcloud.com/#{handle}/",
|
8
|
+
user_injections
|
9
|
+
).merge(:handle => handle)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def user_injections
|
15
|
+
{
|
16
|
+
:followers => "return document.getElementsByClassName('infoStats__value')[0].textContent",
|
17
|
+
:tracks => "return document.getElementsByClassName('infoStats__value')[2].textContent"
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
describe RSocial::Shazam::Client::Users do
|
2
|
+
describe 'Shazam.client.user()' do
|
3
|
+
|
4
|
+
before(:each) do
|
5
|
+
@client = RSocial::Shazam.client({})
|
6
|
+
@user = @client.user("40229308")
|
7
|
+
end
|
8
|
+
|
9
|
+
#{:followers=>"254,682"}
|
10
|
+
it 'should find user stats' do
|
11
|
+
expect(@user[:followers]).to be_an Integer
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
describe RSocial::Soundcloud::Client::Users do
|
2
|
+
describe 'Soundcloud.client.user()' do
|
3
|
+
|
4
|
+
before(:each) do
|
5
|
+
@client = RSocial::Soundcloud.client({})
|
6
|
+
@user = @client.user("ryan-bingham")
|
7
|
+
end
|
8
|
+
|
9
|
+
#{:followers=>"254,682", :tracks=>"5"}
|
10
|
+
it 'should find user stats' do
|
11
|
+
expect(@user[:followers]).to be_an Integer
|
12
|
+
expect(@user[:tracks]).to be_an Integer
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsocial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Richards
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -181,6 +181,12 @@ files:
|
|
181
181
|
- lib/rsocial/instagram/client.rb
|
182
182
|
- lib/rsocial/instagram/client/users.rb
|
183
183
|
- lib/rsocial/runner.rb
|
184
|
+
- lib/rsocial/shazam.rb
|
185
|
+
- lib/rsocial/shazam/client.rb
|
186
|
+
- lib/rsocial/shazam/client/users.rb
|
187
|
+
- lib/rsocial/soundcloud.rb
|
188
|
+
- lib/rsocial/soundcloud/client.rb
|
189
|
+
- lib/rsocial/soundcloud/client/users.rb
|
184
190
|
- lib/rsocial/twitter.rb
|
185
191
|
- lib/rsocial/twitter/client.rb
|
186
192
|
- lib/rsocial/twitter/client/users.rb
|
@@ -192,6 +198,8 @@ files:
|
|
192
198
|
- rsocial.gemspec
|
193
199
|
- spec/rsocial/facebook/client/pages_spec.rb
|
194
200
|
- spec/rsocial/instagram/client/users_spec.rb
|
201
|
+
- spec/rsocial/shazam/client/users_spec.rb
|
202
|
+
- spec/rsocial/soundcloud/client/users_spec.rb
|
195
203
|
- spec/rsocial/twitter/client/users_spec.rb
|
196
204
|
- spec/rsocial/twitter_spec.rb
|
197
205
|
- spec/rsocial/youtube/client/channels_spec.rb
|
@@ -224,6 +232,8 @@ summary: A ruby social media stat crawler
|
|
224
232
|
test_files:
|
225
233
|
- spec/rsocial/facebook/client/pages_spec.rb
|
226
234
|
- spec/rsocial/instagram/client/users_spec.rb
|
235
|
+
- spec/rsocial/shazam/client/users_spec.rb
|
236
|
+
- spec/rsocial/soundcloud/client/users_spec.rb
|
227
237
|
- spec/rsocial/twitter/client/users_spec.rb
|
228
238
|
- spec/rsocial/twitter_spec.rb
|
229
239
|
- spec/rsocial/youtube/client/channels_spec.rb
|