instabot 0.1.11 → 0.1.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instabot/actions.rb +4 -4
- data/lib/instabot/banner.rb +12 -3
- data/lib/instabot/config.rb +14 -11
- data/lib/instabot/core.rb +33 -20
- data/lib/instabot/create_protocol.rb +1 -1
- data/lib/instabot/grabber.rb +32 -10
- data/lib/instabot/logger.rb +2 -0
- data/lib/instabot/login.rb +20 -10
- data/lib/instabot/modes.rb +8 -11
- data/lib/instabot/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f808851229fae36a82e51941365164b50749f143
|
4
|
+
data.tar.gz: 52b4340f9cf369c776493d0f394a32fd347eda2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f1d2fba7b8916ce434eb64506afc72b49780d7b7c01b51564715b3974c0ae004cffd8fbfc19b0d7b6df01a5668c06a55285f3ee38233de00a56c6dffc9d753c
|
7
|
+
data.tar.gz: 86d9f7bb7271f831ce0ce63f804385190f45a17034d85f621e1ade9f9f4fcbfc3afb626ece683f8fa9f49a4470f61ed2eab592206b7ff5fc00091823caaab203
|
data/lib/instabot/actions.rb
CHANGED
@@ -2,7 +2,7 @@ module Actions
|
|
2
2
|
|
3
3
|
def follow(user_id)
|
4
4
|
log("trying to follow a user [#{user_id}]")
|
5
|
-
check_login_status
|
5
|
+
check_login_status(:auto_retry)
|
6
6
|
follow_url = "https://www.instagram.com/web/friendships/#{user_id}/follow/"
|
7
7
|
set_mechanic_data
|
8
8
|
response = @agent.post(follow_url, @params, @headers)
|
@@ -14,7 +14,7 @@ module Actions
|
|
14
14
|
|
15
15
|
def unfollow(user_id)
|
16
16
|
log("trying to unfollow a user [#{user_id}]")
|
17
|
-
check_login_status
|
17
|
+
check_login_status(:auto_retry)
|
18
18
|
unfollow_url = "https://www.instagram.com/web/friendships/#{user_id}/unfollow/"
|
19
19
|
set_mechanic_data
|
20
20
|
response = @agent.post(unfollow_url, @params, @headers)
|
@@ -26,7 +26,7 @@ module Actions
|
|
26
26
|
|
27
27
|
def like(media_id)
|
28
28
|
log("trying to like a media[#{media_id}]")
|
29
|
-
check_login_status
|
29
|
+
check_login_status(:auto_retry)
|
30
30
|
comment_url = "https://www.instagram.com/web/likes/#{media_id}/like/"
|
31
31
|
set_mechanic_data
|
32
32
|
response = @agent.post(comment_url, @params, @headers)
|
@@ -38,7 +38,7 @@ module Actions
|
|
38
38
|
|
39
39
|
def comment(media_id=0, text="")
|
40
40
|
log("trying to send a comment to media[#{media_id}]")
|
41
|
-
check_login_status
|
41
|
+
check_login_status(:auto_retry)
|
42
42
|
comment_url = "https://www.instagram.com/web/comments/#{media_id}/add/"
|
43
43
|
set_mechanic_data({ comment_text: text.to_s })
|
44
44
|
response = @agent.post(comment_url, @params, @headers)
|
data/lib/instabot/banner.rb
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
module Banner
|
2
2
|
|
3
3
|
def print_banner()
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
if options[:print_banner]
|
5
|
+
puts <<-BANNER
|
6
|
+
██╗███╗ ██╗███████╗████████╗ █████╗ ██████╗ ██████╗ ████████╗
|
7
|
+
██║████╗ ██║██╔════╝╚══██╔══╝██╔══██╗██╔══██╗██╔═══██╗╚══██╔══╝
|
8
|
+
██║██╔██╗ ██║███████╗ ██║ ███████║██████╔╝██║ ██║ ██║
|
9
|
+
██║██║╚██╗██║╚════██║ ██║ ██╔══██║██╔══██╗██║ ██║ ██║
|
10
|
+
██║██║ ╚████║███████║ ██║ ██║ ██║██████╔╝╚██████╔╝ ██║
|
11
|
+
╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝
|
12
|
+
|
13
|
+
BANNER
|
14
|
+
puts "A instagram bot works without IG api".white.bold + " #Author ".yellow + "github.com/eVanilla".cyan
|
15
|
+
end
|
7
16
|
end
|
8
17
|
|
9
18
|
end
|
data/lib/instabot/config.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Config
|
2
|
-
|
2
|
+
|
3
3
|
class << self
|
4
4
|
attr_accessor :options
|
5
5
|
end
|
@@ -10,16 +10,19 @@ module Config
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class Configuration
|
13
|
-
attr_accessor :username, :password, :tags, :comments, :pretty_print, :pre_load, :wait_per_action, :infinite_tags, :max_like_per_day, :max_follow_per_day, :max_unfollow_per_day, :max_comment_per_day, :unwanted_list, :white_list_users
|
13
|
+
attr_accessor :username, :password, :tags, :comments, :pretty_print, :print_banner, :pre_load, :wait_per_action, :infinite_tags, :max_like_per_day, :max_follow_per_day, :max_unfollow_per_day, :max_comment_per_day, :unwanted_list, :white_list_users#, :print_logs
|
14
14
|
def initialize
|
15
15
|
@username = nil
|
16
16
|
@password = nil
|
17
|
-
@
|
18
|
-
@max_like_per_day = 10
|
19
|
-
@max_follow_per_day = 10
|
20
|
-
@max_unfollow_per_day = 10
|
21
|
-
@max_comment_per_day = 10
|
17
|
+
@white_list_users = nil
|
22
18
|
@unwanted_list = nil
|
19
|
+
@wait_per_action = 1 * 60
|
20
|
+
@tags = ["test","hello","hello_world","birthday","food"]
|
21
|
+
@max_like_per_day = 50
|
22
|
+
@max_follow_per_day = 50
|
23
|
+
@max_unfollow_per_day = 50
|
24
|
+
@max_comment_per_day = 50
|
25
|
+
@print_logs = true
|
23
26
|
@comments = [
|
24
27
|
["this", "the", "your"],
|
25
28
|
["photo", "picture", "pic", "shot", "snapshot"],
|
@@ -27,11 +30,11 @@ module Config
|
|
27
30
|
["great", "super", "good", "very good", "good","wow", "WOW", "cool", "GREAT","magnificent","magical", "very cool", "stylish", "beautiful","so beautiful", "so stylish","so professional","lovely", "so lovely","very lovely", "glorious","so glorious","very glorious", "adorable", "excellent","amazing"],
|
28
31
|
[".", "..", "...", "!","!!","!!!"]
|
29
32
|
]
|
30
|
-
@
|
31
|
-
@
|
32
|
-
@infinite_tags = false
|
33
|
+
@infinite_tags = true
|
34
|
+
@pre_load = true
|
33
35
|
@pretty_print = true
|
34
|
-
@
|
36
|
+
@print_banner = true
|
37
|
+
# @print_logs = true
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
data/lib/instabot/core.rb
CHANGED
@@ -14,7 +14,7 @@ class Instabot
|
|
14
14
|
attr_accessor :users, :medias
|
15
15
|
|
16
16
|
def initialize(mode=:default)
|
17
|
-
|
17
|
+
@login_mode = mode
|
18
18
|
@users = []
|
19
19
|
@medias = []
|
20
20
|
@log_counter = 0
|
@@ -23,6 +23,7 @@ class Instabot
|
|
23
23
|
@root_dir = "#{Dir.pwd}"
|
24
24
|
@logs_dir = "#@root_dir/logs"
|
25
25
|
@global_time = Time.new.strftime("%H-%M-%S--%y-%m-%d")
|
26
|
+
Configuration.new if @login_mode == :manual
|
26
27
|
@local_stroage = {
|
27
28
|
:followed_users => [],
|
28
29
|
:unfollowed_users => [],
|
@@ -67,23 +68,32 @@ class Instabot
|
|
67
68
|
|
68
69
|
|
69
70
|
def options
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
71
|
+
if @login_mode == :default
|
72
|
+
return {
|
73
|
+
:username => Config.options.username,
|
74
|
+
:password => Config.options.password,
|
75
|
+
:tags => Config.options.tags,
|
76
|
+
:max_like_per_day => Config.options.max_like_per_day,
|
77
|
+
:max_follow_per_day => Config.options.max_follow_per_day,
|
78
|
+
:max_unfollow_per_day => Config.options.max_unfollow_per_day,
|
79
|
+
:max_comment_per_day => Config.options.max_comment_per_day,
|
80
|
+
:unwanted_list => Config.options.unwanted_list,
|
81
|
+
:white_list_users => Config.options.white_list_users,
|
82
|
+
:wait_per_action => Config.options.wait_per_action,
|
83
|
+
:comments => Config.options.comments,
|
84
|
+
:pre_load => Config.options.pre_load,
|
85
|
+
:pretty_print => Config.options.pretty_print,
|
86
|
+
:print_banner => Config.options.print_banner
|
87
|
+
# :print_logs => Config.options.print_logs
|
88
|
+
}
|
89
|
+
else
|
90
|
+
return {
|
91
|
+
:max_like_per_day => :infinite,
|
92
|
+
:max_follow_per_day => :infinite,
|
93
|
+
:max_unfollow_per_day => :infinite,
|
94
|
+
:max_comment_per_day => :infinite
|
95
|
+
}
|
96
|
+
end
|
87
97
|
end
|
88
98
|
|
89
99
|
def custom_puts(text="")
|
@@ -118,9 +128,12 @@ class Instabot
|
|
118
128
|
create_mechanic
|
119
129
|
custom_print "[+] ".cyan + "Processing successfully completed"
|
120
130
|
puts
|
121
|
-
|
131
|
+
|
132
|
+
if mode == :default
|
122
133
|
login
|
123
|
-
|
134
|
+
elsif mode == :manual
|
135
|
+
else
|
136
|
+
end
|
124
137
|
|
125
138
|
end
|
126
139
|
|
data/lib/instabot/grabber.rb
CHANGED
@@ -2,12 +2,24 @@ module Grabber
|
|
2
2
|
|
3
3
|
def get_user_informations(user_id)
|
4
4
|
# puts "=".cyan*10
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
begin
|
6
|
+
user_page = "https://www.instagram.com/web/friendships/#{user_id}/follow/"
|
7
|
+
response = get_page(user_page)
|
8
|
+
last_page = @agent.history.last.uri.to_s
|
9
|
+
username = last_page.split('/')[3]
|
10
|
+
response = @agent.get("https://instagram.com/#{username}/?__a=1")
|
11
|
+
rescue Exception => e
|
12
|
+
if response.code == "404"
|
13
|
+
puts "ERORR: [404] Notfound\t#{e.message}".red
|
14
|
+
exit!
|
15
|
+
elsif response.code == "403"
|
16
|
+
exit! if @error_403_times == 3
|
17
|
+
@error_403_times += 1
|
18
|
+
puts "ERROR: [403] (looks like you're banned from IG)".red
|
19
|
+
retry
|
20
|
+
end
|
21
|
+
end
|
22
|
+
data = JSON.parse(response.body)
|
11
23
|
data.extend Hashie::Extensions::DeepFind
|
12
24
|
|
13
25
|
# File.open("body.json", "w+") {|file| file.puts data.extend Hashie::Extensions::DeepFind }
|
@@ -22,14 +34,25 @@ module Grabber
|
|
22
34
|
id: data.deep_find("id")
|
23
35
|
}
|
24
36
|
# puts @informations
|
25
|
-
|
26
37
|
end
|
27
38
|
|
28
39
|
def get_media_informations(media_id)
|
29
40
|
# puts "=".cyan*10
|
30
41
|
custom_puts "[+] ".cyan + "Trying to get media (#{media_id}) information"
|
31
|
-
|
32
|
-
|
42
|
+
begin
|
43
|
+
response = @agent.get("https://www.instagram.com/p/#{media_id}/?__a=1")
|
44
|
+
rescue Exception => e
|
45
|
+
if response.code == "404"
|
46
|
+
puts "ERORR: [404] Notfound\t#{e.message}".red
|
47
|
+
exit!
|
48
|
+
elsif response.code == "403"
|
49
|
+
exit! if @error_403_times == 3
|
50
|
+
@error_403_times += 1
|
51
|
+
puts "ERROR: [403] (looks like you're banned from IG)".red
|
52
|
+
retry
|
53
|
+
end
|
54
|
+
end
|
55
|
+
data = JSON.parse(response.body)
|
33
56
|
data.extend Hashie::Extensions::DeepFind
|
34
57
|
# pp data.extend Hashie::Extensions::DeepFind
|
35
58
|
|
@@ -74,7 +97,6 @@ module Grabber
|
|
74
97
|
end
|
75
98
|
# puts @informations
|
76
99
|
|
77
|
-
|
78
100
|
end
|
79
101
|
|
80
102
|
|
data/lib/instabot/logger.rb
CHANGED
data/lib/instabot/login.rb
CHANGED
@@ -1,27 +1,34 @@
|
|
1
1
|
module Login
|
2
2
|
|
3
|
-
def login
|
3
|
+
def login(username="", password="")
|
4
|
+
if @login_mode == :manual
|
5
|
+
username = username.to_s
|
6
|
+
password = password.to_s
|
7
|
+
else
|
8
|
+
username = options[:username]
|
9
|
+
password = options[:password]
|
10
|
+
end
|
4
11
|
log("trying to login")
|
5
|
-
custom_print "[+] ".cyan + "Trying to login into [#{
|
12
|
+
custom_print "[+] ".cyan + "Trying to login into [#{username}] account"
|
6
13
|
login_page = @agent.get("https://www.instagram.com/accounts/login/?force_classic_login")
|
7
14
|
page_form = login_page.forms.last
|
8
|
-
page_form.username =
|
9
|
-
page_form.password =
|
15
|
+
page_form.username = username
|
16
|
+
page_form.password = password
|
10
17
|
page = page_form.submit
|
11
|
-
if page.code == "200"
|
18
|
+
if page.code == "200"
|
12
19
|
@login_status = true
|
13
20
|
log("successfully logged in")
|
14
21
|
custom_print "[+] ".cyan + "Successfully logged in".green.bold
|
15
22
|
else
|
16
23
|
@login_status = false
|
17
|
-
custom_print "[-] ".cyan + "Invalid username or password".red.bold
|
24
|
+
custom_print "[-] ".cyan + "Invalid username or password or maybe a bug!".red.bold
|
18
25
|
exit
|
19
26
|
end
|
20
27
|
puts
|
21
28
|
rescue Exception => e
|
22
29
|
log("a error detected: #{e.class} #{e}")
|
23
30
|
@login_status = false
|
24
|
-
custom_print "[-] ".cyan + "#{e.class} #{e.message}
|
31
|
+
custom_print "[-] ".cyan + "#{e.class} #{e.message}".red
|
25
32
|
end
|
26
33
|
|
27
34
|
def logout
|
@@ -34,12 +41,15 @@ module Login
|
|
34
41
|
custom_print "[+] ".cyan + "Successfully logged out"
|
35
42
|
end
|
36
43
|
|
37
|
-
def check_login_status
|
44
|
+
def check_login_status(mode=:default)
|
38
45
|
# custom_print "[+] ".cyan + "Checking login status"
|
39
46
|
log("checking loging status")
|
40
|
-
|
47
|
+
if @login_status
|
48
|
+
return true
|
49
|
+
else
|
41
50
|
custom_print "[-] ".cyan + "you're not logged in.".red.bold
|
42
|
-
|
51
|
+
return false
|
52
|
+
login if mode == :auto_retry
|
43
53
|
end
|
44
54
|
end
|
45
55
|
|
data/lib/instabot/modes.rb
CHANGED
@@ -47,15 +47,11 @@ module Modes
|
|
47
47
|
sleep 1
|
48
48
|
end
|
49
49
|
end
|
50
|
-
when :
|
50
|
+
when :clean_up
|
51
51
|
custom_puts "[+] ".cyan + "Clean up mode is turned on"
|
52
52
|
@local_stroage[:followed_users].each do |user|
|
53
53
|
unfollow(user)
|
54
54
|
end
|
55
|
-
# users.each do |user|
|
56
|
-
# get_user_informations(user)
|
57
|
-
# unfollow(@informations[:id])
|
58
|
-
# end
|
59
55
|
when :default
|
60
56
|
custom_print "[-] ".cyan + "Please choose a mode".red
|
61
57
|
else
|
@@ -104,7 +100,7 @@ module Modes
|
|
104
100
|
# users.each do |user|
|
105
101
|
followed_users = @local_stroage[:followed_users]
|
106
102
|
custom_puts "[+] ".cyan + "#{followed_users.size} users ready to unfollow"
|
107
|
-
id
|
103
|
+
id = 0
|
108
104
|
while @maximums[:unfollows_in_day] < @maximums[:max_unfollows_per_day]
|
109
105
|
if @local_stroage[:followed_users].size < @maximums[:max_unfollows_per_day]
|
110
106
|
begin
|
@@ -114,7 +110,7 @@ module Modes
|
|
114
110
|
# custom_print "unfollowed_users[id] => #{unfollowed_users[id]}"
|
115
111
|
custom_puts "[+] ".cyan + "Trying to unfollow a user [#{followed_users[id]}]"
|
116
112
|
unfollow(followed_users[id])
|
117
|
-
custom_puts "\n[+] ".cyan + "User unfollowed
|
113
|
+
custom_puts "\n[+] ".cyan + "User unfollowed".bold.green
|
118
114
|
@maximums[:unfollows_in_day] += 1
|
119
115
|
id += 1
|
120
116
|
# custom_print "unfollows_in_day = #{@maximums[:unfollows_in_day]} || max_unfollows_per_day = #{@maximums[:max_unfollows_per_day]} || id = #{id}"
|
@@ -125,8 +121,8 @@ module Modes
|
|
125
121
|
retry
|
126
122
|
end
|
127
123
|
else
|
128
|
-
custom_print "[+] ".cyan + "[unfollow
|
129
|
-
|
124
|
+
custom_print "[+] ".cyan + "[unfollow per day] is bigger than [follow per day]"
|
125
|
+
exit
|
130
126
|
end
|
131
127
|
end
|
132
128
|
end
|
@@ -134,7 +130,7 @@ module Modes
|
|
134
130
|
def auto_like
|
135
131
|
# medias.each do |media|
|
136
132
|
all_medias = medias
|
137
|
-
custom_puts "[+] ".cyan + "#{all_medias.size}
|
133
|
+
custom_puts "[+] ".cyan + "#{all_medias.size} Medias ready to like"
|
138
134
|
id = 0
|
139
135
|
while @maximums[:likes_in_day] < @maximums[:max_likes_per_day]
|
140
136
|
begin
|
@@ -159,11 +155,12 @@ module Modes
|
|
159
155
|
def auto_comment
|
160
156
|
# medias.each do |media|
|
161
157
|
all_medias = medias
|
162
|
-
custom_puts "[+] ".cyan + "#{all_medias.size}
|
158
|
+
custom_puts "[+] ".cyan + "#{all_medias.size} Medias ready to send a comment"
|
163
159
|
id = 0
|
164
160
|
while @maximums[:comments_in_day] < @maximums[:max_comments_per_day]
|
165
161
|
begin
|
166
162
|
get_media_informations(all_medias[id])
|
163
|
+
id += 1 if @informations[:comments_disabled]
|
167
164
|
# custom_print "media informations:".cyan
|
168
165
|
# @informations.map {|key,val| custom_print "#{key}: #{val}"}
|
169
166
|
custom_puts "[+] ".cyan + "Trying to send a comment to media[#{all_medias[id]}]"
|
data/lib/instabot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instabot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eVanilla
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,7 +113,7 @@ dependencies:
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: 5.1.4
|
115
115
|
description: A instagram bot works without instagram api, only needs your username
|
116
|
-
and password
|
116
|
+
and password
|
117
117
|
email:
|
118
118
|
- ''
|
119
119
|
executables: []
|