Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

un-oj

un-oj146MIT0.3.2TypeScript support: included

Unified Online Judge information collector.

un-oj, oj, online-judge, competitive-programming

readme

UnOJ

JSR

Unified information collector of online competitive programming platforms.

Usage

Install un-oj from NPM, or @un-oj/core from JSR.

import Codeforces from '@un-oj/core/platforms/codeforces'; // If installed from JSR
// import Codeforces from 'un-oj/platforms/codeforces'; // If installed from NPM

const cf = new Codeforces();
console.log(await cf.getProblem('1A'));

Currently supported platforms:

Documents are available on JSR.

Compataility

UnOJ uses internal APIs, or parses HTML from some OJ, which may be changed at any time. If you encountered any problems, feel free to open an issue.

Acknowledgements

changelog

Changelog

0.3.2 (2025-06-02)

🩹 Bug Fixes

  • Fix Node.js JSON import issue

0.3.1 (2025-06-02)

🩹 Bug Fixes

  • Fix Node.js subpath import issue

0.3.0 (2025-06-02)

⚠️ Breaking Changes

  • The Tag generic of Problem doesn't allow number[] anymore. Use TagInfo[] instead
  • DEFAULT_BASE_URL of each platform is moved out of the class. You can directly import it from the platform module
  • luogu: Problem#tags is now TagInfo[] instead of number[]

🚀 Features

  • Add Hydro platform
  • Add LeetCode platform
  • Add Lyrio platform
  • Add Platform#getContest to get contest information
  • luogu: Support Platform#getContest

🩹 Bug Fixes

  • atcoder: Compat with new memory limit format
  • luogu: Correct problem description when some of its sections aren't complete. Non-existing sections are now '' instead of null

0.2.0 (2025-05-04)

More platforms are on the roadmap. Contributions are welcome!

⚠️ Breaking Changes

  • Base interface Problem is more loose now, and every platform exports its own Problem. Checkout the current docs for more details
  • Custom error classes are changed to reduce complexity. Checkout the current docs for more details
  • Remove name property from all platforms
  • luogu: Problem#tags is now number[] instead of string[]

🚀 Features

  • Add AtCoder platform
  • Add MXOJ platform

🩹 Bug Fixes

  • Abstract class Platform now returns rejected promises instead of directly throwing when methods are not implemented

0.1.0 (2025-04-26)

🚀 Let's go!