您的位置:首页 > 其它

泡了个学妹,好开心

2016-09-17 13:00 197 查看
版权声明:本文为博主原创文章,未经博主允许不得转载。

////////////////2016/06/21////////////////////

//////////////by  xbw///////////////////////////

////////////环境 山东科技大学//////////

学妹好萌,给了我一包什么不二家棒棒糖,糖更可爱。

贴吧偶遇,加了qq,学妹没说名字,留了几条信息,

第一条:学校c/c++ JudgeOnline系统个人提交统计图。



第二条:qq空间留言,大家都叫她华姐。

两条信息在我们这不大的校园里足够了。

开始寻找学妹。。。。。。

抓取名字中有”华“字的学生,然后,同时抓取带“华”字同学的学号,然后通过学号GET请求得到提交题目的AC情况,

我们抓取Submit总数,AC总数,然后AC总数/Submit总数的结果保留两位小数,结果为0.57的学生挑出来,

一开始以为学妹实力了得,就只抓取了系统前1000名同学,然而都是查询无果,感觉有点灰心,问了学妹,

学妹告诉我她是转专业的,这就更厉害了,不是信息学院的一半oj提交数量很少,于是我把范围扩大,

学妹终于浮出水面了,面对唯一的结果开心的告诉了学妹,真的对了。哈哈

上代码

[php]
view plain
copy

print?





<?PHP  
set_time_limit(0);  
$page=0;  
while($page<=40){  
    $str = file_get_contents('http://***.218.128.***/JudgeOnline/ranklist.php?start='.$page*50);//OJ- Ranklist  
    $isMatched = preg_match_all('/\'>(?<grp0>[^<]+)<\/a><td align=center>(?<grp1>[^<]+)<td align=center>/', $str, $matches);//正则表达式抽取学号,姓名  
      
    if($isMatched!=0){  
        for($i=0;$i<$isMatched;$i++){  
            $xu=array();  
            for($j=1;$j<=2;$j++){  
                $xu[$j]=$matches[$j][$i];  
            }  
            $isMatchs = preg_match('/[\x{534e}]+$/u', $xu[2], $matchess);//匹配华字,例如张新华。  
            if($isMatchs){  
                echo $xu[2].'--'.$xu[1].'<BR>';  
                $strs = file_get_contents('http://***.218.128.***/JudgeOnline/userinfo.php?user='.$xu[1]);//GET学号得到详细信息  
                $isMatchss = preg_match_all('/Submit<td align=center><a href=\'status\.php\?user_id=(?<grp0>[^\']+)\'>(?<grp1>[^<]+)<\/a><\/tr>[^<]*<tr bgcolor=#D7EBFF><td>(?<grp2>[^<]+)<td align=center><a href=status\.php\?user_id=(?<grp3>[^\D]+)&jresult=(?<grp4>[^>]+)>(?<grp5>[^<]+)<\/a><\/tr><tr/', $strs, $matchesss);//匹配submit,ac数量  
                //echo 'geshu--'.$isMatchss.'<BR>';  
                if($isMatchss!=0){  
                    $txt = sprintf("%.2f",(double)$matchesss[6][0]/(double)$matchesss[2][0]);  
                    echo $matchesss[6][0].'/'.$matchesss[2][0].'='.$txt.'<BR>';  
                        if($txt==0.57){  
                            echo '*******'.$xu[2].'*******'.'<BR>';  
                        }  
                    /*for($i=0;$i<$isMatchss;$i++){ 
                        $xus=array(); 
                        for($j=1;$j<=6;$j++){ 
                            $xus[$j]=$matchesss[$j][$i]; 
                        } 
                        echo $xus[6].'/'.$xus[2].'<BR>'; 
                        if((int)$xus[6]/(int)$xus[2]==57){ 
                            echo $xu[2]; 
                        } 
                    }*/  
                }     
            }  
        }  
    }  
    $page++;  
}  
?>  



<?PHP
set_time_limit(0);
$page=0;
while($page<=40){
$str = file_get_contents('http://***.218.128.***/JudgeOnline/ranklist.php?start='.$page*50);//OJ- Ranklist
$isMatched = preg_match_all('/\'>(?<grp0>[^<]+)<\/a><td align=center>(?<grp1>[^<]+)<td align=center>/', $str, $matches);//正则表达式抽取学号,姓名

if($isMatched!=0){
for($i=0;$i<$isMatched;$i++){
$xu=array();
for($j=1;$j<=2;$j++){
$xu[$j]=$matches[$j][$i];
}
$isMatchs = preg_match('/[\x{534e}]+$/u', $xu[2], $matchess);//匹配华字,例如张新华。
if($isMatchs){
echo $xu[2].'--'.$xu[1].'<BR>';
$strs = file_get_contents('http://***.218.128.***/JudgeOnline/userinfo.php?user='.$xu[1]);//GET学号得到详细信息
$isMatchss = preg_match_all('/Submit<td align=center><a href=\'status\.php\?user_id=(?<grp0>[^\']+)\'>(?<grp1>[^<]+)<\/a><\/tr>[^<]*<tr bgcolor=#D7EBFF><td>(?<grp2>[^<]+)<td align=center><a href=status\.php\?user_id=(?<grp3>[^\D]+)&jresult=(?<grp4>[^>]+)>(?<grp5>[^<]+)<\/a><\/tr><tr/', $strs, $matchesss);//匹配submit,ac数量
//echo 'geshu--'.$isMatchss.'<BR>';
if($isMatchss!=0){
$txt = sprintf("%.2f",(double)$matchesss[6][0]/(double)$matchesss[2][0]);
echo $matchesss[6][0].'/'.$matchesss[2][0].'='.$txt.'<BR>';
if($txt==0.57){
echo '*******'.$xu[2].'*******'.'<BR>';
}
/*for($i=0;$i<$isMatchss;$i++){
$xus=array();
for($j=1;$j<=6;$j++){
$xus[$j]=$matchesss[$j][$i];
}
echo $xus[6].'/'.$xus[2].'<BR>';
if((int)$xus[6]/(int)$xus[2]==57){
echo $xu[2];
}
}*/
}
}
}
}
$page++;
}
?>




好啦,学妹浮出水面了。

好开心。


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  抓取