instabot 0.1.60 → 0.1.70
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.rb +10 -10
- data/lib/instabot/core.rb +1 -1
- data/lib/instabot/create_protocol.rb +1 -1
- data/lib/instabot/grabber.rb +48 -28
- data/lib/instabot/modes.rb +8 -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: dcce24b29e0626b0a5bd78169ddab9f35921bf1e
|
4
|
+
data.tar.gz: 1a8eb1ff3f0e3b9a61004703e56ad5b6d8be2a06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83df48cbcb8673ba3270a59a1f0e497755b2a1c3b08bc5aa865d9a22c5864763b54dabc32da24779f5ab45c2dd83330ad4740efe2280dbfc37e755a66c3cee62
|
7
|
+
data.tar.gz: d1b8423befec9141b89e882c220efc27017b4800aac786bb3a0ab18e4e3dbdb166fc5cda561da10db75cd8dc9b991d845280264285cb57de9f6bc103ded8c935
|
data/lib/instabot.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
require_relative 'instabot/create_protocol'
|
2
|
+
require_relative 'instabot/version'
|
3
|
+
require_relative 'instabot/actions'
|
4
|
+
require_relative 'instabot/grabber'
|
5
|
+
require_relative 'instabot/banner'
|
6
|
+
require_relative 'instabot/logger'
|
7
|
+
require_relative 'instabot/config'
|
8
|
+
require_relative 'instabot/login'
|
9
|
+
require_relative 'instabot/modes'
|
10
|
+
require_relative 'instabot/core'
|
data/lib/instabot/core.rb
CHANGED
@@ -2,7 +2,7 @@ module Protocol
|
|
2
2
|
def create_mechanic
|
3
3
|
@agent = Mechanize.new
|
4
4
|
@agent.max_history = 2
|
5
|
-
@agent.ca_file = './cacert.pem' # Because i
|
5
|
+
# @agent.ca_file = './cacert.pem' # Because i use windows and... you know... ._.
|
6
6
|
@agent.user_agent_alias = ['Mac Mozilla', 'Mac Safari', 'Windows IE 6', 'Windows IE 7', 'Windows IE 8', 'Windows IE 9', 'Windows Mozilla', 'Windows Chrome'].sample
|
7
7
|
if options[:use_proxy]
|
8
8
|
proxy = options[:proxy]
|
data/lib/instabot/grabber.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
2
|
+
|
1
3
|
module Grabber
|
2
|
-
def
|
3
|
-
puts '[+] '.cyan + "Trying to get user (#{user_id})
|
4
|
-
log("Trying to get user (#{user_id})
|
4
|
+
def handle_user_information_data_by_user_id(user_id)
|
5
|
+
puts '[+] '.cyan + "Trying to get user (#{user_id}) information"
|
6
|
+
log("Trying to get user (#{user_id}) information", 'GRABBER')
|
5
7
|
user_page = "https://www.instagram.com/web/friendships/#{user_id}/follow/"
|
6
8
|
response = get_page(user_page)
|
7
9
|
last_page = response.uri.to_s
|
@@ -9,25 +11,57 @@ module Grabber
|
|
9
11
|
response = @agent.get("https://instagram.com/#{username}/?__a=1")
|
10
12
|
data = parse_response(response.body)
|
11
13
|
|
12
|
-
|
14
|
+
set_user_information(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def handle_user_information_data_by_user_name(username)
|
18
|
+
puts '[+] '.cyan + "Trying to get user (#{username}) information"
|
19
|
+
log("Trying to get user (#{username}) information", 'GRABBER')
|
20
|
+
response = @agent.get("https://instagram.com/#{username}/?__a=1")
|
21
|
+
data = parse_response(response.body)
|
22
|
+
|
23
|
+
set_user_information(data)
|
24
|
+
end
|
25
|
+
|
26
|
+
def handle_media_information_data(media_id)
|
27
|
+
puts '[+] '.cyan + "Trying to get media (#{media_id}) information"
|
28
|
+
log("Trying to get media (#{media_id}) information", 'GRABBER')
|
29
|
+
response = @agent.get("https://www.instagram.com/p/#{media_id}/?__a=1")
|
30
|
+
data = parse_response(response.body)
|
31
|
+
|
32
|
+
set_media_information(data)
|
33
|
+
|
34
|
+
unless @infinite_tags == true
|
35
|
+
tags = @media_information[:text].encode('UTF-8', invalid: :replace, undef: :replace, replace: '?').split(/\W+/)
|
36
|
+
id = 0
|
37
|
+
tags.each do |tag|
|
38
|
+
if tag == '_' || tag == '' || tag.nil?
|
39
|
+
tags.delete(tag)
|
40
|
+
else
|
41
|
+
id += 1
|
42
|
+
Config.options.tags << tag
|
43
|
+
end
|
44
|
+
end
|
45
|
+
puts '[+] '.cyan + '[' + id.to_s.yellow + '] New tags added'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def set_user_information(data)
|
50
|
+
@user_information = {
|
13
51
|
followers: data.deep_find('followed_by')['count'],
|
14
52
|
following: data.deep_find('follows')['count'],
|
15
53
|
is_private: data.deep_find('is_private'),
|
16
54
|
is_verified: data.deep_find('is_verified'),
|
17
55
|
username: data.deep_find('username'),
|
18
|
-
|
56
|
+
media_count: data.deep_find('media')['count'],
|
57
|
+
medias: data.deep_find('media')['nodes'],
|
19
58
|
full_name: data.deep_find('full_name'),
|
20
59
|
id: data.deep_find('id')
|
21
|
-
}
|
60
|
+
}.with_indifferent_access
|
22
61
|
end
|
23
62
|
|
24
|
-
def
|
25
|
-
|
26
|
-
log("Trying to get media (#{media_id}) informations", 'GRABBER')
|
27
|
-
response = @agent.get("https://www.instagram.com/p/#{media_id}/?__a=1")
|
28
|
-
data = parse_response(response.body)
|
29
|
-
|
30
|
-
@informations = {
|
63
|
+
def set_media_information(data)
|
64
|
+
@media_information = {
|
31
65
|
id: data.deep_find('id'),
|
32
66
|
full_name: data.deep_find('full_name'),
|
33
67
|
owner: data.deep_find('owner')['username'],
|
@@ -40,21 +74,7 @@ module Grabber
|
|
40
74
|
is_verified: data.deep_find('is_verified'),
|
41
75
|
requested_by_viewer: data.deep_find('requested_by_viewer'),
|
42
76
|
text: data.deep_find('text')
|
43
|
-
}
|
44
|
-
|
45
|
-
unless @infinite_tags == true
|
46
|
-
tags = @informations[:text].encode('UTF-8', invalid: :replace, undef: :replace, replace: '?').split(/\W+/)
|
47
|
-
id = 0
|
48
|
-
tags.each do |tag|
|
49
|
-
if tag == '_' || tag == '' || tag.nil?
|
50
|
-
tags.delete(tag)
|
51
|
-
else
|
52
|
-
id += 1
|
53
|
-
Config.options.tags << tag
|
54
|
-
end
|
55
|
-
end
|
56
|
-
puts '[+] '.cyan + '[' + id.to_s.yellow + '] New tags added'
|
57
|
-
end
|
77
|
+
}.with_indifferent_access
|
58
78
|
end
|
59
79
|
|
60
80
|
def search(tags = [])
|
data/lib/instabot/modes.rb
CHANGED
@@ -67,9 +67,9 @@ module Modes
|
|
67
67
|
while @maximums[:follows_in_day] < @maximums[:max_follows_per_day]
|
68
68
|
begin
|
69
69
|
id += 1 if all_users[id].nil? || all_users[id] == []
|
70
|
-
|
70
|
+
handle_user_information_data_by_user_id(all_users[id])
|
71
71
|
puts '[+] '.cyan + "Trying to follow user [#{all_users[id]}]"
|
72
|
-
follow(@
|
72
|
+
follow(@user_information[:id])
|
73
73
|
puts '[+] '.cyan + 'User followed'.upcase.green.bold
|
74
74
|
@maximums[:follows_in_day] += 1
|
75
75
|
id += 1
|
@@ -113,9 +113,9 @@ module Modes
|
|
113
113
|
id = 0
|
114
114
|
while @maximums[:likes_in_day] < @maximums[:max_likes_per_day]
|
115
115
|
begin
|
116
|
-
|
116
|
+
handle_media_information_data(all_medias[id])
|
117
117
|
puts '[+] '.cyan + "Trying to like media [#{all_medias[id]}]"
|
118
|
-
like(@
|
118
|
+
like(@media_information[:id])
|
119
119
|
puts '[+] '.cyan + 'Media liked'.upcase.green.bold
|
120
120
|
@maximums[:likes_in_day] += 1
|
121
121
|
id += 1
|
@@ -134,15 +134,15 @@ module Modes
|
|
134
134
|
id = 0
|
135
135
|
while @maximums[:comments_in_day] < @maximums[:max_comments_per_day]
|
136
136
|
begin
|
137
|
-
|
138
|
-
if @
|
137
|
+
handle_media_information_data(all_medias[id])
|
138
|
+
if @media_information[:comments_disabled]
|
139
139
|
puts '[-]'.red + 'comments are disable' + "\t[IGNORING]".yellow
|
140
140
|
id += 1
|
141
141
|
next
|
142
142
|
end
|
143
143
|
generated_comment = generate_a_comment
|
144
144
|
puts '[+] '.cyan + "Trying to send a comment[#{generated_comment}] to media[#{all_medias[id]}]"
|
145
|
-
comment(@
|
145
|
+
comment(@media_information[:id], generated_comment)
|
146
146
|
puts '[+] '.cyan + 'comment has been sent'.upcase.green.bold
|
147
147
|
@maximums[:comments_in_day] += 1
|
148
148
|
id += 1
|
@@ -208,4 +208,4 @@ module Modes
|
|
208
208
|
likes_in_day_are_full? && follows_in_day_are_full? &&
|
209
209
|
unfollows_in_day_are_full? && comments_in_day_are_full?
|
210
210
|
end
|
211
|
-
end
|
211
|
+
end
|
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.70
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eVanilla
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|