Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use LWP::UserAgent;
- use HTTP::Cookies;
- use URI::Escape;
- use Digest::MD5 qw(md5_hex);
- $users_count = '6'; # лимит юзеров, у скольки спросим
- $email = 'myemail'; # мыло
- $pass = md5_hex 'mypassword'; # пасс
- $question = 'день удался?:)'; # вопрос
- $q = uri_escape($question);
- $browser = LWP::UserAgent->new;
- $cookie = HTTP::Cookies->new;
- $browser->cookie_jar($cookie);
- print "Auth on site...";
- $data = $browser->post("http://sprashivai.ru/login", ['email' => $email, 'pass' => $pass])->as_string;
- if ($data =~ /username\":\"(.*?)\"/) { print "as $1"; } else { print "there is an error!\n"; exit(); }
- print "\nParse users...";
- while($i!=$users_count) {
- $request ++;
- $data = $browser->get("http://sprashivai.ru/live")->as_string;
- while ($data =~ /<a href=\"\/(.*?)\" style=\"border: 0;\">/go) {
- if (grep(/^$1$/, @users)) { }
- else { push(@users, "$1"); $i ++; }
- if ($i >= $users_count) { next; }
- }
- pop(@users);
- while ($data =~ /\"username\":\"(.*?)\"/go) {
- if ($i >= $users_count) { next; }
- if (grep(/^$1$/, @users)) { }
- else { push(@users, "$1"); $i ++; }
- }
- if ($i == $users_count) { break; }
- }
- $status = '';
- $answer = '';
- foreach (@users) {
- print "$status!\nSend question to $_...";
- $data = $browser->post("http://sprashivai.ru/questions/ask", ['username' => $_, 'question' => $q, 'anonimous' => 'true'])->as_string;
- $status = $1 if ($data =~ /status\":\"(.*?)\"/go);
- }
- while($answer!='') {
- foreach (@users) {
- print "Looking for a response from $_...";
- $data = $browser->get("http://sprashivai.ru/$_")->as_string;
- if ($data =~ /<div class=\"text-question\">$question<\/div>/) {
- if ($data =~ /<div class=\"text-answer\">(.*?)<\/div>/) { $answer = $1; };
- print "Yeah, $_ answered the question: $answer\n";
- } else {
- print "$_ has not yet responded...\n";
- }
- }
- }
- print "Finished!\n";
- exit();
Advertisement
Add Comment
Please, Sign In to add comment