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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1773257ff57bf2425e956b8e968fd25c89775f33
4
- data.tar.gz: e8d9ad93e62f0733eef3bf61ee45144b155248f5
3
+ metadata.gz: a6ceb4c05880310a6785c3294323410b5d035814
4
+ data.tar.gz: 5edf7be3e7c480080241482c4256cabd96c67ccd
5
5
  SHA512:
6
- metadata.gz: d8fa79d5275ddd3f0070c5ddc07fa8ef9cc447a7c83d34fd43e0fadc151a8ead2516034496870ab453e45c511c4859de954c9308c15f3be4b451b76f6ab59fbf
7
- data.tar.gz: 4b649e8ae2eb7a4f2e8081bfee8c584e17111faebbe0ccf3e9c8664b9459dcda11dbb4a93146a25ae1840b6e5386bd86cbc310150d29bfc72648698f4241c568
6
+ metadata.gz: 181e51d71f9c600c15bb1f0b60a47e064201ce113bedcb4eaf0bfd6f5d43fdacdf34c50d0f2e3f970dffb4ce2897bf42a2de46c48fccf7322737bfb96b4a6832
7
+ data.tar.gz: 2a1ddb118bfd863eab6428876a6c1c8a459958c7a6cca14a853945d02c477c6a0a70a64ed2eda5bdae9595c780a53e28636913d9b39da927517ef4acc30a5fa5
@@ -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.2.0'
13
+ VERSION = '0.3.0'
10
14
  end
@@ -1,4 +1,3 @@
1
-
2
1
  module RSocial
3
2
  module Facebook
4
3
  def self.client(options={})
@@ -1,4 +1,3 @@
1
-
2
1
  module RSocial
3
2
  module Instagram
4
3
  def self.client(options={})
@@ -7,11 +7,17 @@ module RSocial
7
7
  end
8
8
 
9
9
  def run(url, injections)
10
- while_headless do
11
- Driver.instance.firefox.navigate.to url
12
- inject_each do
13
- injections
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,7 @@
1
+ module RSocial
2
+ module Twitter
3
+ def self.client(options={})
4
+ Twitter::Client.new(options)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ module RSocial
2
+ module Twitter
3
+ class Client < Runner
4
+ Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f}
5
+ include Twitter::Client::Users
6
+ end
7
+ end
8
+ end
@@ -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,7 @@
1
+ module RSocial
2
+ module Youtube
3
+ def self.client(options={})
4
+ Youtube::Client.new(options)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module RSocial
2
+ module Youtube
3
+ class Client < Runner
4
+ Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f}
5
+ include Youtube::Client::Users
6
+ include Youtube::Client::Channels
7
+ end
8
+ end
9
+ 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.2.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-24 00:00:00.000000000 Z
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: