-
Notifications
You must be signed in to change notification settings - Fork 0
/
phvote.rb
45 lines (37 loc) · 1.05 KB
/
phvote.rb
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
require 'watir'
def hashTheUsers()
all = Hash.new
file = File.open("accounts.txt")
file.each do |x|
index = x.index(" ") #results in going to comma
len = x.length
username = x[0,index-1] #-1 because of comma
pw = x[index+1,len] #1 because no space please
all[username] = pw
end
return all
end
def bringTheMasses(users, link)
users.each do |username, password|
goOutAndVote(username, password, link)
end
puts "Votes Delivered."
end
def goOutAndVote(user, password, link)
b = Watir::Browser.new
sleep(2)
b.goto("producthunt.com/auth/twitter?origin=%2F")
b.text_field(:name => "session[username_or_email]").set(user)
b.text_field(:name => "session[password]").set(password)
sleep(3)
b.goto(link)
sleep(2)
b.span(:class => "arrow_caca7").click
sleep(2)
b.div(:text => "get it").click
sleep(1)
puts "Finished with #{user}"
end
users = hashTheUsers
bringTheMasses(users, "https://www.producthunt.com/posts/link") # copy the link to the actual product and put it here.
goOutAndVote(usernames, passwords, emails)