fix(scrapers/codeforces): scrape time
This commit is contained in:
parent
33cc2ca36b
commit
f48acb4672
3 changed files with 305 additions and 37 deletions
|
|
@ -29,10 +29,6 @@ TIMEOUT_S = 15.0
|
|||
CONNECTIONS = 8
|
||||
|
||||
|
||||
def _run(coro):
|
||||
return asyncio.run(coro)
|
||||
|
||||
|
||||
def normalize_category_name(category_name: str) -> str:
|
||||
return category_name.lower().replace(" ", "_").replace("&", "and")
|
||||
|
||||
|
|
@ -198,34 +194,6 @@ class CSESScraper(BaseScraper):
|
|||
success=True, error="", contest_id=contest_id, problems=problems
|
||||
)
|
||||
|
||||
async def scrape_problem_tests(
|
||||
self, contest_id: str, problem_id: str
|
||||
) -> TestsResult:
|
||||
path = task_path(problem_id)
|
||||
async with httpx.AsyncClient() as client:
|
||||
html = await fetch_text(client, path)
|
||||
tests = parse_tests(html)
|
||||
timeout_ms, memory_mb = parse_limits(html)
|
||||
if not tests:
|
||||
return TestsResult(
|
||||
success=False,
|
||||
error=f"{self.platform_name}: No tests found for {problem_id}",
|
||||
problem_id=problem_id if problem_id.isdigit() else "",
|
||||
url=BASE_URL + path,
|
||||
tests=[],
|
||||
timeout_ms=timeout_ms,
|
||||
memory_mb=memory_mb,
|
||||
)
|
||||
return TestsResult(
|
||||
success=True,
|
||||
error="",
|
||||
problem_id=problem_id if problem_id.isdigit() else "",
|
||||
url=BASE_URL + path,
|
||||
tests=tests,
|
||||
timeout_ms=timeout_ms,
|
||||
memory_mb=memory_mb,
|
||||
)
|
||||
|
||||
async def scrape_contest_list(self) -> ContestListResult:
|
||||
async with httpx.AsyncClient() as client:
|
||||
html = await fetch_text(client, INDEX_PATH)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue