#!/usr/local/bin/perl -w
# author by luyi
use strict;
#use LWP::Simple qw(getstore);
my $obj_file="/home/getdata/dota2_html.txt";
my $info="/tmp/get_dota2_players.info";
my $all_data="/export/remotedata/dota2/wget_dota2_players.txt";
my $address='http://www.dota2.com/overview?u=public&appid=570&internal=1';
my $cmd=qx(which wget);
chomp($cmd);
my $curtime=qx(date +%F' '%T);
chomp($curtime);
my $curdate=qx(date +%F);
chomp($curdate);
my $version="20131115";
if (-s $all_data){
`cp $all_data /export/remotedata/dota2/wget_dota2_players_old.txt`;
}
unlink $obj_file if (-f $obj_file);
qx($cmd "$address" -a $info -O $obj_file);
my $status="$?";
print "$cmd $address -a $info -O $obj_file\n";
qx(/usr/bin/dos2unix $obj_file);
open(INFO,">>$info") or die "Can't open $info : $!";
open(DOTA2,"$obj_file") or die "Can't open $obj_file : $!";
open(RST,">>$all_data") or die "Can't open $all_data : $!";
if("$status" ne "0")
{
# print "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print RST "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print RST "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print RST "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print RST "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print RST "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print RST "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
exit;
}
my $old_delim=$/;
$/=undef;
$_ = <DOTA2>;
#if (/.+Players.+\<th\>PerfectWorldTelecom<\/th\>\n.+\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+\<h2\>Servers.+Game\s+Servers.+\<th\>PerfectWorldTelecom<\/th\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+Proxy\s+Servers.+\<th\>PerfectWorldTelecom<\/th\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals/s){
#if (/.+Players.+\<th\>PerfectWorldTelecom<\/th\>\n.+\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+\<h2\>Servers.+Game\s+Servers.+\<th\>PerfectWorldTelecom<\/th\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+Proxy\s+Servers.+/s){
if (/.+Players.+\<th\>PerfectWorldTelecom<\/th\>\n.+\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+\<h2\>Servers.+\<th\>PerfectWorldTelecom<\/th\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals/s){
#Region Total In Queue In Match In Solo Match In Practice In Tournament In Coop In Team Match Spectating Idle
# print "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\t$25\t$26\n";
#print RST "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\t$25\t$26\n";
#print "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$23\t$24\t$27\t$28\n";
#print RST "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$23\t$24\t$27\t$28\n";
#print "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\n";
#print RST "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\n";
#print "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$23\t$24\n";
#print RST "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$23\t$24\n";
print "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\t$23\n";
print RST "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\t$23\n";
print "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$24\t$25\t$26\n";
print RST "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$24\t$25\t$26\n";
}else{
#print "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
#print RST "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
#print "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
#print RST "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print INFO "$curtime : The dota2 web information format have changed!\n";
print "$curtime : The dota2 web information format have changed!\n\n";
}
close(DOTA2);
close(INFO);
close(RST);
# author by luyi
use strict;
#use LWP::Simple qw(getstore);
my $obj_file="/home/getdata/dota2_html.txt";
my $info="/tmp/get_dota2_players.info";
my $all_data="/export/remotedata/dota2/wget_dota2_players.txt";
my $address='http://www.dota2.com/overview?u=public&appid=570&internal=1';
my $cmd=qx(which wget);
chomp($cmd);
my $curtime=qx(date +%F' '%T);
chomp($curtime);
my $curdate=qx(date +%F);
chomp($curdate);
my $version="20131115";
if (-s $all_data){
`cp $all_data /export/remotedata/dota2/wget_dota2_players_old.txt`;
}
unlink $obj_file if (-f $obj_file);
qx($cmd "$address" -a $info -O $obj_file);
my $status="$?";
print "$cmd $address -a $info -O $obj_file\n";
qx(/usr/bin/dos2unix $obj_file);
open(INFO,">>$info") or die "Can't open $info : $!";
open(DOTA2,"$obj_file") or die "Can't open $obj_file : $!";
open(RST,">>$all_data") or die "Can't open $all_data : $!";
if("$status" ne "0")
{
# print "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print RST "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print RST "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print RST "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
# print RST "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print RST "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print RST "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
exit;
}
my $old_delim=$/;
$/=undef;
$_ = <DOTA2>;
#if (/.+Players.+\<th\>PerfectWorldTelecom<\/th\>\n.+\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+\<h2\>Servers.+Game\s+Servers.+\<th\>PerfectWorldTelecom<\/th\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+Proxy\s+Servers.+\<th\>PerfectWorldTelecom<\/th\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals/s){
#if (/.+Players.+\<th\>PerfectWorldTelecom<\/th\>\n.+\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+\<h2\>Servers.+Game\s+Servers.+\<th\>PerfectWorldTelecom<\/th\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+Proxy\s+Servers.+/s){
if (/.+Players.+\<th\>PerfectWorldTelecom<\/th\>\n.+\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals.+\<h2\>Servers.+\<th\>PerfectWorldTelecom<\/th\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+PerfectWorldUnicom.+<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>\n\s+\<td\>(\d+)\<\/td\>.+Totals/s){
#Region Total In Queue In Match In Solo Match In Practice In Tournament In Coop In Team Match Spectating Idle
# print "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\t$25\t$26\n";
#print RST "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\t$25\t$26\n";
#print "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$23\t$24\t$27\t$28\n";
#print RST "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$23\t$24\t$27\t$28\n";
#print "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\n";
#print RST "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\n";
#print "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$23\t$24\n";
#print RST "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$23\t$24\n";
print "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\t$23\n";
print RST "$curtime\tPerfectWorldTelecom\t${version}\t$1\t$2\t$3\t$4\t$5\t$6\t$7\t$8\t$9\t$10\t$21\t$22\t$23\n";
print "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$24\t$25\t$26\n";
print RST "$curtime\tPerfectWorldUnicom\t${version}\t$11\t$12\t$13\t$14\t$15\t$16\t$17\t$18\t$19\t$20\t$24\t$25\t$26\n";
}else{
#print "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
#print RST "$curtime\tPerfectWorldTelecom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
#print "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
#print RST "$curtime\tPerfectWorldUnicom\t${version}\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n";
print INFO "$curtime : The dota2 web information format have changed!\n";
print "$curtime : The dota2 web information format have changed!\n\n";
}
close(DOTA2);
close(INFO);
close(RST);