UNPKG

online-judge-scraper

Version:

A library to extract information easily from various online judges.

64 lines (63 loc) 1.84 kB
import type { TestCase } from '../types/problem.js'; import { Scraper, ScraperError } from './base.js'; export type CodeforcesURLParams = { type: 'group_url'; contestId: string; problemId: string; groupId: string; } | { type: 'contest_url' | 'problemset_url' | 'gym_url'; contestId: string; problemId: string; }; export declare class CodeforcesScraperError extends ScraperError { constructor(type: string, message: string); } export declare class CodeforcesScraper implements Scraper<CodeforcesURLParams> { static readonly URL_PATTERNS: readonly [{ readonly type: "contest_url"; readonly regexp: RegExp; }, { readonly type: "problemset_url"; readonly regexp: RegExp; }, { readonly type: "gym_url"; readonly regexp: RegExp; }, { readonly type: "group_url"; readonly regexp: RegExp; }]; private assert; canHandle(url: string): boolean; getParams(url: string): { type: "group_url"; groupId: string; contestId: string; problemId: string; } | { type: "contest_url" | "problemset_url" | "gym_url"; contestId: string; problemId: string; groupId?: undefined; } | null; extractData(html: string): { name: string; description: string; plainTextDescription: string; timeLimit: string; memoryLimit: string; tags: string[]; difficulty: string | undefined; sampleTestCases: TestCase[]; }; getProblem(url: string): Promise<{ name: string; description: string; plainTextDescription: string; timeLimit: string; memoryLimit: string; tags: string[]; difficulty: string | undefined; sampleTestCases: TestCase[]; }>; }