From bb35b0abd5905499e28f64348ef71b2576983974 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Mon, 28 Sep 2020 12:22:45 +0530 Subject: [PATCH] fix(platform): CodeForces JSON error - HTML body was decoded by json incorrectly earlier (fixed in this commit) --- src/cpcli/platforms/codeforces.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cpcli/platforms/codeforces.py b/src/cpcli/platforms/codeforces.py index 9463b8c..e1e764e 100644 --- a/src/cpcli/platforms/codeforces.py +++ b/src/cpcli/platforms/codeforces.py @@ -1,4 +1,3 @@ -import json import logging from typing import List @@ -23,17 +22,16 @@ def uri_prefix(): return 'cf' def get_questions(self) -> List[Question]: - logger.info(f'Downloading page {self.base_url}/{self.contest}') + logger.info(f'Downloading page {self.base_url}/contest/{self.contest}/problems') response_code, body = self.download_response(f"/contest/{self.contest}/problems") if response_code != 200: err = Exception(f'No contest found for codechef/{self.contest} ❌❌') raise err - data = json.loads(body) questions: List[Question] = [] - doc = document_fromstring(data) + doc = document_fromstring(body) caption = doc.xpath('//div[@class="caption"]/text()')[0] logger.info(f'Found: {caption} ✅')