instabot 0.1.3 → 0.1.11
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/lib/instabot/actions.rb +4 -4
- data/lib/instabot/banner.rb +1 -8
- data/lib/instabot/config.rb +10 -10
- data/lib/instabot/core.rb +1 -2
- data/lib/instabot/create_protocol.rb +1 -1
- data/lib/instabot/grabber.rb +10 -32
- data/lib/instabot/login.rb +5 -8
- data/lib/instabot/modes.rb +11 -8
- data/lib/instabot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aebf42d0021ce467f9c61e3f47f7fb9ec36881d3
|
4
|
+
data.tar.gz: ffa73b58b8da993f113794e59c694254214ba25b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a97f7548c1da4c93f5c91245533a30d283661126a7aec292cf36c923a4bbaaf5fc0976510e3fec481b7d66e6d4d09fac0ac25b7a104a9052c4496f6798d8c07
|
7
|
+
data.tar.gz: 393421fd38087109569499ebab60fe7acdcc0f4a293c9eea188eac5b130c5334aa88f7ec28ee407e337208854ecfa163473ab3f9e149d2cd2af9f04a2a706620
|
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
|
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
|
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
|
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
|
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
@@ -2,15 +2,8 @@ module Banner
|
|
2
2
|
|
3
3
|
def print_banner()
|
4
4
|
puts <<-BANNER
|
5
|
-
|
6
|
-
██║████╗ ██║██╔════╝╚══██╔══╝██╔══██╗██╔══██╗██╔═══██╗╚══██╔══╝
|
7
|
-
██║██╔██╗ ██║███████╗ ██║ ███████║██████╔╝██║ ██║ ██║
|
8
|
-
██║██║╚██╗██║╚════██║ ██║ ██╔══██║██╔══██╗██║ ██║ ██║
|
9
|
-
██║██║ ╚████║███████║ ██║ ██║ ██║██████╔╝╚██████╔╝ ██║
|
10
|
-
╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝
|
11
|
-
|
5
|
+
banner location ...
|
12
6
|
BANNER
|
13
|
-
puts "A instagram bot works without IG api".white.bold + " #Author ".yellow + "github.com/eVanilla".cyan
|
14
7
|
end
|
15
8
|
|
16
9
|
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
|
@@ -14,14 +14,12 @@ module Config
|
|
14
14
|
def initialize
|
15
15
|
@username = nil
|
16
16
|
@password = nil
|
17
|
-
@white_list_users = nil
|
18
|
-
@unwanted_list = nil
|
19
|
-
@wait_per_action = 1 * 60
|
20
17
|
@tags = ["test","hello","hello_world","birthday","food"]
|
21
|
-
@max_like_per_day =
|
22
|
-
@max_follow_per_day =
|
23
|
-
@max_unfollow_per_day =
|
24
|
-
@max_comment_per_day =
|
18
|
+
@max_like_per_day = 10
|
19
|
+
@max_follow_per_day = 10
|
20
|
+
@max_unfollow_per_day = 10
|
21
|
+
@max_comment_per_day = 10
|
22
|
+
@unwanted_list = nil
|
25
23
|
@comments = [
|
26
24
|
["this", "the", "your"],
|
27
25
|
["photo", "picture", "pic", "shot", "snapshot"],
|
@@ -29,9 +27,11 @@ module Config
|
|
29
27
|
["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"],
|
30
28
|
[".", "..", "...", "!","!!","!!!"]
|
31
29
|
]
|
32
|
-
@
|
33
|
-
@
|
30
|
+
@wait_per_action = 1 * 60
|
31
|
+
@white_list_users = nil
|
32
|
+
@infinite_tags = false
|
34
33
|
@pretty_print = true
|
34
|
+
@pre_load = false
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
data/lib/instabot/core.rb
CHANGED
@@ -23,14 +23,13 @@ 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
|
-
@error_404_max_times = 3
|
27
|
-
@error_404_times = 0
|
28
26
|
@local_stroage = {
|
29
27
|
:followed_users => [],
|
30
28
|
:unfollowed_users => [],
|
31
29
|
:liked_medias => [],
|
32
30
|
:commented_medias => []
|
33
31
|
}
|
32
|
+
|
34
33
|
@maximums = {
|
35
34
|
:follows_in_day => 0,
|
36
35
|
:unfollows_in_day => 0,
|
data/lib/instabot/grabber.rb
CHANGED
@@ -2,24 +2,12 @@ module Grabber
|
|
2
2
|
|
3
3
|
def get_user_informations(user_id)
|
4
4
|
# puts "=".cyan*10
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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)
|
5
|
+
user_page = "https://www.instagram.com/web/friendships/#{user_id}/follow/"
|
6
|
+
@agent.get(user_page)
|
7
|
+
last_page = @agent.history.last.uri.to_s
|
8
|
+
username = last_page.split('/')[3]
|
9
|
+
user_info = @agent.get("https://instagram.com/#{username}/?__a=1")
|
10
|
+
data = JSON.parse(user_info.body)
|
23
11
|
data.extend Hashie::Extensions::DeepFind
|
24
12
|
|
25
13
|
# File.open("body.json", "w+") {|file| file.puts data.extend Hashie::Extensions::DeepFind }
|
@@ -34,25 +22,14 @@ module Grabber
|
|
34
22
|
id: data.deep_find("id")
|
35
23
|
}
|
36
24
|
# puts @informations
|
25
|
+
|
37
26
|
end
|
38
27
|
|
39
28
|
def get_media_informations(media_id)
|
40
29
|
# puts "=".cyan*10
|
41
30
|
custom_puts "[+] ".cyan + "Trying to get media (#{media_id}) information"
|
42
|
-
|
43
|
-
|
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)
|
31
|
+
media_info = @agent.get("https://www.instagram.com/p/#{media_id}/?__a=1")
|
32
|
+
data = JSON.parse(media_info.body)
|
56
33
|
data.extend Hashie::Extensions::DeepFind
|
57
34
|
# pp data.extend Hashie::Extensions::DeepFind
|
58
35
|
|
@@ -97,6 +74,7 @@ module Grabber
|
|
97
74
|
end
|
98
75
|
# puts @informations
|
99
76
|
|
77
|
+
|
100
78
|
end
|
101
79
|
|
102
80
|
|
data/lib/instabot/login.rb
CHANGED
@@ -8,13 +8,13 @@ module Login
|
|
8
8
|
page_form.username = options[:username]
|
9
9
|
page_form.password = options[:password]
|
10
10
|
page = page_form.submit
|
11
|
-
if page.code == "200"
|
11
|
+
if page.code == "200" || page.code == "302"
|
12
12
|
@login_status = true
|
13
13
|
log("successfully logged in")
|
14
14
|
custom_print "[+] ".cyan + "Successfully logged in".green.bold
|
15
15
|
else
|
16
16
|
@login_status = false
|
17
|
-
custom_print "[-] ".cyan + "Invalid username or password
|
17
|
+
custom_print "[-] ".cyan + "Invalid username or password".red.bold
|
18
18
|
exit
|
19
19
|
end
|
20
20
|
puts
|
@@ -34,15 +34,12 @@ module Login
|
|
34
34
|
custom_print "[+] ".cyan + "Successfully logged out"
|
35
35
|
end
|
36
36
|
|
37
|
-
def check_login_status
|
37
|
+
def check_login_status
|
38
38
|
# custom_print "[+] ".cyan + "Checking login status"
|
39
39
|
log("checking loging status")
|
40
|
-
|
41
|
-
return true
|
42
|
-
else
|
40
|
+
unless @login_status
|
43
41
|
custom_print "[-] ".cyan + "you're not logged in.".red.bold
|
44
|
-
|
45
|
-
login if mode == :auto_retry
|
42
|
+
login
|
46
43
|
end
|
47
44
|
end
|
48
45
|
|
data/lib/instabot/modes.rb
CHANGED
@@ -47,11 +47,15 @@ module Modes
|
|
47
47
|
sleep 1
|
48
48
|
end
|
49
49
|
end
|
50
|
-
when :
|
50
|
+
when :cleanup
|
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
|
55
59
|
when :default
|
56
60
|
custom_print "[-] ".cyan + "Please choose a mode".red
|
57
61
|
else
|
@@ -100,7 +104,7 @@ module Modes
|
|
100
104
|
# users.each do |user|
|
101
105
|
followed_users = @local_stroage[:followed_users]
|
102
106
|
custom_puts "[+] ".cyan + "#{followed_users.size} users ready to unfollow"
|
103
|
-
id
|
107
|
+
id = 0
|
104
108
|
while @maximums[:unfollows_in_day] < @maximums[:max_unfollows_per_day]
|
105
109
|
if @local_stroage[:followed_users].size < @maximums[:max_unfollows_per_day]
|
106
110
|
begin
|
@@ -110,7 +114,7 @@ module Modes
|
|
110
114
|
# custom_print "unfollowed_users[id] => #{unfollowed_users[id]}"
|
111
115
|
custom_puts "[+] ".cyan + "Trying to unfollow a user [#{followed_users[id]}]"
|
112
116
|
unfollow(followed_users[id])
|
113
|
-
custom_puts "\n[+] ".cyan + "User unfollowed".bold.green
|
117
|
+
custom_puts "\n[+] ".cyan + "User unfollowed!".bold.green
|
114
118
|
@maximums[:unfollows_in_day] += 1
|
115
119
|
id += 1
|
116
120
|
# custom_print "unfollows_in_day = #{@maximums[:unfollows_in_day]} || max_unfollows_per_day = #{@maximums[:max_unfollows_per_day]} || id = #{id}"
|
@@ -121,8 +125,8 @@ module Modes
|
|
121
125
|
retry
|
122
126
|
end
|
123
127
|
else
|
124
|
-
custom_print "[+] ".cyan + "[unfollow per day] is bigger than
|
125
|
-
|
128
|
+
custom_print "[+] ".cyan + "[unfollow users per day] is bigger than followed users"
|
129
|
+
break
|
126
130
|
end
|
127
131
|
end
|
128
132
|
end
|
@@ -130,7 +134,7 @@ module Modes
|
|
130
134
|
def auto_like
|
131
135
|
# medias.each do |media|
|
132
136
|
all_medias = medias
|
133
|
-
custom_puts "[+] ".cyan + "#{all_medias.size}
|
137
|
+
custom_puts "[+] ".cyan + "#{all_medias.size} medias ready to like"
|
134
138
|
id = 0
|
135
139
|
while @maximums[:likes_in_day] < @maximums[:max_likes_per_day]
|
136
140
|
begin
|
@@ -155,12 +159,11 @@ module Modes
|
|
155
159
|
def auto_comment
|
156
160
|
# medias.each do |media|
|
157
161
|
all_medias = medias
|
158
|
-
custom_puts "[+] ".cyan + "#{all_medias.size}
|
162
|
+
custom_puts "[+] ".cyan + "#{all_medias.size} medias ready to send a comment"
|
159
163
|
id = 0
|
160
164
|
while @maximums[:comments_in_day] < @maximums[:max_comments_per_day]
|
161
165
|
begin
|
162
166
|
get_media_informations(all_medias[id])
|
163
|
-
id += 1 if @informations[:comments_disabled]
|
164
167
|
# custom_print "media informations:".cyan
|
165
168
|
# @informations.map {|key,val| custom_print "#{key}: #{val}"}
|
166
169
|
custom_puts "[+] ".cyan + "Trying to send a comment to media[#{all_medias[id]}]"
|
data/lib/instabot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eVanilla
|
@@ -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. written on ruby
|
117
117
|
email:
|
118
118
|
- ''
|
119
119
|
executables: []
|