Skip to content

AI-powered HTTP API for automated Codeforces editorial extraction. Supports dynamic content (JS), PDF/HTML tutorials, and LLM powered parsing with Redis caching.

License

Notifications You must be signed in to change notification settings

deyna256/codeforces-contest-scraper

Repository files navigation

Codeforces Editorial Finder

Python 3.13+ uv Ruff LiteStar License: MIT

HTTP API for extracting editorials/tutorials for Codeforces problems using AI (GPT-4o).

Quick Start (Docker)

cp .env.example .env  # Add your OPENAI_API_KEY
docker-compose up -d

API available at http://localhost:8000

API Usage

POST /editorial

{ "url": "https://codeforces.com/problemset/problem/1/A" }

Supported Formats

  • https://codeforces.com/problemset/problem/{contest_id}/{problem_id}

Development

Managed with uv and just.

Just Commands

  • just build / just up / just down - Docker management
  • just test - Run pytest
  • just format / just lint - Ruff checks
  • just typecheck - Type validation

Architecture

System Layers

┌─────────────────────────────────────────┐
│   Presentation Layer (HTTP API)         │  ← LiteStar routes, schemas
├─────────────────────────────────────────┤
│   Application Layer (Use Cases)         │  ← Orchestrator, cache logic
├─────────────────────────────────────────┤
│   Domain Layer (Business Logic)         │  ← Parsers, extractors, models
├─────────────────────────────────────────┤
│   Infrastructure Layer (External APIs)  │  ← HTTP, OpenAI, Redis clients
└─────────────────────────────────────────┘

Project Structure

src/
├── presentation/  # HTTP API (Routes, Schemas, Apps)
├── application/   # Orchestration & Use cases
├── domain/        # Business logic (Parsers, Extractors, Fetchers)
├── infrastructure/# External clients (HTTP, OpenAI, Redis)
└── config.py      # Pydantic settings

deyna256 | MIT License

About

AI-powered HTTP API for automated Codeforces editorial extraction. Supports dynamic content (JS), PDF/HTML tutorials, and LLM powered parsing with Redis caching.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 6

Languages