instagram_user 1.0.0 → 1.0.1
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 +4 -4
- data/.travis.yml +1 -7
- data/Rakefile +0 -3
- data/instagram_user.gemspec +4 -3
- data/lib/instagram_user/client.rb +18 -32
- data/lib/instagram_user/version.rb +1 -1
- metadata +20 -9
- data/.coveralls.yml +0 -2
- data/.rubocop.yml +0 -15
- data/.rubocop_todo.yml +0 -131
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98097b96666004c41115ff4cc58e524d53d4f853f006c4bb3bafc29ff11814ef
|
4
|
+
data.tar.gz: 032d757f8c4e5af72719c18f22f7cc866a8117e16bfef5650c7144eb0d6632b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1bc2c73b89ba027a02613f3a68f3fa9f64127683ac79a582083f3bc93ed114fd2a7bae667b02b44beac4e7cdbd08dd14d0e1e0820a7c71118b908707abf3744
|
7
|
+
data.tar.gz: 388155aa42ec3fb769ebd9f5c5aa5fc4d4caaf4ad02aebd1747aa8aa2d571da3de6d6004705e7c39c6fbb7c2a2124490c30a077d8c764f74b9bad94af16c7681
|
data/.travis.yml
CHANGED
@@ -9,10 +9,4 @@ rvm:
|
|
9
9
|
- 2.5.0
|
10
10
|
before_install:
|
11
11
|
- gem install bundler -v 1.15.4
|
12
|
-
- sudo apt-get update
|
13
|
-
- sudo apt-get install chromium-chromedriver
|
14
|
-
before_script:
|
15
|
-
- "export PATH=$PATH:/usr/lib/chromium-browser/"
|
16
|
-
- "export DISPLAY=:99.0"
|
17
|
-
- "sh -e /etc/init.d/xvfb start"
|
18
|
-
- sleep 3 # give xvfb some time to start
|
12
|
+
- sudo apt-get update
|
data/Rakefile
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
require 'coveralls/rake/task'
|
4
|
-
require 'rubocop/rake_task'
|
5
4
|
|
6
5
|
RSpec::Core::RakeTask.new(:rspec) do |spec|
|
7
6
|
spec.pattern = 'spec/**/*_spec.rb'
|
8
7
|
spec.rspec_opts = ['-cfd --backtrace']
|
9
8
|
end
|
10
9
|
|
11
|
-
RuboCop::RakeTask.new(:style)
|
12
|
-
|
13
10
|
Coveralls::RakeTask.new
|
14
11
|
|
15
12
|
task :default => ["rspec", "style"]
|
data/instagram_user.gemspec
CHANGED
@@ -33,10 +33,11 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_dependency 'selenium-webdriver'
|
34
34
|
spec.add_development_dependency "bundler", "~> 1.15"
|
35
35
|
spec.add_development_dependency "rake"
|
36
|
+
spec.add_development_dependency 'pry'
|
36
37
|
spec.add_development_dependency "guard-rspec"
|
37
|
-
spec.add_development_dependency "pry-byebug"
|
38
38
|
spec.add_development_dependency "guard"
|
39
|
-
spec.add_development_dependency
|
39
|
+
spec.add_development_dependency "terminal-notifier"
|
40
|
+
spec.add_development_dependency "terminal-notifier-guard"
|
40
41
|
spec.add_development_dependency 'coveralls'
|
41
|
-
spec.add_development_dependency '
|
42
|
+
spec.add_development_dependency 'ffi', '1.9.18'
|
42
43
|
end
|
@@ -34,7 +34,7 @@ module InstagramUser
|
|
34
34
|
@session = Mechanize.new
|
35
35
|
@user_ids = {}
|
36
36
|
logined_session
|
37
|
-
selenium_setting
|
37
|
+
selenium_setting unless options[:selenium] == false
|
38
38
|
end
|
39
39
|
|
40
40
|
def get_follows(user_name)
|
@@ -48,55 +48,41 @@ module InstagramUser
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def create_follow(user_name)
|
51
|
-
|
52
|
-
begin
|
53
|
-
@wait.until { !@driver.find_elements(:xpath, '//article//button').empty? }
|
54
|
-
rescue => e
|
55
|
-
return false
|
56
|
-
end
|
51
|
+
color = get_follow_btn_color(user_name)
|
57
52
|
|
58
|
-
color
|
59
|
-
return false if color != "rgba(255, 255, 255, 1)"
|
53
|
+
return false if color == false || color != "rgba(255, 255, 255, 1)"
|
60
54
|
|
61
55
|
@driver.find_element(:xpath, '//article//button').click
|
62
56
|
sleep(2)
|
63
57
|
|
64
|
-
|
65
|
-
|
66
|
-
color = @driver.find_element(:xpath, '//article//button').css_value("color")
|
67
|
-
(color == "rgba(255, 255, 255, 1)") ? false : true
|
58
|
+
color = get_follow_btn_color(user_name)
|
59
|
+
(color == false || color == "rgba(255, 255, 255, 1)") ? false : true
|
68
60
|
end
|
69
61
|
|
70
62
|
def delete_follow(user_name)
|
71
|
-
|
72
|
-
begin
|
73
|
-
@wait.until { !@driver.find_elements(:xpath, '//article//button').empty? }
|
74
|
-
rescue => e
|
75
|
-
return false
|
76
|
-
end
|
63
|
+
color = get_follow_btn_color(user_name)
|
77
64
|
|
78
|
-
color
|
79
|
-
return false if color == "rgba(255, 255, 255, 1)"
|
65
|
+
return false if color == false || color == "rgba(255, 255, 255, 1)"
|
80
66
|
|
81
67
|
@driver.find_element(:xpath, '//article//button').click
|
82
68
|
sleep(2)
|
83
69
|
|
84
|
-
|
85
|
-
|
86
|
-
color = @driver.find_element(:xpath, '//article//button').css_value("color")
|
87
|
-
(color != "rgba(255, 255, 255, 1)") ? false : true
|
70
|
+
color = get_follow_btn_color(user_name)
|
71
|
+
(color == false || color != "rgba(255, 255, 255, 1)") ? false : true
|
88
72
|
end
|
89
73
|
|
90
|
-
|
91
|
-
@driver.manage.all_cookies
|
92
|
-
end
|
74
|
+
private
|
93
75
|
|
94
|
-
def
|
95
|
-
@
|
76
|
+
def get_follow_btn_color(user_name)
|
77
|
+
@driver.get "https://www.instagram.com/#{user_name}"
|
78
|
+
begin
|
79
|
+
@wait.until { !@driver.find_elements(:xpath, '//article//button').empty? }
|
80
|
+
rescue => e
|
81
|
+
return false
|
82
|
+
end
|
83
|
+
@driver.find_element(:xpath, '//article//button').css_value("color")
|
96
84
|
end
|
97
85
|
|
98
|
-
private
|
99
|
-
|
100
86
|
def selenium_setting
|
101
87
|
options = Selenium::WebDriver::Chrome::Options.new
|
102
88
|
options.add_argument("--user-agent=#{@user_agent}")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instagram_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuzuru Suzuki
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: guard-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: terminal-notifier
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: terminal-notifier-guard
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: coveralls
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: ffi
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.9.18
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.9.18
|
153
167
|
description: Client for the Instagram Web Service without Instagram API. Implemented
|
154
168
|
in Ruby using the Selenium and Mechanize module.
|
155
169
|
email:
|
@@ -158,11 +172,8 @@ executables: []
|
|
158
172
|
extensions: []
|
159
173
|
extra_rdoc_files: []
|
160
174
|
files:
|
161
|
-
- ".coveralls.yml"
|
162
175
|
- ".gitignore"
|
163
176
|
- ".rspec"
|
164
|
-
- ".rubocop.yml"
|
165
|
-
- ".rubocop_todo.yml"
|
166
177
|
- ".travis.yml"
|
167
178
|
- CODE_OF_CONDUCT.md
|
168
179
|
- Gemfile
|
data/.coveralls.yml
DELETED
data/.rubocop.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
Metrics/AbcSize:
|
4
|
-
Enabled: false
|
5
|
-
# "Missing top-level class documentation comment."を無効
|
6
|
-
Style/Documentation:
|
7
|
-
Enabled: false
|
8
|
-
|
9
|
-
# "Prefer single-quoted strings when you don't need string interpolation or special symbols."を無効
|
10
|
-
Style/StringLiterals:
|
11
|
-
Enabled: false
|
12
|
-
|
13
|
-
# "Line is too long"を無効
|
14
|
-
Metrics/LineLength:
|
15
|
-
Enabled: false
|
data/.rubocop_todo.yml
DELETED
@@ -1,131 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2018-01-29 23:22:25 +0900 using RuboCop version 0.52.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 3
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
|
12
|
-
# Include: **/*.gemspec
|
13
|
-
Gemspec/OrderedDependencies:
|
14
|
-
Exclude:
|
15
|
-
- 'instagram_user.gemspec'
|
16
|
-
|
17
|
-
# Offense count: 1
|
18
|
-
# Cop supports --auto-correct.
|
19
|
-
Layout/EmptyLineAfterMagicComment:
|
20
|
-
Exclude:
|
21
|
-
- 'instagram_user.gemspec'
|
22
|
-
|
23
|
-
# Offense count: 1
|
24
|
-
# Cop supports --auto-correct.
|
25
|
-
# Configuration parameters: EnforcedStyle.
|
26
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
27
|
-
Layout/EmptyLinesAroundClassBody:
|
28
|
-
Exclude:
|
29
|
-
- 'lib/instagram_user/client.rb'
|
30
|
-
|
31
|
-
# Offense count: 1
|
32
|
-
# Cop supports --auto-correct.
|
33
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
34
|
-
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
35
|
-
Layout/IndentHash:
|
36
|
-
Exclude:
|
37
|
-
- 'lib/instagram_user/client.rb'
|
38
|
-
|
39
|
-
# Offense count: 1
|
40
|
-
# Cop supports --auto-correct.
|
41
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
42
|
-
# SupportedStyles: space, no_space
|
43
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
44
|
-
Layout/SpaceBeforeBlockBraces:
|
45
|
-
Exclude:
|
46
|
-
- 'lib/instagram_user/client.rb'
|
47
|
-
|
48
|
-
# Offense count: 1
|
49
|
-
# Cop supports --auto-correct.
|
50
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
51
|
-
# SupportedStyles: space, no_space
|
52
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
53
|
-
Layout/SpaceInsideBlockBraces:
|
54
|
-
Exclude:
|
55
|
-
- 'Gemfile'
|
56
|
-
|
57
|
-
# Offense count: 3
|
58
|
-
# Cop supports --auto-correct.
|
59
|
-
# Configuration parameters: EnforcedStyle.
|
60
|
-
# SupportedStyles: final_newline, final_blank_line
|
61
|
-
Layout/TrailingBlankLines:
|
62
|
-
Exclude:
|
63
|
-
- 'Rakefile'
|
64
|
-
- 'lib/instagram_user/client.rb'
|
65
|
-
- 'spec/instagram_user_spec.rb'
|
66
|
-
|
67
|
-
# Offense count: 1
|
68
|
-
Metrics/CyclomaticComplexity:
|
69
|
-
Max: 9
|
70
|
-
|
71
|
-
# Offense count: 1
|
72
|
-
# Configuration parameters: CountComments.
|
73
|
-
Metrics/MethodLength:
|
74
|
-
Max: 15
|
75
|
-
|
76
|
-
# Offense count: 1
|
77
|
-
Metrics/PerceivedComplexity:
|
78
|
-
Max: 9
|
79
|
-
|
80
|
-
# Offense count: 2
|
81
|
-
# Cop supports --auto-correct.
|
82
|
-
Style/Encoding:
|
83
|
-
Exclude:
|
84
|
-
- 'instagram_user.gemspec'
|
85
|
-
- 'lib/instagram_user/client.rb'
|
86
|
-
|
87
|
-
# Offense count: 2
|
88
|
-
# Configuration parameters: .
|
89
|
-
# SupportedStyles: annotated, template, unannotated
|
90
|
-
Style/FormatStringToken:
|
91
|
-
EnforcedStyle: unannotated
|
92
|
-
|
93
|
-
# Offense count: 2
|
94
|
-
# Cop supports --auto-correct.
|
95
|
-
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
96
|
-
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
97
|
-
Style/HashSyntax:
|
98
|
-
Exclude:
|
99
|
-
- 'Rakefile'
|
100
|
-
|
101
|
-
# Offense count: 2
|
102
|
-
# Cop supports --auto-correct.
|
103
|
-
# Configuration parameters: PreferredDelimiters.
|
104
|
-
Style/PercentLiteralDelimiters:
|
105
|
-
Exclude:
|
106
|
-
- 'instagram_user.gemspec'
|
107
|
-
|
108
|
-
# Offense count: 1
|
109
|
-
# Cop supports --auto-correct.
|
110
|
-
Style/RedundantFreeze:
|
111
|
-
Exclude:
|
112
|
-
- 'lib/instagram_user/client.rb'
|
113
|
-
|
114
|
-
# Offense count: 2
|
115
|
-
# Cop supports --auto-correct.
|
116
|
-
Style/UnneededPercentQ:
|
117
|
-
Exclude:
|
118
|
-
- 'instagram_user.gemspec'
|
119
|
-
|
120
|
-
# Offense count: 1
|
121
|
-
# Cop supports --auto-correct.
|
122
|
-
# Configuration parameters: MinSize, WordRegex.
|
123
|
-
# SupportedStyles: percent, brackets
|
124
|
-
Style/WordArray:
|
125
|
-
EnforcedStyle: brackets
|
126
|
-
|
127
|
-
# Offense count: 10
|
128
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
129
|
-
# URISchemes: http, https
|
130
|
-
Metrics/LineLength:
|
131
|
-
Max: 157
|