Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.95 KB  |  hits: 48  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/perl -w
  2. use AntiCaptcha;
  3. use WWW::Mechanize::Firefox;
  4.  
  5. my $mech = WWW::Mechanize::Firefox->new();
  6. $mech->get('http://0chan.ru/b/res/10638550.html');
  7.  
  8. $mech->eval('$("#captchaimage").attr("src",  "http://0chan.ru/captcha.php?" + Math.random()); $("#captcha_status").html(""); captcha_shown = 1');
  9. $mech->eval('$("#postform").attr("action",  "http://0chan.ru/board.php?dir=b")');
  10.  
  11. $image = $mech->xpath('//img[@id="captchaimage"]', one => 1);
  12. while(length($mech->element_as_png($image)) < 100)
  13. {
  14.         sleep(3);
  15. }
  16. #print $mech->element_as_png($image);
  17.  
  18. my $ac = AntiCaptcha->new('antigate.com', '>>>REPLACE THIS<<<'); die "Y U NO READ SOURCE?!";
  19. my $id = $ac->Recognize($mech->element_as_png($image));
  20. until($captcha = $ac->GetStatus($id))
  21. {
  22.          sleep(5);
  23. }
  24.  
  25. print $captcha;
  26.  
  27. $mech->form_id('postform');
  28. $mech->set_fields(
  29.         captcha => $captcha,
  30.         message => 'test',
  31. );
  32. $mech->click({ xpath => '//input[@type="submit"]', one => 1 });
  33. sleep(120);