Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use 5.010;
- use strict;
- use Time::HiRes qw(gettimeofday);
- #die "Usage: $0 thread [board]"
- #unless @ARGV;
- my $thread = "9033412";
- my $board = "b";
- my $delay = 5;
- my $n = 20;
- my $pages = 5;
- my $cur_status_bin = 0;
- my $cur_status = 0;
- my @text = ("Status: "," Warning!!! ","#","[New post]. "," High congestion! "," Very high congestion! ");
- ######
- my $wipe_detect = 5;
- my $wipe_time_detect_high = 0.6;
- my $wipe_time_detect_very_high = 0.7;
- ######
- my $count = 0;
- my @nx=(65,72);
- my @delta_time;
- my $time_temp;
- print @text[0];
- while (1)
- {
- $time_temp = gettimeofday;
- my $_ = `curl -G "http://www.0chan.ru/b/catalog.html"`;
- $time_temp = gettimeofday - $time_temp;
- push @delta_time, $time_temp;
- if ($time_temp >= $wipe_time_detect_high) {
- print "@text[4]\n";
- } else {
- if ($time_temp >= $wipe_time_detect_very_high) {
- print "@text[5]\n";
- $cur_status_bin = 1;
- }
- }
- unless (/$thread/)
- {
- print "THREAD DIED!!!!!11T_T\n";
- exit;
- }
- my $link = 0;
- while (++$link < $n*$pages)
- {
- m!(href="/$board/res/\d+\.html">)!g;
- last if $1 =~ /$thread/;
- }
- if (($link >= $n)or((($link - $cur_status) >= $wipe_detect)and($count != 0)and($cur_status >= 3)))
- {
- my $thread_url = "http://www.0chan.ru/$board/res/$thread.html";
- print "BUMP THREAD NOW!!!11\n";
- system("mplayer.exe alert.wav");
- print "\n",@text[0],@text[2]x@nx[0],@text[1],@text[2]x@nx[1],"\n",@text[0];
- $cur_status_bin = 1;
- }
- sleep($delay);
- $count++;
- if ($link > $cur_status) {
- $cur_status = $link;
- print "[$cur_status].";
- } else {
- if ($cur_status - $link > 1) {
- $cur_status_bin = 1;
- print @text[3];
- }
- }
- if ($cur_status_bin == 1) {
- $cur_status = 0;
- $cur_status_bin = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement