-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rb
More file actions
57 lines (52 loc) · 1.99 KB
/
Copy pathmain.rb
File metadata and controls
57 lines (52 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'yaml'
load 'vk.rb'
include VkBot
CONFIG = YAML::load_file( 'config.yml' )
#preferences settings
@username = CONFIG["username"]
@password = CONFIG["password"]
@gender = CONFIG["gender"] #Male/Female
@start_age = CONFIG["start_age"]
@end_age = CONFIG["end_age"]
@country = CONFIG["country"]
@city = CONFIG["city"]
@online = CONFIG["online"] # true/false , apply filter 'online now'
def handler
unless !['Male', 'Female', 'Any'].include? @gender
puts "******************************"
puts "*Welcome to Vk scrapper*"
puts "******************************"
puts
puts "trying..."
#test
puts VkBot.login(@username,@password)
puts "Check the browser if login was successful."
puts "Want to collect profiles? (y/n - use exisitng source file) "
if gets.chomp == "y"
puts "Configuring search.."
VkBot.configSearch(@gender,@start_age,@end_age,@country,@city,@online)
puts "Collecting profiles.."
VkBot.collect
puts "Want to send them a message? y/n"
ans = gets
if ans.chomp == "y"
puts "To how many persons? (empty for all)"
count = gets.chomp
if !count.empty?
msg_src = JSON.parse(File.read('msg.json'))
VkBot.send_message(count,nil,msg_src)
else
VkBot.send_message(nil,nil,msg_src)
end
end
else
puts "Loading profiles from the file ..."
prof_src = JSON.parse(File.read('profiles.json'),{:symbolize_names => true})
msg_src = JSON.parse(File.read('msg.json'))
VkBot.send_message(nil,prof_src, msg_src)
end
end
puts "Goodbye"
end
handler
#VkBot.execute