Created
December 10, 2014 14:15
-
-
Save slindsey3000/799a5b1248d9aec6a1d6 to your computer and use it in GitHub Desktop.
Bot to ask out all girls who fit your criteria on dating site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/setup" | |
require "Nokogiri" | |
require "watir" | |
require 'watir-webdriver' | |
require "watir-webdriver/extensions/alerts" | |
require "active_record" | |
#### First Ruby script ever written #### It worked! Went on plenty of dates. Getting married to one now! (She knows about "the bot" too | |
# Note this script will not work on the site (not mentioning) anymore. They have changed the HTML on the pages. | |
# This script will log into a dating website and ask out tons of girls for you. | |
# Some hot ones actually say yes! it's amazing what happens when you ask out 100's of girls a day | |
# set up a mysql database with name "okc" and user root >> see config stuff at bottom | |
#COMMAND LINE USAGE | |
# ruby okcbot.rb harvest 10 ---> harvests 10 pages of girls | |
# ruby okcbot.rb Steve 40 Dan 20 Larry 100 ---> runs bot for each person messaging at most #number girls | |
# set $HARVEST_BOT to get matches for that bot | |
# add girls to $XLIST to not match them or visit them. | |
# | |
$0 = "okcbot\0" | |
puts "version #{RUBY_VERSION}" | |
$PASS = "password" # password to the sql database you set up | |
$URL = "http://XXXXX.com" | |
$HARVEST_BOT = "test" # If you configure a few bots you can set the harvest bot | |
$XLIST = [""] # Fill this array with girls you don't want the bot to even look at | |
$GREAT_BODYS = ["Skinny","Fit","Thin","Athletic"] | |
$UNSURE_BODYS = ["-","Jacked"] | |
$AVERAGE_BODYS = ["AVERAGE"] | |
$MARGINAL_BODYS = ["Curvy","A Little Extra"] | |
$CURVY_BODYS = ["Curvy"] | |
$BAD_BODYS = ["Fat"] | |
$Y_BODYS = $GREAT_BODYS + $AVERAGE_BODYS + $UNSURE_BODYS | |
$EVERYTHING_BUT_FAT_BODYS = $GREAT_BODYS + $UNSURE_BODYS + $AVERAGE_BODYS + $MARGINAL_BODYS | |
$ALL_BODYS = $GREAT_BODYS + $UNSURE_BODYS + $AVERAGE_BODYS + $MARGINAL_BODYS + $BAD_BODYS | |
$GOOD_BODYS = $GREAT_BODYS + $UNSURE_BODYS | |
$OK_BODYS = $UNSURE_BODYS + $AVERAGE_BODYS | |
$KENT_BODYS = ["Fit","Athletic"] | |
$SEARCH_RADIUS = ["25 miles","50 miles"].sample | |
$MIN_AGE = "24" # SET ALL THESE TO CUSTOMIZE | |
$MAX_AGE = "35" | |
$HARVEST_PAGES = 10 # make these smaller if you have been running the bot daily for a few days. | |
$PROFILE_CHECKS = 90 # $HARVEST_PAGES is how many pages of profiles the bot harvests | |
# $PROFILE_CHECKS is how many profiles bot visits before begining to ask girls out | |
class Profile < ActiveRecord::Base | |
serialize :accept_keywords, Array | |
serialize :accept_interests, Array | |
has_many :interactions | |
has_many :bots, :through => :interactions | |
end | |
class Interaction < ActiveRecord::Base | |
belongs_to :profile | |
belongs_to :bot | |
end | |
class Bot < ActiveRecord::Base | |
serialize :accept_gender, Array | |
serialize :accept_body_types, Array | |
serialize :accept_language, Array | |
serialize :accept_kids, Array | |
serialize :accept_kids, Array | |
serialize :accept_city, Array | |
serialize :accept_state, Array | |
serialize :accept_keywords, Array | |
serialize :accept_interests, Array | |
has_many :interactions | |
has_many :profiles, :through => :interactions | |
end | |
class Message < ActiveRecord::Base | |
end | |
def login_okc(browser, username, password, url = $URL) | |
begin | |
browser.goto url + "/logout" | |
sleep(3) | |
browser.goto url | |
#f = browser.form(:name, "loginf") | |
browser.link(:id, "open_sign_in_button").click | |
browser.text_field(:name, "username").set username | |
sleep(rand(4)+1) | |
browser.text_field(:name, "password").set password | |
sleep(2) | |
browser.button(:id,"sign_in_button").click | |
rescue Exception => err | |
puts "Probably taking a long time to render. ** GOING TO RETRY LOGIN ** : Error is: #{err}" | |
retry | |
end | |
end | |
def get_profile_names(browser, harvest_number = 30, min_age = $MIN_AGE, max_age = $MAX_AGE, search_radius = $SEARCH_RADIUS, url = $URL) | |
browser.goto url + "/match" # 3600 86400 604800 | |
sleep(10) | |
last_login = [3600,86400,604800].sample | |
match_filter_string = "MATCH_FILTER_LAST_LOGIN#{last_login}_hidden_text" | |
#browser.execute_script("Frm.set('MATCH_FILTER_LAST_LOGIN','315360000','last_online_select','MATCH_FILTER_LAST_LOGIN315360000_hidden_text',false,'Online %s');") | |
sleep(0) | |
#browser.execute_script("Frm.set('MATCH_FILTER_GENTATION','34','gentation_select','MATCH_FILTER_GENTATION34_base_text',false,'');") | |
sleep(0) | |
#browser.execute_script("Frm.toggle('ages','toggle');return false;") | |
sleep(2) | |
#browser.text_field(:name, "agemin").set min_age | |
#browser.text_field(:name, "agemax").set max_age | |
sleep(1) | |
#browser.execute_script("Frm.process_age()") | |
sleep(0) | |
#browser.execute_script("Frm.toggle('location_interface','toggle');return false;") | |
#browser.radio(:id, "nearme").set | |
#browser.execute_script("Frm.location_swaps('nearme'); Mc.location_text();") | |
sleep(0) | |
#browser.select_list(:name, "radius").select(search_radius) | |
#browser.execute_script("Mc.location_text();") | |
sleep(0) | |
#browser.execute_script("Frm.set('MATCH_FILTER_REQUIRE_PHOTO','0','only_photos','MATCH_FILTER_REQUIRE_PHOTO0_base_text',false,'');") | |
sleep(1) | |
#browser.execute_script("Mc.submit_form(); return false;") | |
sleep(3) | |
harvest_number.times do | |
begin | |
sleep(rand(4)) | |
browser.send_keys :space | |
rescue Exception => err | |
puts "Error getting matches ** #{err}" | |
end | |
end | |
begin | |
doc = Nokogiri::HTML(browser.html) | |
doc.css('span.username').each do |user| | |
print "Found: #{user.content} " | |
unless Profile.where(:username => user.content).exists? | |
puts "Adding #{user.content} to database." | |
Profile.create(:username => user.content) | |
else | |
puts "** DUPLICATE **" | |
end | |
end | |
rescue Exception => err | |
puts "Error Caught while harvesting names ********** #{err}" | |
end | |
end | |
def inbox_full?(browser, url = $URL) | |
browser.goto url + "/messages" | |
doc = Nokogiri::HTML(browser.html) | |
return browser.link(:href, /low=151/).exists? | |
end | |
def sentmail_full?(browser, url = $URL) | |
browser.goto url + "/messages?folder=2" | |
doc = Nokogiri::HTML(browser.html) | |
return browser.link(:href, /low=151/).exists? | |
end | |
def clear_inbox(browser, url = $URL) | |
browser.goto url + "/messages" | |
doc = Nokogiri::HTML(browser.html) | |
messages_there = browser.li(:id, /message_/).exists? | |
puts "messages_there is: #{messages_there} .. with class: #{messages_there.class}" | |
sleep(3) | |
while messages_there | |
begin | |
selectall_link = browser.link(:href,/selectall/) | |
selectall_link.click | |
sleep(3) | |
browser.execute_script("Mailbox.deleteThreads(); return false;") | |
sleep(6) | |
browser.execute_script("window.confirm = function() {return true}") | |
sleep(6) | |
rescue Exception => err | |
sleep(3) | |
puts "in rescue with error: #{err}" | |
ensure | |
browser.goto url + "/messages" | |
sleep(4) | |
messages_there = browser.li(:id, /message_/).exists? | |
puts "messages_there is: #{messages_there} .. with class: #{messages_there.class}" | |
puts " ** IN MAILBOX CLEARED, NO MORE MESSAGES EXIST **" if !messages_there | |
end | |
end | |
end | |
def clear_sentmail(browser, url = $URL) | |
browser.goto url + "/messages?folder=2" | |
doc = Nokogiri::HTML(browser.html) | |
messages_there = browser.li(:id, /message_/).exists? | |
puts "messages_there is: #{messages_there} .. with class: #{messages_there.class}" | |
sleep(3) | |
while messages_there | |
begin | |
selectall_link = browser.link(:href,/selectall/) | |
selectall_link.click | |
sleep(3) | |
browser.execute_script("Mailbox.deleteThreads(); return false;") | |
sleep(6) | |
browser.execute_script("window.confirm = function() {return true}") | |
sleep(6) | |
rescue Exception => err | |
sleep(3) | |
puts "in rescue with error: #{err}" | |
ensure | |
browser.goto url + "/messages?folder=2" | |
sleep(4) | |
messages_there = browser.li(:id, /message_/).exists? | |
puts "messages_there is: #{messages_there} .. with class: #{messages_there.class}" | |
puts " ** SENT MAILBOX CLEARED, NO MORE MESSAGES EXIST **" if !messages_there | |
end | |
end | |
end | |
def send_message(browser,message_link,message_text) | |
begin | |
browser.goto message_link | |
sleep(rand(3)+4) | |
doc = Nokogiri::HTML(browser.html) | |
bad_user = false | |
errors = doc.css('p.oknotice_error') rescue nil | |
errors.each do |error| | |
puts "The *possible* errors in page are #{error.content}" | |
if (error.content =~ /full/) || (error.content =~ /exist/) || (error.content =~ /twice/) | |
puts "ERROR -- NOT A USER ANYMORE OR MAILBOX FULL - in send_message" | |
bad_user = true | |
end | |
end | |
unless bad_user | |
textarea = browser.text_field(:id, "message_text") | |
textarea.set(message_text) | |
sleep(3 + rand(4)) | |
send_msg_link = browser.link(:href,/send/) | |
send_msg_link.click | |
return true | |
else | |
puts "Her mailbox is full, not messaging" | |
return false | |
end | |
rescue Exception | |
puts "Exception caught while sending a message" | |
end | |
end | |
def vist_profile(browser,username,bot,url = $URL) | |
puts "Visiting #{username}" | |
begin | |
puts "Sending message to #{username}" | |
if bot.name == 'Shawn4' | |
message = Message.where(:message_type => '20').order(:updated_at).first | |
elsif bot.name == 'Kent' | |
message = Message.where(:message_type => '30').order(:updated_at).first | |
elsif bot.name == 'Jason2' | |
message = Message.where(:message_type => '41').order(:updated_at).first | |
elsif bot.name == 'Girls' | |
message = Message.where(:message_type => '51').order(:updated_at).sample(1).first | |
else | |
message = Message.where(:message_type => '11').order(:updated_at).first | |
end | |
message_text = message.content | |
message.touch | |
message.save | |
sleep(3) | |
message_url = "/messages?r1=#{username}&compose=1" | |
result = send_message(browser, url + message_url, message_text) | |
if result | |
puts "message sent" | |
sleep(3) | |
doc = Nokogiri::HTML(browser.html) | |
bad_user = false | |
errors = doc.css('p.oknotice_error') | |
errors.each do |error| | |
puts "Errors (possible) are #{error.content}" | |
if (error.content =~ /full/) || (error.content =~ /exist/) || (error.content =~ /twice/) | |
puts "ERROR -- NOT A USER ANYMORE OR MAILBOX FULL - in visit_profile" | |
bad_user = true | |
textarea = browser.text_field(:id, "message_text") | |
textarea.clear | |
sleep(2) | |
end # errors = /full/ or /exist/ | |
end # errors.each | |
else # !result | |
bad_user = true | |
end # if result | |
rescue Exception => err | |
puts "Error (in visit_profile now) sending message to #{username}:: ERROR >> #{err}" | |
bad_user = true | |
end # rescue Exception | |
return !bad_user | |
end | |
def ex_girlfriend?(username) | |
$XLIST.each do |ex_name| | |
if ex_name.match(/#{username}/i) | |
return true | |
end | |
end | |
return false | |
end | |
def get_profile_data(browser, data_number = 10, url = $URL) | |
first_contacts = Profile.where(:visited => false).order(:updated_at).reverse | |
puts "** Database Size is #{first_contacts.size}" | |
first_contacts.first(data_number).each_with_index do |contact, index| | |
begin | |
if !ex_girlfriend?(contact.username) | |
puts "/n" | |
browser.goto url + "/profile/#{contact.username.strip}" | |
puts "Evaluating #{contact.username}" | |
sleep(2 + rand(5)) | |
doc = Nokogiri::HTML(browser.html) | |
sleep(1) | |
begin # get data | |
link = url + "/profile/#{contact.username}" | |
bodytype = doc.css('dd#ajax_bodytype')[0].content rescue nil | |
puts "Her body type is #{bodytype}" | |
age = doc.css('span#ajax_age')[0].content rescue nil | |
puts "Her age is #{age}" | |
puts "AGE is a #{age.class}" | |
city = doc.css('span#ajax_location')[0].content.match(',').pre_match rescue nil | |
state = doc.css('span#ajax_location')[0].content.match(',').post_match rescue nil | |
puts "Her city is #{city}" | |
puts "Her state is #{state}" | |
gender = doc.css('span#ajax_gender')[0].content rescue nil | |
puts "Gender is #{gender}" | |
orientation = doc.css('span#ajax_orientation')[0].content rescue nil | |
puts "Her sexual orientation is #{orientation}" | |
relationship_status = doc.css('span#ajax_status')[0].content rescue nil | |
puts "Her relationship status is #{relationship_status}" | |
last_online_raw = doc.css('span.fancydate')[0].content rescue nil | |
puts "Her last online raw date is #{last_online_raw}" | |
begin | |
last_online = DateTime.parse(last_online_raw) | |
rescue Exception | |
last_online = nil | |
end | |
puts "Her last online parsed date is #{last_online}" | |
ethnicity = doc.css('dd#ajax_ethnicities')[0].content rescue nil | |
puts "Her ethnicity is #{ethnicity}" | |
height = doc.css('dd#ajax_height')[0].content rescue nil | |
puts "Her height is #{height}" | |
smokes = doc.css('dd#ajax_smoking')[0].content rescue nil | |
puts "Her smoking status is #{smokes}" | |
drugs = doc.css('dd#ajax_drugs')[0].content rescue nil | |
puts "Her drug status is #{drugs}" | |
religion = doc.css('dd#ajax_religion')[0].content rescue nil | |
puts "Her religion is #{religion}" | |
sign = doc.css('dd#ajax_sign')[0].content rescue nil | |
puts "Her sign is #{sign}" | |
education = doc.css('dd#ajax_education')[0].content rescue nil | |
puts "Her education is #{education}" | |
job = doc.css('dd#ajax_job')[0].content rescue nil | |
puts "Her job is #{job}" | |
income = doc.css('dd#ajax_income')[0].content rescue nil | |
puts "Her income is #{income}" | |
kids = doc.css('dd#ajax_children')[0].content rescue nil | |
puts "Her kid status is #{kids}" | |
language = doc.css('dd#ajax_languages')[0].content rescue nil | |
puts "Her language is #{language}" | |
looking_for_ages= doc.css('li#ajax_ages')[0].content rescue nil | |
puts "Her looking for age range is #{looking_for_ages}" | |
min_age = looking_for_ages.match(/\d\d/).to_s | |
max_age = looking_for_ages[8..9] | |
puts "Her min age is #{min_age}" | |
puts "Her max age is #{max_age}" | |
looking_for_type = doc.css('li#ajax_lookingfor')[0].content rescue nil | |
puts "Her looking for info is #{looking_for_type}" | |
looking_for_gentation = doc.css('li#ajax_gentation')[0].content rescue nil | |
puts "Her looking for type of sexuality is #{looking_for_gentation}" | |
rescue Exception => err | |
puts "Error scraping profile data Error is --> #{err}" | |
contact.destroy | |
puts "Destroyed profile" | |
raise | |
end # getting data rescue | |
begin # put data in database | |
contact.update_attribute(:link, link) | |
contact.update_attribute(:gender,gender) | |
contact.update_attribute(:body, bodytype) | |
contact.update_attribute(:height, height) | |
contact.update_attribute(:smokes, smokes) | |
contact.update_attribute(:language, language) | |
contact.update_attribute(:drugs, drugs) | |
contact.update_attribute(:religion, religion) | |
contact.update_attribute(:sign, sign) | |
contact.update_attribute(:education, education) | |
contact.update_attribute(:job, job) | |
contact.update_attribute(:income, income) | |
contact.update_attribute(:kids, kids) | |
contact.update_attribute(:ethnicity, ethnicity) | |
contact.update_attribute(:orientation, orientation) | |
contact.update_attribute(:looking_for_orientation, looking_for_gentation) | |
#contact.update_attribute(:her_type, looking_for_type) | |
contact.update_attribute(:looking_for_type, looking_for_type) | |
contact.update_attribute(:city, city) | |
contact.update_attribute(:state, state) | |
contact.update_attribute(:relationship_status, relationship_status) | |
contact.update_attribute(:keywords, "") | |
contact.update_attribute(:interests, "") | |
contact.update_attribute(:recently_single, 0) | |
contact.update_attribute(:age, age) | |
contact.update_attribute(:messages_sent, "") | |
contact.update_attribute(:visited, true) | |
contact.update_attribute(:last_online, last_online ) | |
contact.update_attribute(:my_last_visit, DateTime.now) | |
contact.update_attribute(:looking_for_max_age, max_age) | |
contact.update_attribute(:looking_for_min_age, min_age) | |
puts "Finished Adding #{contact.username} to database" | |
if ["Skinny","Fit","Thin","Athletic"].include?(bodytype) | |
browser.element(:class, "five-stars").hover | |
browser.link(:class, "five-stars").click | |
puts "5 STARS ***********************" | |
end | |
rescue Exception => err | |
puts "Error adding profile info to database Error is --> #{err}" | |
raise | |
end # rescue database add errror | |
#contact.update_attribute(:my_last_message, ) | |
end # if condition for known ex's | |
rescue Exception => err | |
puts "Error evaluating #{contact.username} ** #{err}" | |
end # exception handler for getting data | |
end # first_contact do loop | |
end | |
class DropTable < ActiveRecord::Migration | |
def down(table_name) | |
drop_table table_name | |
puts "Dropped Profiles table" | |
end | |
end | |
class Add_to_Table < ActiveRecord::Migration | |
def change | |
#add_column :profiles, :active, :boolean, :default => true | |
#Profile.all.each do |profile| | |
# profile.update_attributes(:active => true) | |
#end | |
end | |
end | |
class DatabaseConfig < ActiveRecord::Migration | |
def fix | |
profiles = Profile.where(created_at: 2.days.ago..5.minutes.ago) | |
profiles.each { |profile| profile.destroy } | |
end | |
end | |
def connect_database | |
ActiveRecord::Base.establish_connection( | |
:adapter => "mysql2", | |
:database => "okc", | |
:username => 'root', | |
:password => 'password', | |
:host => '127.0.0.1' | |
) | |
end | |
def create_profiles_table | |
unless Profile.table_exists? | |
puts "Defining Profile table" | |
ActiveRecord::Schema.define do | |
create_table "Profiles", :force => true do |t| | |
t.string "username" | |
t.string "link" | |
t.string "gender" | |
t.string "body" | |
t.string "height" | |
t.string "smokes" | |
t.string "language" | |
t.string "drugs" | |
t.string "religion" | |
t.string "sign" | |
t.string "education" | |
t.string "job" | |
t.string "income" | |
t.string "kids" | |
t.string "ethnicity" | |
t.string "orientation" | |
t.string "looking_for_orientation" | |
t.string "her_type" | |
t.string "looking_for_type" | |
t.string "city" | |
t.string "state" | |
t.string "relationship_status" | |
t.text "keywords" | |
t.text "interests" | |
t.boolean "visited", :default => false | |
t.integer "recently_single" | |
t.integer "age" | |
t.integer "looking_for_max_age" | |
t.integer "looking_for_min_age" | |
t.datetime "last_online" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
end | |
else | |
puts "Table Profiles already defined" | |
end | |
end | |
def create_interactions_table | |
unless Interaction.table_exists? | |
puts "Defining interaction table" | |
ActiveRecord::Schema.define do | |
create_table "interactions", :force => true do |t| | |
t.integer "profile_id" | |
t.integer "bot_id" | |
t.datetime "last_visit" | |
t.integer "message_count" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
end | |
else | |
puts "Table Interaction already defined" | |
end | |
end | |
def create_bots_table | |
unless Bot.table_exists? | |
puts "Defining Bot table" | |
ActiveRecord::Schema.define do | |
create_table "Bots", :force => true do |t| | |
t.string "name" | |
t.string "username" | |
t.string "password" | |
t.string "gender" | |
t.text "accept_gender" | |
t.text "accept_body_types" | |
t.integer "accept_min_age" | |
t.integer "accept_max_age" | |
t.text "accept_language" | |
t.text "accept_kids" | |
t.text "accept_city" | |
t.text "accept_state" | |
t.text "accept_keywords" | |
t.text "accept_interests" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
end | |
else | |
puts "Table Bots already defined" | |
end | |
end | |
# types 0 - 10 Sci's bots, 11 - 20 generic | |
def create_messages_table | |
unless Message.table_exists? | |
puts "Defining message table" | |
ActiveRecord::Schema.define do | |
create_table "Messages", :force => true do |t| | |
t.text "content" | |
t.string "message_type" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
end | |
else | |
puts "Table Message already defined" | |
end | |
end | |
def create_bot(name,username,password,gender,looking_for_gender,min_age,max_age) | |
unless bot = Bot.where(:name => name).first | |
Bot.create("name" => name,"username" => username,"password" => password,"gender" => gender,"accept_gender" => [looking_for_gender], \ | |
"accept_body_types" => $ALL_BODYS, "accept_min_age" => min_age, \ | |
"accept_max_age" => max_age) | |
else | |
puts "Bot exists, Nothing created: ERROR>> #{bot}" | |
end | |
puts "Listing all bots:" | |
puts Bot.all | |
end | |
def get_command_line | |
known_bots = Bot.all.map {|bot| bot.name} + ["harvest"] | |
puts known_bots | |
if ARGV.size.even? | |
commands = Hash[*ARGV] | |
if commands.keys.include?("check") | |
$HARVEST_PAGES = commands["check"].to_i | |
$PROFILE_CHECKS = commands["check"].to_i | |
commands.delete("check") | |
end | |
commands.keys.each do |bot| | |
if !known_bots.include?(bot) | |
puts "**** Bot unknown > > > Exiting" | |
raise Exception | |
end | |
end | |
else | |
puts "need even arguments >> botname messagecount botname messagecount >> or >> harvest number_of_harvest_interations << messagecount is max messages to send" | |
raise Exception => "Wrong Argument size, format is botname messagecount" | |
end | |
commands | |
end | |
def run_bots(browser,commands) | |
commands.each do |bot,max_messages| | |
qualified_girls = [] | |
messages_sent = 0 | |
bot = Bot.where(:name => bot).first | |
login_okc(browser,bot.username,bot.password) | |
get_profile_names(browser, $HARVEST_PAGES, bot.accept_min_age, bot.accept_max_age) | |
puts "/n" | |
get_profile_data(browser, $PROFILE_CHECKS) | |
puts "/n" | |
#clear_sentmail(browser) #if sentmail_full?(browser) # get rid of # if you want bot to clear your inbox | |
#clear_inbox(browser) #if inbox_full?(browser) | |
qualified_girls = Profile.where(:active => true,:body => bot.accept_body_types, :age => bot.accept_min_age..bot.accept_max_age).order(:updated_at) | |
qualified_girls.reverse! if bot.name != "x" | |
puts "" | |
puts "There are #{qualified_girls.size} girls with good body types *************************" | |
puts "Min - Max age is #{bot.accept_min_age} .. #{bot.accept_max_age}" | |
puts "" | |
bot_interactions = Interaction.where(:bot_id => bot.id) | |
puts "THIS BOT HAS #{bot_interactions.size} messages sent so far" | |
girls_index = 0 | |
while (messages_sent < max_messages.to_i) && (girls_index < qualified_girls.size) | |
if bot_interactions.where(:profile_id => qualified_girls[girls_index].id).exists? | |
puts qualified_girls[girls_index].username + " was already messaged" | |
else | |
result = vist_profile(browser,qualified_girls[girls_index].username,bot) | |
if result | |
Interaction.create(:bot_id => bot.id, :profile_id => qualified_girls[girls_index].id,:message_count => 1) | |
messages_sent += 1 | |
puts "#{messages_sent} - Interaction created" | |
else | |
puts "No interaction created" | |
qualified_girls[girls_index].update_attributes(:active => false) | |
puts "Profile marked not active ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" | |
sleep(5) | |
end | |
end | |
puts "/n" | |
girls_index += 1 | |
end | |
end | |
end | |
def run_harvest_bot(browser,commands) | |
harvest_number = commands['harvest'].to_i | |
puts harvest_number | |
puts harvest_number.class | |
puts "Harvesting #{harvest_number} pages of girls" | |
bot = Bot.where(:name => $HARVEST_BOT).first | |
login_okc(browser,bot.username,bot.password) | |
get_profile_names(browser,harvest_number) | |
get_profile_data(browser,harvest_number + 50) | |
end | |
def build_messages | |
Message.create(:content => "Great profile and pictures... Meeting anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Nice profile. Meeting anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Nice profile and pictures... Finding anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Nice profile and pictures... Have you found anyone interesting on here?", :message_type => 11) | |
Message.create(:content => "Like your profile :) Mine is probably too honest and to the point for you... ha. Just thought you seem nice. Finding this site to be any good?", :message_type => 20) | |
Message.create(:content => "Like your profile! New on here and I though I would write a real honest profile...probably too honest. ha. Just thought you seem nice. Finding this site to be any good?", :message_type => 20) | |
Message.create(:content => "Great profile :) Mine is probably too honest and to the point... ha. Just thought you seem nice. Finding this site to be any good?", :message_type => 20) | |
Message.create(:content => "Your profile is great:) Mine is probably a bit too honest and to the point... ha. Just thought you seem nice. Finding this site to be any good?", :message_type => 20) | |
Message.create(:content => "Great profile! New on here and I figured I would write a real honest profile...probably too honest. ha. Just thought you seem nice. Finding this site to be any good?", :message_type => 20) | |
Message.create(:content => "I'm going to be straight up and say you are my kind of girl. I think we could potentially have the best time ever. Have you been meeting a lot of people on here?", :message_type => 30) | |
Message.create(:content => "Really like your profile. Pretty new on here. Just wanted to see if *maybe* you wanted to take me up on the offer in my profile this Friday night? You seem really nice :)", :message_type => 40) | |
Message.create(:content => "I really liked reading your profile. I think we just might be able to get into some trouble together! Do you want to go out and grab a drink sometime?", :message_type => 41) | |
Message.create(:content => "We like your profile :) Having any fun on here?", :message_type => 51) | |
=begin | |
Message.create(:content => "Great profile and pictures... Meeting anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Your profile is a good read :) Meeting anyone worthwhile on here yet?", :message_type => 11) | |
Message.create(:content => "Like your profile... still trying to figure out if this site is for me. Meeting anyone interesting on here?", :message_type => 11) | |
Message.create(:content => "Great profile... Meeting anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Nice profile. Meeting anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "How had this site been treating you? Like your profile.", :message_type => 11) | |
Message.create(:content => "Like your profile! Meeting anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "You sound pretty solid... ha. Meeting anyone nice on here yet?", :message_type => 11) | |
Message.create(:content => "You seem like a rather sane person :) Meeting anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Wow! You sound sane :) Finding anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Nice profile and pictures... Finding anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Like what you wrote in your profile... Meeting anyone interesting on here yet?", :message_type => 11) | |
Message.create(:content => "Meeting anyone interesting on here yet? Like your profile and pictures", :message_type => 11) | |
Message.create(:content => "Like your profile and pictures. My profile is a *bit direct... Just trying to get it all out there so to speak. Meeting anyone interesting on here yet?", :message_type => 1) | |
Message.create(:content => "Enjoyed reading your profile. Mine is a *bit direct. Have you found anyone interesting on here yet?", :message_type => 1) | |
Message.create(:content => "Nice profile and pictures... Have you found anyone interesting on here?", :message_type => 1) | |
Message.create(:content => "Like what you wrote in your profile... Nice pictures as well. Have you found anyone interesting on here yet?", :message_type => 1) | |
Message.create(:content => "Like your profile. Well written unlike some :) Much luck on here yet?", :message_type => 1) | |
=end | |
end | |
def configer | |
curtis = Bot.where(:name => 'Curtis').first | |
curtis.update_attributes("accept_body_types" => $GREAT_BODYS, | |
"accept_min_age" => 29, | |
"accept_max_age" => 35, | |
"accept_city" => ["50 miles"] | |
) | |
girls = Bot.where(:name => 'Girls').first | |
girls.update_attributes("accept_body_types" => $Y_BODYS, | |
"accept_min_age" => 28, | |
"accept_max_age" => 39, | |
"accept_city" => ["50 miles"] | |
) | |
test = Bot.where(:name => 'Test').first | |
test.update_attributes("accept_body_types" => $Y_BODYS, | |
"accept_min_age" => 21, | |
"accept_max_age" => 35, | |
"accept_city" => ["50 miles"] | |
) | |
lauren = Bot.where(:name => 'Lauren').first | |
lauren.update_attributes("accept_body_types" => $GREAT_BODYS, | |
"accept_min_age" => 32, | |
"accept_max_age" => 42, | |
"accept_city" => ["50 miles"] | |
) | |
jason = Bot.where(:name => 'Jason').first | |
jason.update_attributes("accept_body_types" => $GREAT_BODYS, | |
"accept_min_age" => 29, | |
"accept_max_age" => 32, | |
"accept_city" => ["25 miles"] | |
) | |
jason2 = Bot.where(:name => 'Jason2').first | |
jason2.update_attributes("accept_body_types" => $GREAT_BODYS, | |
"accept_min_age" => 21, | |
"accept_max_age" => 35, | |
"accept_city" => ["25 miles"] | |
) | |
shawn2 = Bot.where(:name => 'Shawn2').first | |
shawn2.update_attributes("accept_body_types" => $GREAT_BODYS, | |
"accept_min_age" => 21, | |
"accept_max_age" => 34, | |
"accept_city" => ["100 miles"] | |
) | |
shawn3= Bot.where(:name => 'Shawn3').first | |
shawn3.update_attributes("accept_body_types" => $GREAT_BODYS, | |
"accept_min_age" => 30, | |
"accept_max_age" => 40, | |
"accept_city" => ["100 miles"] | |
) | |
shawn4= Bot.where(:name => 'Shawn4').first | |
shawn4.update_attributes("accept_body_types" => $GREAT_BODYS, | |
"accept_min_age" => 22, | |
"accept_max_age" => 34, | |
"accept_city" => ["50 miles"] | |
) | |
kent = Bot.where(:name => 'Kent').first | |
kent.update_attributes("accept_body_types" => $KENT_BODYS, | |
"accept_min_age" => 23, | |
"accept_max_age" => 30, | |
"accept_city" => ["25 miles"] | |
) | |
=begin | |
blaze = Bot.where(:name => 'Blaze').first | |
blaze.update_attributes("accept_body_types" => $GREAT_BODYS, | |
"accept_min_age" => 20, | |
"accept_max_age" => 26, | |
"accept_city" => ["25 miles"] | |
) | |
=end | |
end | |
puts "*********************************************************************************" | |
puts "START ***************************************************************************" | |
connect_database #config | |
#create_bot("Girls","","","M","F",19,30) # create a bot if you need a new one | |
#Add_to_Table.new.change | |
commands = get_command_line | |
puts commands | |
#DatabaseConfig.new.fix | |
configer | |
puts "Config complete. Done*********** uncomment out to use bot named Girls" | |
puts " " | |
puts "*********************************************************************************" | |
puts "BOTS ****************************************************************************" | |
Bot.all.each do |bot| | |
puts "#{bot.name} is #{bot.username} with password #{bot.password} getting #{bot.accept_body_types}" | |
end | |
=begin | |
puts "fixing profiles marked inactive **************************************************" | |
Profile.where(:active => false, :updated_at => 5.hours.ago..5.minutes.ago).each do |profile| | |
profile.active = true | |
puts "fixed #{profile.username}" if profile.save | |
end | |
=end | |
puts "*********************************************************************************" | |
puts "MESSAGES ****************************************************************************" | |
Message.all.each do |message| | |
puts message.content + " (Type #{message.message_type})" if message.message_type == '51' | |
end | |
#create_messages_table | |
#build_messages | |
browser = Watir::Browser.new :firefox, :profile => 'default' #start bot | |
if commands.keys.include?('harvest') | |
run_harvest_bot(browser,commands) | |
else | |
run_bots(browser,commands) | |
end | |
puts "Total profiles in database: #{Profile.all.size}" | |
puts "#{Profile.where(:visited => false).size} of those profiles have not been inspected yet" | |
puts "Total profiles processed is #{Profile.where(:visited => true).size}" | |
puts "Total interactions: #{Interaction.all.size}" | |
puts "----------enter anything to close browser and exit" | |
#close_browser = gets() | |
#puts close_browser | |
#browser.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment