From 60a2273e3c5217628414d85052e95f31a8d0c353 Mon Sep 17 00:00:00 2001 From: zsgsdesign Date: Sun, 24 Oct 2021 19:54:38 +0800 Subject: [PATCH] use pcode if title empty --- Crawler.php | 9 +++++++++ babel.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Crawler.php b/Crawler.php index faf913c..18c8d39 100644 --- a/Crawler.php +++ b/Crawler.php @@ -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; @@ -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']; diff --git a/babel.json b/babel.json index ea40c21..1a7b668 100644 --- a/babel.json +++ b/babel.json @@ -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"