-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
34 lines (30 loc) · 953 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env node
const axios = require('axios');
const codeforces = require('./platforms/codeforces');
const codechef = require('./platforms/codechef');
const atcoder = require('./platforms/atcoder');
// Accessing the contest platform
const contest_platform = process.argv[2];
// Accessing the contest url from the terminal
const contest_url = process.argv[3];
// Main entry
// Checks correctness of url provided
axios.get(contest_url)
.then(response => {
switch(contest_platform) {
case 'codeforces':
codeforces(response.data);
break;
case 'codechef':
codechef(response.data);
break;
case 'atcoder':
atcoder(response.data);
break;
default:
throw Error(contest_platform+ ' is not a valid platform');
}
})
.catch(error => {
console.log(error);
});