{"id":15047142,"url":"https://github.com/forthright48/ojscraper","last_synced_at":"2025-04-10T00:50:53.842Z","repository":{"id":57313943,"uuid":"93119805","full_name":"forthright48/ojscraper","owner":"forthright48","description":"Simple JS module that scraps data from online judges","archived":false,"fork":false,"pushed_at":"2020-09-03T02:37:52.000Z","size":53,"stargazers_count":3,"open_issues_count":9,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T02:37:06.479Z","etag":null,"topics":["competitive-programming","cpps","online-judges","scraper"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/forthright48.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-02T02:42:15.000Z","updated_at":"2021-02-26T19:48:24.000Z","dependencies_parsed_at":"2022-09-20T23:20:35.861Z","dependency_job_id":null,"html_url":"https://github.com/forthright48/ojscraper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forthright48%2Fojscraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forthright48%2Fojscraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forthright48%2Fojscraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forthright48%2Fojscraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forthright48","download_url":"https://codeload.github.com/forthright48/ojscraper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137999,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["competitive-programming","cpps","online-judges","scraper"],"created_at":"2024-09-24T20:54:48.760Z","updated_at":"2025-04-10T00:50:53.820Z","avatar_url":"https://github.com/forthright48.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OJScraper\n\nA javascript module to scrap online judge and retrieve informations.\n\nCurrently supports scraping of UVa, Codeforces, HDU and SPOJ.\n\n# Install\n\n`npm install --save ojscraper`\n\n# Use\n\n```\nconst ojscraper = require('ojscraper');\n\nojscraper.getProblemInfo({\n  ojname: 'uva',\n  problemID: '100'\n})\n.then(function(info){\n  console.log(info);\n  /**\n   * {\n      \"platform\": \"uva\",\n      \"problemID\": \"100\",\n      \"title\": \"The 3n + 1 problem\",\n      \"link\": \"http://uva.onlinejudge.org/index.php?option=com_onlinejudge\u0026Itemid=8\u0026category=18\u0026page=show_problem\u0026problem=36\"\n      }\n   */\n})\n\nojscraper.getUserInfo({\n  ojname: 'uva',\n  username: 'forthright48'\n})\n.then(function(info){\n  console.log(info);\n  /**\n   * {\n      \"platform\": \"uva\",\n      \"username\": \"forthright48\",\n      \"userID\": \"128671\",\n      \"solveCount\": 1464,\n      \"solveList\": [100, 101 ... too many to view]\n      }\n   */\n})\n```\n**Only promise is returned. Callback is not supported.**\n\n# Methods\n\nThere are only two methods:\n\n## `getProblemInfo()`\n\nIt accepts an object as parameter. The object must have the following two fields: `ojname` and `problemID`. Look below for possible values of `ojname` and their corresponding problemID formats.\n\n## `getUserInfo()`\n\nIt accepts an object as parameter. The object must have the following two fields: `ojname` and `username`. A list of problem Ids which have been solved by the user is returned.\n\n# Values of `ojname`\n\n1. [CodeChef](https://www.codechef.com/): 'cc'\n1. [Codeforces](http://codeforces.com/): 'cf'\n1. [HDU](http://acm.hdu.edu.cn/): 'hdu'\n1. [LOJ](http://www.lightoj.com/login_main.php): 'loj'\n1. [POJ](http://poj.org/): 'poj'\n1. [SPOJ](http://www.spoj.com/): 'spoj'\n1. [Uva Online Judge](https://uva.onlinejudge.org/): 'uva'\n1. [Vjudge](https://vjudge.net/): 'vjudge'\n1. [CSAcademy](https://csacademy.com): 'csa'\n1. [AtCoder](https://atcoder.jp/): 'atc'\n\nWell, that's it for now.\n\n# Formats of `problemID`\n\n`problemID` must match the following regex:\n\n1. cc: `^[A-Z0-9_]+$`\n1. cf: `^\\d+[A-Z]`\n1. hdu: `\\d{4}`\n1. loj: `\\d{4}`\n1. poj: `\\d{4}`\n1. spoj: `^[A-Z0-9_]+$`\n1. uva: `^\\d{3,5}$`\n\n# Special Cases\n\n## LightOJ\n\nSince the site is private, you need to provide a set of credential to access any info.\n\n```\nojscraper.getProblemInfo({\n  ojname: 'loj',\n  problemID: '1000',\n  credential: {\n    userId: USERID_FOR_LOGIN,\n    password: PASSWORD_FOR_LOGIN\n  }\n})\n```\n\n## VJudge\n\nYou can only get userinfo from vjudge, and that too for a particular sub oj.\n\n```\nojscraper.getProblemInfo({\n  ojname: 'loj',\n  problemID: '1000',\n  subojname: 'uva'\n})\n\n//Output: All problems from UVa that user solved in Vjudge\n```\n\n# TODO\n\n1. Make it compatible for browsers\n    1. CORS issue\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforthright48%2Fojscraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforthright48%2Fojscraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforthright48%2Fojscraper/lists"}