├── public ├── index.js ├── js │ └── script.js ├── css │ └── style.css └── home.html ├── user ├── index.js ├── codeforces.js ├── leetcode.js └── codechef.js ├── package.json ├── contests ├── codechef.js ├── leetcode.js ├── codeforces.js └── index.js ├── server.js ├── .gitignore └── README.md /public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/js/script.js: -------------------------------------------------------------------------------- 1 | const codes = document.querySelectorAll('.json-code'); 2 | codes.forEach((code) => { 3 | code.innerText = JSON.stringify(JSON.parse(code.innerText), null, 4); 4 | }); 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /user/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | 4 | router.get('/', (req, res) => { 5 | res.send('Hello World! from user'); 6 | }); 7 | 8 | router.use('/leetcode', require('./leetcode')); 9 | router.use('/codeforces', require('./codeforces')); 10 | router.use('/codechef', require('./codechef')); 11 | 12 | module.exports = router; 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cp-api", 3 | "version": "1.0.0", 4 | "description": "api for competitive programming", 5 | "main": "server.js", 6 | "scripts": { 7 | "start": "node server" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "nodemon": "^2.0.19" 13 | }, 14 | "dependencies": { 15 | "axios": "^0.27.2", 16 | "cheerio": "^1.0.0-rc.12", 17 | "cors": "^2.8.5", 18 | "express": "^4.18.1" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /contests/codechef.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const axios = require('axios'); 4 | 5 | 6 | router.get('/', (req, res) => { 7 | axios.post('https://www.codechef.com/api/list/contests/all?sort_by=START&sorting_order=asc&offset=0&mode=all',{ 8 | headers: { 9 | 'Content-Type': 'application/json', 10 | } 11 | }) 12 | .then((response) => { 13 | res.send(response.data); 14 | }) 15 | .catch((error) => { 16 | res.send(error); 17 | }); 18 | 19 | }); 20 | 21 | module.exports = router; -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const cors = require('cors'); 4 | const fs = require('fs'); 5 | 6 | app.use(cors()); 7 | 8 | app.use(express.static('public')); 9 | 10 | app.get('/', (req, res) => { 11 | const html = fs.readFileSync('public/home.html', 'utf-8'); 12 | res.send(html); 13 | }) 14 | 15 | app.use('/user', require('./user/index')); 16 | app.use('/contests', require('./contests/index')); 17 | 18 | app.listen(80,() => { 19 | console.log('Example app listening...!'); 20 | }); 21 | 22 | // Export the Express API 23 | module.exports = app; 24 | -------------------------------------------------------------------------------- /contests/leetcode.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const axios = require('axios'); 4 | 5 | 6 | router.get('/', (req, res) => { 7 | axios.post('https://leetcode.com/graphql',{ 8 | headers: { 9 | 'Content-Type': 'application/json', 10 | }, 11 | query: `{ 12 | topTwoContests{ 13 | title 14 | startTime 15 | duration 16 | cardImg 17 | } 18 | }` 19 | }) 20 | .then((response) => { 21 | res.send(response.data); 22 | }) 23 | .catch((error) => { 24 | res.send(error); 25 | }); 26 | 27 | }); 28 | 29 | 30 | module.exports = router; -------------------------------------------------------------------------------- /user/codeforces.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const axios = require('axios'); 4 | 5 | router.get('/', (req, res) => { 6 | res.send('Hello World! from leetcode'); 7 | }); 8 | 9 | router.get('/:username', async (req, res) => { 10 | let userdata = [] 11 | let userinfo = await axios.get('https://codeforces.com/api/user.info?handles='+req.params.username) 12 | .then((response)=> { (response.data.status == 'OK') ? userdata.push(response.data.result[0]) : userdata.push({ error: 'User not found' }) }) 13 | .catch((error) => { 14 | userdata.push({ error: 'User not found' }) 15 | }); 16 | let userratings = await axios.get('https://codeforces.com/api/user.rating?handle='+req.params.username) 17 | .then((response)=> (response.data.status == 'OK') ? userdata.push({ratings:response.data.result}):"") 18 | .catch((error) => { 19 | }); 20 | res.json(userdata); 21 | }); 22 | 23 | module.exports = router; 24 | -------------------------------------------------------------------------------- /contests/codeforces.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const axios = require('axios'); 4 | 5 | 6 | router.get('/', (req, res) => { 7 | axios.post('https://codeforces.com/api/contest.list',{ 8 | headers: { 9 | 'Content-Type': 'application/json', 10 | } 11 | }) 12 | .then((response) => { 13 | let data = response.data.result; 14 | let contests = []; 15 | for(let i=0;i { 28 | return a.startTime - b.startTime; 29 | }); 30 | res.send(contests); 31 | }) 32 | .catch((error) => { 33 | res.send(error); 34 | }); 35 | 36 | }); 37 | 38 | module.exports = router; -------------------------------------------------------------------------------- /user/leetcode.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const axios = require('axios'); 4 | 5 | router.get('/', (req, res) => { 6 | res.send('Hello World! from leetcode'); 7 | }); 8 | 9 | router.get('/:username', (req, res) => { 10 | axios.post('https://leetcode.com/graphql',{ 11 | headers: { 12 | 'Content-Type': 'application/json', 13 | }, 14 | query: `{ 15 | matchedUser(username: ` + '"' + req.params.username + '"' + `) { 16 | username 17 | profile{ 18 | userAvatar 19 | } 20 | languageProblemCount{ 21 | languageName 22 | problemsSolved 23 | } 24 | submitStats: submitStatsGlobal { 25 | acSubmissionNum { 26 | difficulty 27 | count 28 | submissions 29 | } 30 | } 31 | badges{ 32 | name 33 | } 34 | userCalendar{ 35 | streak 36 | totalActiveDays 37 | } 38 | 39 | } 40 | userContestRanking(username: ` + '"' + req.params.username + '"' + `) { 41 | attendedContestsCount 42 | globalRanking 43 | rating 44 | topPercentage 45 | totalParticipants 46 | } 47 | 48 | }` 49 | }) 50 | .then((response) => { 51 | res.send(response.data); 52 | }) 53 | .catch((error) => { 54 | res.send(error); 55 | }); 56 | 57 | }); 58 | 59 | module.exports = router; 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # Snowpack dependency directory (https://snowpack.dev/) 45 | web_modules/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | .parcel-cache 78 | 79 | # Next.js build output 80 | .next 81 | out 82 | 83 | # Nuxt.js build / generate output 84 | .nuxt 85 | dist 86 | 87 | # Gatsby files 88 | .cache/ 89 | # Comment in the public line in if your project uses Gatsby and not Next.js 90 | # https://nextjs.org/blog/next-9-1#public-directory-support 91 | # public 92 | 93 | # vuepress build output 94 | .vuepress/dist 95 | 96 | # Serverless directories 97 | .serverless/ 98 | 99 | # FuseBox cache 100 | .fusebox/ 101 | 102 | # DynamoDB Local files 103 | .dynamodb/ 104 | 105 | # TernJS port file 106 | .tern-port 107 | 108 | # Stores VSCode versions used for testing VSCode extensions 109 | .vscode-test 110 | 111 | # yarn v2 112 | .yarn/cache 113 | .yarn/unplugged 114 | .yarn/build-state.yml 115 | .yarn/install-state.gz 116 | .pnp.* 117 | 118 | test.js -------------------------------------------------------------------------------- /user/codechef.js: -------------------------------------------------------------------------------- 1 | const cheerio = require('cheerio'); 2 | const express = require('express'); 3 | const router = express.Router(); 4 | const axios = require('axios'); 5 | 6 | router.get('/', (req, res) => { 7 | res.send('Hello World! from leetcode'); 8 | }); 9 | 10 | router.get('/:username', async (req, res) => { 11 | let $; 12 | let userinfo = await axios.get('https://www.codechef.com/users/'+req.params.username,{ 13 | headers: { 14 | redirect: 'manual' 15 | } 16 | }) 17 | .then((data)=>{$ = cheerio.load(data.data);}) 18 | .catch((error) => { 19 | console.log(error); 20 | }) 21 | 22 | 23 | let script = $('main script').last().text(); 24 | let all_rating = script.match(/var all_rating = (.*);/); 25 | if(all_rating === null){ 26 | all_rating = [{},{}] 27 | all_rating[1] = JSON.stringify(all_rating[1]); 28 | } 29 | 30 | 31 | let userdata = { 32 | username: '', 33 | rating: $('.rating').first().text(), 34 | rating_number: parseInt($('.rating-number').text()), 35 | country: $('.user-country-name').text(), 36 | user_type: '', 37 | institution: '', 38 | organisation: '', 39 | global_rank: $('.rating-ranks ul li').first().find('strong').text(), 40 | country_rank: $('.rating-ranks ul li').last().find('strong').text(), 41 | max_rank: parseInt($('.rating-header small').text().match(/\d+/)), 42 | all_rating: JSON.parse(all_rating[1]), 43 | } 44 | $('.user-details li').each((i,item)=>{ 45 | if($(item).find('label').text() == 'Student/Professional:'){ 46 | userdata.user_type = $(item).find('span').text(); 47 | }else if($(item).find('label').text() == 'Institution:'){ 48 | userdata.institution = $(item).find('span').text(); 49 | }else if($(item).find('label').text() == 'Organisation:'){ 50 | userdata.organisation = $(item).find('span').text(); 51 | 52 | }else if($(item).find('label').text() == 'Username:'){ 53 | userdata.username = $(item).find('span').last().text(); 54 | } 55 | }); 56 | 57 | if(userdata.username == ''){ 58 | res.json({error: 'User not found'}); 59 | }else{ 60 | res.json(userdata); 61 | } 62 | 63 | 64 | 65 | }); 66 | 67 | module.exports = router; 68 | -------------------------------------------------------------------------------- /public/css/style.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.cdnfonts.com/css/segoe-ui-4'); 2 | 3 | html { 4 | -webkit-box-sizing: border-box; 5 | -moz-box-sizing: border-box; 6 | box-sizing: border-box; 7 | } 8 | *, 9 | *::before, 10 | *::after { 11 | -webkit-box-sizing: inherit; 12 | -moz-box-sizing: inherit; 13 | box-sizing: inherit; 14 | } 15 | :root { 16 | --background: #eee; 17 | --card-background: white; 18 | --text: #1a1a1a; 19 | --border: #ccc; 20 | --stroke: #a9a9a9; 21 | --blue-light: #2196f3; 22 | --blue-transparent: #2196f3aa; 23 | --blue-dark: #1e88e5; 24 | --button-outline: black; 25 | --red: #ff6464; 26 | --yellow: #ffee58; 27 | --yellow-light: #fffde7; 28 | } 29 | 30 | body{ 31 | font-family: 'Segoe UI', sans-serif; 32 | font-size: 16px; 33 | background: var(--background); 34 | color: var(--text); 35 | margin: 0; 36 | padding: 0; 37 | line-height: 1.5; 38 | 39 | } 40 | h1{ 41 | width: 100%; 42 | font-family: 'Segoe UI', sans-serif; 43 | font-weight: 700; 44 | text-align: center; 45 | padding: 0; 46 | } 47 | 48 | .github{ 49 | width: 100%; 50 | height: 100%; 51 | display: flex; 52 | justify-content: center; 53 | align-items: center; 54 | gap: 1rem; 55 | padding: 0; 56 | margin: 0; 57 | } 58 | .github a img{ 59 | border-radius: 3px; 60 | } 61 | .container{ 62 | width: 100%; 63 | max-width: 550px; 64 | margin: 10px auto; 65 | padding: 25px; 66 | background: var(--card-background); 67 | border: 1px solid var(--border); 68 | border-radius: 6px; 69 | } 70 | 71 | .contests{ 72 | } 73 | 74 | .contest { 75 | width: 100%; 76 | margin: 10px; 77 | background: var(--card-background); 78 | border-radius: 6px; 79 | padding: 10px; 80 | border: 1px solid var(--border); 81 | 82 | } 83 | .contest table{ 84 | width: 100%; 85 | border-collapse: collapse; 86 | border-spacing: 0; 87 | border: 1px solid var(--border); 88 | border-radius: 6px; 89 | overflow: hidden; 90 | } 91 | .contest table th, .contest table td{ 92 | padding: 10px; 93 | text-align: left; 94 | border-bottom: 1px solid var(--border); 95 | } 96 | 97 | .response .json-code{ 98 | background: #282c2e; 99 | color: var(--background); 100 | padding: 10px; 101 | border-radius: 6px; 102 | border: 1px solid var(--border); 103 | overflow: auto; 104 | max-height: 300px; 105 | white-space: pre; 106 | } 107 | 108 | .returns { 109 | margin: 10px 0; 110 | font-weight: 600; 111 | } -------------------------------------------------------------------------------- /contests/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const axios = require('axios'); 4 | const cors = require('cors'); 5 | process.env.TZ = 'Asia/Kolkata' 6 | 7 | router.use(cors()); 8 | 9 | const parseCodechef = (data) => { 10 | let contests = []; 11 | for (let i = 0; i < data.length; i++) { 12 | let contest = {}; 13 | contest.site = 'codechef'; 14 | contest.title = data[i].contest_name; 15 | contest.startTime = data[i].contest_start_date; 16 | let date = new Date(contest.startTime) 17 | let milliseconds = date.getTime() 18 | contest.startTime = milliseconds; 19 | contest.duration = data[i].contest_duration*60*1000; 20 | contest.endTime = contest.startTime + contest.duration; 21 | contest.url = "https://www.codechef.com/"+data[i].contest_code; 22 | contests.push(contest); 23 | } 24 | return contests; 25 | } 26 | 27 | const parseCodeforces = (data) => { 28 | let contests = []; 29 | for (let i = 0; i < data.length; i++) { 30 | if(data[i].phase === 'FINISHED') break; 31 | let contest = {}; 32 | contest.site = 'codeforces'; 33 | contest.title = data[i].name; 34 | contest.startTime = data[i].startTimeSeconds*1000; 35 | contest.duration = data[i].durationSeconds*1000; 36 | contest.endTime = contest.startTime + contest.duration; 37 | contest.url = "https://codeforces.com/contest/"+data[i].id; 38 | contests.push(contest); 39 | } 40 | 41 | return contests; 42 | } 43 | 44 | const parseLeetcode = (data) => { 45 | let contests = []; 46 | for (let i = 0; i < data.length; i++) { 47 | let contest = {}; 48 | contest.site = 'leetcode'; 49 | contest.title = data[i].title; 50 | contest.startTime = data[i].startTime*1000; 51 | contest.duration = data[i].duration*60*1000; 52 | contest.endTime = contest.startTime + contest.duration; 53 | contest.url = "https://leetcode.com/contest/"+data[i].titleSlug; 54 | contests.push(contest); 55 | } 56 | return contests; 57 | } 58 | 59 | router.get('/', (req, res) => { 60 | res.send('Hello World'); 61 | }); 62 | 63 | 64 | 65 | router.get('/upcoming/', async (req, res) => { 66 | let contests = []; 67 | await axios.post('https://www.codechef.com/api/list/contests/all?sort_by=START&sorting_order=asc&offset=0&mode=all',{ 68 | headers: { 69 | 'Content-Type': 'application/json', 70 | } 71 | }) 72 | .then((response) => { 73 | contests.push(response.data.future_contests); 74 | }) 75 | .catch((error) => { 76 | res.send(error); 77 | }); 78 | await axios.post('https://leetcode.com/graphql',{ 79 | headers: { 80 | 'Content-Type': 'application/json', 81 | }, 82 | query: `{ 83 | topTwoContests{ 84 | title 85 | startTime 86 | duration 87 | cardImg 88 | titleSlug 89 | } 90 | }` 91 | }) 92 | .then((response) => { 93 | contests.push(response.data.data.topTwoContests); 94 | }) 95 | .catch((error) => { 96 | res.send(error); 97 | }); 98 | await axios.post('https://codeforces.com/api/contest.list',{ 99 | headers: { 100 | 'Content-Type': 'application/json', 101 | } 102 | }) 103 | .then((response) => { 104 | contests.push(response.data.result); 105 | }) 106 | .catch((error) => { 107 | res.send(error); 108 | }); 109 | let sorted = [].concat(parseLeetcode(contests[1]),parseCodeforces(contests[2]),parseCodechef(contests[0])).sort(function(a, b){ 110 | return a.startTime - b.startTime; 111 | }); 112 | res.send(sorted); 113 | }); 114 | 115 | router.use('/:platform', ()=>{ 116 | require('./platforms')(router); 117 | }); 118 | 119 | module.exports = router; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Comepete API 2 | 3 | #### Users Profile fetched from Codeforces, Codechef, and Leetcode. 4 | 5 | 6 | 7 |
8 | 9 | #### Users can be searched by username/handle. 10 |
11 | 12 | ## Features 13 | - rating, ranking 14 | - solutions, problems solved by user 15 | - contests participated by user 16 | - rating history 17 | 18 | ## Usage 19 | - get user profile
20 | ```https://competeapi.vercel.app/user///```
21 | This will return user info in json format. 22 | 23 | #### **Contest Platforms :** 24 | 1. codeforces
25 | 2. codechef
26 | 3. leetcode
27 | 28 | #### **Use :** 29 | 30 | #### User Info 31 | - get leetcode user info
32 | ```https://competeapi.vercel.app/user/leetcode//```
33 | This will return Leetcode user info in json format. 34 | - get codechef user info
35 | ```https://competeapi.vercel.app/user/codechef//```
36 | This will return Codechef user info in json format. 37 | - get codeforces user info
38 | ```https://competeapi.vercel.app/user/codeforces//```
39 | This will return Codeforces user info in json format.
40 | 41 | ### **Example** 42 | #### Example request for user info: 43 | ```[https://competeapi.vercel.app/user/codeforces/bharanispace/```
44 | *[https://competeapi.vercel.app/user/codeforces/bharanispace/](https://competeapi.vercel.app/user/codeforces/bharanispace/)* 45 | 46 | #### Example response for user info: 47 | ```json 48 | [ 49 | { 50 | "contribution": 0, 51 | "lastOnlineTimeSeconds": 1660836836, 52 | "rating": 349, 53 | "friendOfCount": 1, 54 | "titlePhoto": "https://cdn-userpic.codeforces.com/no-title.jpg", 55 | "rank": "newbie", 56 | "handle": "Bharanispace", 57 | "maxRating": 349, 58 | "avatar": "https://cdn-userpic.codeforces.com/no-avatar.jpg", 59 | "registrationTimeSeconds": 1655563973, 60 | "maxRank": "newbie" 61 | }, 62 | { 63 | "ratings": [ 64 | { 65 | "contestId": 1701, 66 | "contestName": "Educational Codeforces Round 131 (Rated for Div. 2)", 67 | "handle": "Bharanispace", 68 | "rank": 14409, 69 | "ratingUpdateTimeSeconds": 1657298100, 70 | "oldRating": 0, 71 | "newRating": 349 72 | } 73 | ] 74 | } 75 | ] 76 | 77 | ``` 78 | 79 | #### Contests Info 80 | 81 | #### Upcoming Contests 82 | - Upcoming Contests of all sites
83 | ```https://competeapi.vercel.app/contests/upcoming/```
84 | This will return all future contests 85 | 86 | #### Request 87 | [https://competeapi.vercel.app/contests/upcoming/](https://competeapi.vercel.app/contests/upcoming/) 88 | 89 | #### Response 90 | ``` 91 | [ 92 | { 93 | "site": "codeforces", 94 | "title": "Codeforces Round #817 (Div. 4)", 95 | "startTime": 1661870100000, 96 | "duration": 8100000, 97 | "endTime": 1661878200000, 98 | "url": "https://codeforces.com/contest/1722" 99 | }, 100 | { 101 | "site": "codechef", 102 | "title": "Starters 54 (Rated for Div 2, 3 & 4)", 103 | "startTime": 1661956200000, 104 | "duration": 10800000, 105 | "endTime": 1661967000000, 106 | "url": "https://www.codechef.com/START54" 107 | } 108 | ] 109 | ``` 110 | 111 | 112 | - get leetcode contests info
113 | ```https://competeapi.vercel.app/contests/leetcode/```
114 | This will return Leetcode user info in json format. 115 | - get codechef contests info
116 | ```https://competeapi.vercel.app/contests/codechef/```
117 | This will return Codechef user info in json format. 118 | - get codeforces contests info
119 | ```https://competeapi.vercel.app/contests/codeforces/```
120 | This will return Codeforces user info in json format. 121 | 122 | ### Example 123 | 124 | #### Example request for contests info: 125 | ```[https://competeapi.vercel.app/contests/leetcode/```
126 | *[https://competeapi.vercel.app/contests/leetcode/](https://competeapi.vercel.app/contests/leetcode/)* 127 | 128 | #### Example response for contests info: 129 | ```json 130 | { 131 | "data": { 132 | "topTwoContests": [ 133 | { 134 | "title": "Weekly Contest 308", 135 | "startTime": 1661653800, 136 | "duration": 5400, 137 | "cardImg": null 138 | }, 139 | { 140 | "title": "Biweekly Contest 86", 141 | "startTime": 1662215400, 142 | "duration": 5400, 143 | "cardImg": "https://assets.leetcode.com/contest/biweekly-contest-86/card_img_1661011324.png" 144 | } 145 | ] 146 | } 147 | } 148 | 149 | ``` 150 | -------------------------------------------------------------------------------- /public/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Compete API 8 | 9 | 10 | 11 |

Compete API

12 | 13 | 14 | 15 | 26 | 27 | 28 |
29 |

Contests :

30 |
31 |
32 |

1. All Contests

33 |

Endpoint : /contests/upcoming

34 | 35 |
36 | Return type: JSON 37 | value: Array of all contests 38 | 39 |
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 |
FieldValue
site Name of the site / platform
title Name of the contest
startTime Start time of the contest
duration Duration of the contest
endTime End time of the contest
url URL of the contest
73 | 74 |
75 |

Response

76 |
77 | [ 78 | { 79 | "site": "codeforces", 80 | "title": "Codeforces Round #842 (Div. 2)", 81 | "startTime": 1672929300000, 82 | "duration": 7200000, 83 | "endTime": 1672936500000, 84 | "url": "https://codeforces.com/contest/1768" 85 | }, 86 | { 87 | "site": "leetcode", 88 | "title": "Biweekly Contest 95", 89 | "startTime": 1673101800000, 90 | "duration": 324000000, 91 | "endTime": 1673425800000, 92 | "url": "https://leetcode.com/contest/biweekly-contest-95" 93 | }, 94 | { 95 | "site": "leetcode", 96 | "title": "Weekly Contest 327", 97 | "startTime": 1673145000000, 98 | "duration": 324000000, 99 | "endTime": 1673469000000, 100 | "url": "https://leetcode.com/contest/weekly-contest-327" 101 | } 102 | ] 103 |
104 |
105 | 106 |
107 |
108 |

2. Codeforces Contests

109 |

Endpoint : /contests/codeforces

110 | 111 |
112 | Returns : Array of all codeforces contests 113 | 114 |
115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
FieldValue
site Name of the site / platform
title Name of the contest
startTime Start time of the contest
duration Duration of the contest
endTime End time of the contest
url URL of the contest
148 | 149 |
150 |

Response

151 |
152 | [ 153 | { 154 | "site": "codeforces", 155 | "title": "Codeforces Round #842 (Div. 2)", 156 | "startTime": 1672929300000, 157 | "duration": 7200000, 158 | "endTime": 1672936500000, 159 | "url": "https://codeforces.com/contests/1768" 160 | }, 161 | { 162 | "site": "codeforces", 163 | "title": "Educational Codeforces Round 141 (Rated for Div. 2)", 164 | "startTime": 1673188500000, 165 | "duration": 7200000, 166 | "endTime": 1673195700000, 167 | "url": "https://codeforces.com/contests/1783" 168 | } 169 | ] 170 |
171 |
172 |
173 | 174 | 175 | 176 | 177 | --------------------------------------------------------------------------------