Skip to content

Commit

Permalink
update version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brethland committed Aug 11, 2019
1 parent 2d5c3a1 commit e4ef1b3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Judger.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ private function grab($all_data) {


$headers = array();
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/{$oj}_{$vcid}{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/{$oj}_{$vcid}{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/{$oj}_{$vcid}_{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/{$oj}_{$vcid}_{$handle}.cookie"));

$result = curl_exec($ch);
curl_close($ch);
Expand Down Expand Up @@ -80,8 +80,8 @@ private function _loginAndGet($url,$handle,$pass,$vcid)
$headers[] = 'Referer: http://acm.hdu.edu.cn/userloginex.php?cid='.$vcid;
$headers[] = 'Accept-Encoding: gzip, deflate';
$headers[] = 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8';
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/hdu_{$vcid}{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/hdu_{$vcid}{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/hdu_{$vcid}_{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/hdu_{$vcid}_{$handle}.cookie"));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_HEADER,true);

Expand Down
12 changes: 6 additions & 6 deletions Submitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ private function grab($all_data) {


$headers = array();
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/{$oj}_{$vcid}{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/{$oj}_{$vcid}{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/{$oj}_{$vcid}_{$handle}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/{$oj}_{$vcid}_{$handle}.cookie"));

$result = curl_exec($ch);
curl_close($ch);
Expand Down Expand Up @@ -132,8 +132,8 @@ private function __loginAndGet($url)
$headers[] = 'Referer: http://acm.hdu.edu.cn/userloginex.php?cid='.$this->post_data['vcid'];
$headers[] = 'Accept-Encoding: gzip, deflate';
$headers[] = 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8';
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/hdu_{$this->post_data['vcid']}{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/hdu_{$this->post_data['vcid']}{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/hdu_{$this->post_data['vcid']}_{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/hdu_{$this->post_data['vcid']}_{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_HEADER,true);

Expand Down Expand Up @@ -176,8 +176,8 @@ private function _contestLogin()
$headers[] = 'Referer: http://acm.hdu.edu.cn/userloginex.php?cid='.$this->post_data['vcid'];
$headers[] = 'Accept-Encoding: gzip, deflate';
$headers[] = 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8';
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/hdu_{$this->post_data['vcid']}{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/hdu_{$this->post_data['vcid']}{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/hdu_{$this->post_data['vcid']}_{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/hdu_{$this->post_data['vcid']}_{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_HEADER,true);

Expand Down
11 changes: 6 additions & 5 deletions Synchronizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ private function _loginAndGet($url)
$headers[] = 'Referer: http://acm.hdu.edu.cn/userloginex.php?cid='.$this->vcid;
$headers[] = 'Accept-Encoding: gzip, deflate';
$headers[] = 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8';
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/hdu_{$this->vcid}{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/hdu_{$this->vcid}{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEFILE, babel_path("Cookies/hdu_{$this->vcid}_{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_COOKIEJAR, babel_path("Cookies/hdu_{$this->vcid}_{$this->selectedJudger['handle']}.cookie"));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_HEADER,true);

Expand Down Expand Up @@ -101,19 +101,19 @@ private function cacheImage($dom)
} else {
$url='http://acm.hdu.edu.cn/'.$src;
}
$res=Requests::get($url, ['Referer' => 'http://acm.hdu.edu.cn']);
$res=$this->_loginAndGet($url);
$ext=['image/jpeg'=>'.jpg', 'image/png'=>'.png', 'image/gif'=>'.gif', 'image/bmp'=>'.bmp'];
if (isset($res->headers['content-type'])) {
$cext=$ext[$res->headers['content-type']];
} else {
$pos=strpos($ele->src, '.');
$pos=strripos($ele->src, '.');
if ($pos===false) {
$cext='';
} else {
$cext=substr($ele->src, $pos);
}
}
$fn=$this->con.'_'.($this->imgi++).$cext;
$fn=$this->vcid."_".$this->con.'_'.($this->imgi++).$cext;
$dir=base_path("public/external/hdu/img");
if (!file_exists($dir)) {
mkdir($dir, 0755, true);
Expand All @@ -126,6 +126,7 @@ private function cacheImage($dom)

public function crawlProblem($con)
{
sleep(6);
$this->_resetPro();
$this->con = $con;
$this->imgi = 1;
Expand Down
2 changes: 1 addition & 1 deletion babel.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": "HDU Interface for NOJ",
"license": "MIT",
"repository":"https://github.com/NJUPTAAA/NOJ_Extension_HDU",
"version":"0.3.18",
"version":"0.3.19",
"website":"http://acm.hdu.edu.cn/",
"custom":{
"css":"resources/custom.css"
Expand Down

0 comments on commit e4ef1b3

Please sign in to comment.