#!/usr/bin/perl $counter = 0; ######### CONFIGURATION ######### $username = 'yourusername'; $password = 'yourpassword'; $cookiefile = "cookie_hon"; #where to save the cookies to $age = '1'; #x = any age #1 = 18-25 #2 = 26-32 #3 = 33-40 #4 = 41+ $sex = 'female'; #female #male #$geo = "oh01"; #your assigned location #comment the line out if you dont want to have a location #$output = "output.html"; #the file to output to on every click #comment the line out if you dont want to review the output #$failure = "failure.html"; #the file to output to when it fails (for debugging) #comment the line out if you dont want to review errors ########## END CONFIG ########## $act = 1; $s = 'http://www.hotornot.com/'; $m = 'http://www.hotornot.com/m/'; print "Getting main page...\n"; use LWP::UserAgent; use HTTP::Cookies; #save it to a cookie $mycookie = HTTP::Cookies->new(file => $cookiefile, autosave => 1); $ua = LWP::UserAgent->new; $ua->cookie_jar($mycookie); my $req = HTTP::Request->new(GET => $s); my $res = $ua->request($req); if ($res->is_success){ print "Got main page. Posting password...\n"; $html = $res->content; $html = truncateat($html,'rightof',''); $ratee =~ s/\"//g; # $ratee = int($ratee); $rk = truncateat($html,'rightof','rk'); $rk = truncateat($rk,'rightof','value='); $rk = truncateat($rk,'leftof','>'); $rk =~ s/\"//g; $req = HTTP::Request->new(POST => $s); $req->content_type('application/x-www-form-urlencoded'); $content = "state=rate\&ratee=$ratee\&rk=$rk\&username=$username\&password=$password\&login=Login"; $req->content($content); print "$content\n"; $res = $ua->request($req); #main loop while ($res->is_success) { if ($res->content =~ 'Meet Me at HOT or NOT') { $req = HTTP::Request->new(POST => $m); $req->content_type('application/x-www-form-urlencoded'); $html = $res->content; if ($output) { open(BOB,">$output"); print BOB $html; close(BOB); } #print $html; $html = truncateat($html,'rightof',''); $votee =~ s/\"//g; # $votee = int($votee); $vt = truncateat($html,'rightof','vt'); $vt = truncateat($vt,'rightof','value='); $vt = truncateat($vt,'leftof','>'); $vt =~ s/\"//g; # $vt = int($vt); $r = truncateat($html,'rightof','rand'); $r = truncateat($r,'rightof','value='); $r = truncateat($r,'leftof','>'); $r =~ s/\"//g; # $r = int($r); if ($act == 1) { $content = "state=vote\&votee=$votee\&vt=$vt\&rand=$r\&sel_sex=$sex"; $act++; print "Selecting $sex sex\n"; } elsif ($act == 2) { $content = "state=vote\&votee=$votee\&vt=$vt\&rand=$r\&sel_age=$age"; $act++; print "Selecting $age age\n"; } elsif ($act == 3 && $geo) { $content = "state=vote\&votee=$votee\&vt=$vt\&sel_age=$age\&sel_geoMode=on\&rand=$r"; $act++; print "Selecting location mode\n"; } elsif ($act == 4 && $geo) { $content = "state=vote\&unsel_geoMode=1\&sel_geoMode=on\&votee=$votee\&vt=$vt\&sel_age=$age\&geoMode=1\&rand=$r\&sel_geo=$geo"; $act++; print "Selecting $geo as location\n"; } elsif ($act == 5 && $geo) { $content = "state=vote\&votee=$votee\&vt=$vt\&advMode=1\&geoMode=1\&rand=$r\&sel_age=$age\&unsel_geoMode=1\&sel_geoMode=on\&sel_geo=$geo"; $act++; print "Finalizing location set\n"; } else { #print "Finished. Click yes routine initiated\n"; $counter++; print "$counter\n"; if ($geo) { $content = "state=vote\&votee=$votee\&vt=$vt\&advMode=1\&geoMode=1\&rand=$r\&vote=yes"; } else { $content = "state=vote\&votee=$votee\&vt=$vt\&rand=$r\&vote=yes"; } } #print "Posting $content\n"; $req->content($content); $res = $ua->request($req); } else { print "Incorrect login!\n"; print $res->content; exit; } #print "Could not connect to $s\n"; } $html = $res->content; print "Could not connect to $s\n"; if ($failure) { open(BOB,">$failure"); print BOB $html; close(BOB); } } exit; sub truncateat { #this is a function to truncate a string my ($bigstring,$whichway,$littlestring) = @_; if ($whichway =~ 'right') { $bigstring=substr($bigstring,index($bigstring,$littlestring)+length($littlestring)); } else { $bigstring=substr($bigstring,0,index($bigstring,$littlestring)); } return $bigstring; }