feat: additional platforms (LeetCode, USACO, Kattis) #262

Closed
opened 2026-02-27 00:21:19 +00:00 by barrettruth · 0 comments
barrettruth commented 2026-02-27 00:21:19 +00:00

Problem

cp.nvim supports AtCoder, CodeChef, Codeforces, and CSES. Notable omissions:

  • LeetCode — largest CP/interview platform by user count (weekly + biweekly contests)
  • USACO — primary US competitive programming ladder for pre-college and college students
  • Kattis — used by ICPC North America regionals, hosts Open Kattis

These have significant user populations that currently cannot use cp.nvim.

Proposed solution

Add scraper implementations under scrapers/ following the existing BaseScraper interface:

  • LeetCode: GraphQL API (https://leetcode.com/graphql) — questionData query returns title, content, exampleTestcaseList, and time/memory limits. Requires session cookie for authenticated endpoints; contest problems require timing check.
  • USACO: Static HTML, problems at usaco.org/index.php?page=viewproblem2&cpid=<id>. Sample I/O is in <pre> blocks. No auth required for samples.
  • Kattis: open.kattis.com/problems/<id> — samples in zip download at <id>/file/statement/samples.zip. Auth optional (open problems are public).

Each platform requires adding to constants.PLATFORMS and wiring up the scraper. No Lua changes are needed beyond the constants.

Alternatives considered

Recommending Competitive Companion (issue #255) as the universal solution. That is the right long-term answer, but having native scrapers for these platforms provides a better UX since no browser extension is required.

## Problem cp.nvim supports AtCoder, CodeChef, Codeforces, and CSES. Notable omissions: - **LeetCode** — largest CP/interview platform by user count (weekly + biweekly contests) - **USACO** — primary US competitive programming ladder for pre-college and college students - **Kattis** — used by ICPC North America regionals, hosts Open Kattis These have significant user populations that currently cannot use cp.nvim. ## Proposed solution Add scraper implementations under `scrapers/` following the existing `BaseScraper` interface: - **LeetCode**: GraphQL API (`https://leetcode.com/graphql`) — `questionData` query returns title, content, `exampleTestcaseList`, and time/memory limits. Requires session cookie for authenticated endpoints; contest problems require timing check. - **USACO**: Static HTML, problems at `usaco.org/index.php?page=viewproblem2&cpid=<id>`. Sample I/O is in `<pre>` blocks. No auth required for samples. - **Kattis**: `open.kattis.com/problems/<id>` — samples in zip download at `<id>/file/statement/samples.zip`. Auth optional (open problems are public). Each platform requires adding to `constants.PLATFORMS` and wiring up the scraper. No Lua changes are needed beyond the constants. ## Alternatives considered Recommending Competitive Companion (issue #255) as the universal solution. That is the right long-term answer, but having native scrapers for these platforms provides a better UX since no browser extension is required.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/cp.nvim#262
No description provided.