rsocial 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rsocial.rb +5 -1
- data/lib/rsocial/facebook.rb +0 -1
- data/lib/rsocial/instagram.rb +0 -1
- data/lib/rsocial/runner.rb +10 -4
- data/lib/rsocial/twitter.rb +7 -0
- data/lib/rsocial/twitter/client.rb +8 -0
- data/lib/rsocial/twitter/client/users.rb +25 -0
- data/lib/rsocial/youtube.rb +7 -0
- data/lib/rsocial/youtube/client.rb +9 -0
- data/lib/rsocial/youtube/client/channels.rb +22 -0
- data/lib/rsocial/youtube/client/users.rb +22 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6ceb4c05880310a6785c3294323410b5d035814
|
4
|
+
data.tar.gz: 5edf7be3e7c480080241482c4256cabd96c67ccd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 181e51d71f9c600c15bb1f0b60a47e064201ce113bedcb4eaf0bfd6f5d43fdacdf34c50d0f2e3f970dffb4ce2897bf42a2de46c48fccf7322737bfb96b4a6832
|
7
|
+
data.tar.gz: 2a1ddb118bfd863eab6428876a6c1c8a459958c7a6cca14a853945d02c477c6a0a70a64ed2eda5bdae9595c780a53e28636913d9b39da927517ef4acc30a5fa5
|
data/lib/rsocial.rb
CHANGED
@@ -4,7 +4,11 @@ require 'rsocial/instagram'
|
|
4
4
|
require 'rsocial/instagram/client'
|
5
5
|
require 'rsocial/facebook'
|
6
6
|
require 'rsocial/facebook/client'
|
7
|
+
require 'rsocial/twitter'
|
8
|
+
require 'rsocial/twitter/client'
|
9
|
+
require 'rsocial/youtube'
|
10
|
+
require 'rsocial/youtube/client'
|
7
11
|
|
8
12
|
module RSocial
|
9
|
-
VERSION = '0.
|
13
|
+
VERSION = '0.3.0'
|
10
14
|
end
|
data/lib/rsocial/facebook.rb
CHANGED
data/lib/rsocial/instagram.rb
CHANGED
data/lib/rsocial/runner.rb
CHANGED
@@ -7,11 +7,17 @@ module RSocial
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def run(url, injections)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
begin
|
11
|
+
while_headless do
|
12
|
+
Driver.instance.firefox.navigate.to url
|
13
|
+
inject_each do
|
14
|
+
injections
|
15
|
+
end
|
14
16
|
end
|
17
|
+
rescue Net::ReadTimeout => e
|
18
|
+
{
|
19
|
+
:error => e
|
20
|
+
}
|
15
21
|
end
|
16
22
|
end
|
17
23
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module RSocial
|
2
|
+
module Twitter
|
3
|
+
class Client
|
4
|
+
module Users
|
5
|
+
def user(handle)
|
6
|
+
run(
|
7
|
+
"https://twitter.com/#{handle}/",
|
8
|
+
user_injections
|
9
|
+
).merge(:handle => handle)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def user_injections
|
15
|
+
{
|
16
|
+
:tweets => "return document.getElementsByClassName('ProfileNav-list')[0].childNodes[1].getElementsByClassName('ProfileNav-value')[0].textContent",
|
17
|
+
:following => "return document.getElementsByClassName('ProfileNav-list')[0].childNodes[2].getElementsByClassName('ProfileNav-value')[0].textContent",
|
18
|
+
:followers => "return document.getElementsByClassName('ProfileNav-list')[0].childNodes[3].getElementsByClassName('ProfileNav-value')[0].textContent",
|
19
|
+
:likes => "return document.getElementsByClassName('ProfileNav-list')[0].childNodes[4].getElementsByClassName('ProfileNav-value')[0].textContent"
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RSocial
|
2
|
+
module Youtube
|
3
|
+
class Client
|
4
|
+
module Channels
|
5
|
+
def channel(channel_id)
|
6
|
+
run(
|
7
|
+
"https://www.youtube.com/channel/#{channel_id}/",
|
8
|
+
channel_injections
|
9
|
+
).merge(:channel_id => channel_id)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def channel_injections
|
15
|
+
{
|
16
|
+
:subscribers => "return document.getElementsByClassName('yt-subscription-button-subscriber-count-branded-horizontal')[0].textContent"
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RSocial
|
2
|
+
module Youtube
|
3
|
+
class Client
|
4
|
+
module Users
|
5
|
+
def user(handle)
|
6
|
+
run(
|
7
|
+
"https://www.youtube.com/user/#{handle}/",
|
8
|
+
user_injections
|
9
|
+
).merge(:handle => handle)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def user_injections
|
15
|
+
{
|
16
|
+
:subscribers => "return document.getElementsByClassName('yt-subscription-button-subscriber-count-branded-horizontal')[0].textContent"
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
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.3.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-08-
|
11
|
+
date: 2016-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -96,6 +96,13 @@ files:
|
|
96
96
|
- lib/rsocial/instagram/client.rb
|
97
97
|
- lib/rsocial/instagram/client/users.rb
|
98
98
|
- lib/rsocial/runner.rb
|
99
|
+
- lib/rsocial/twitter.rb
|
100
|
+
- lib/rsocial/twitter/client.rb
|
101
|
+
- lib/rsocial/twitter/client/users.rb
|
102
|
+
- lib/rsocial/youtube.rb
|
103
|
+
- lib/rsocial/youtube/client.rb
|
104
|
+
- lib/rsocial/youtube/client/channels.rb
|
105
|
+
- lib/rsocial/youtube/client/users.rb
|
99
106
|
- rsocial.gemspec
|
100
107
|
homepage: http://www.github.com/advectus/rsocial
|
101
108
|
licenses:
|