Skip to content

Commit

Permalink
use pcode if title empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsgsDesign committed Oct 24, 2021
1 parent 4f69402 commit 60a2273
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ private function _extractCodeForces($pcode, $url)
$this->currentProblemCcode = $pcode;
$this->imageIndex = 1;

$this->pro["input"] = null;
$this->pro["output"] = null;
$this->pro["note"] = null;
$this->pro["sample"] = null;
$this->pro["description"] = null;

$response = $this->getCodeForcesResponse($url);
$contentType = $response->headers['content-type'];
$content = $response->body;
Expand Down Expand Up @@ -287,6 +293,9 @@ public function crawl($con, $cached, $incremental, $range)

$this->pro['origin'] = "https://codeforces.com/contest/{$problem['contestId']}/problem/{$problem['index']}";
$this->pro['title'] = str_replace('"', "'", $problem['name']);
if(blank($this->pro['title'])) {
$this->pro['title'] = $pcode;
}
$this->pro['solved_count'] = $problemset['result']['problemStatistics'][$index]['solvedCount'];
$this->pro['pcode'] = $pcode;
$this->pro['index_id'] = $problem['index'];
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": "Codeforces & Gym interface for NOJ",
"license": "MIT",
"repository": "https://github.com/NJUPTAAA/NOJ_Extension_Codeforces",
"version": "0.4.2",
"version": "0.4.3",
"website": "https://codeforces.com/",
"custom": {
"css": "resources/custom.css"
Expand Down

0 comments on commit 60a2273

Please sign in to comment.