Skip to content

Commit 2c1a44f

Browse files
Igorjan94coderick14
authored andcommitted
gym support for codeforces.com
if contest_id is greater or equal than 100000, then it's gym contest
1 parent a433954 commit 2c1a44f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

acedit/util.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,8 @@ def scrape_problem(self):
528528
Method to scrape a single problem from codeforces
529529
"""
530530
print 'Fetching problem ' + self.contest + '-' + self.problem + ' from Codeforces...'
531-
url = 'http://codeforces.com/contest/' + \
532-
self.contest + '/problem/' + self.problem
531+
type = 'contest' if int(self.contest) <= 100000 else 'gym'
532+
url = 'http://codeforces.com/%s/%s/problem/%s' % (type, self.contest, self.problem)
533533
req = Utilities.get_html(url)
534534
inputs, outputs = self.parse_html(req)
535535
Utilities.store_files(self.site, self.contest,
@@ -541,7 +541,8 @@ def scrape_contest(self):
541541
Method to scrape all problems from a given codeforces contest
542542
"""
543543
print 'Checking problems available for contest ' + self.contest + '...'
544-
url = 'http://codeforces.com/contest/' + self.contest
544+
type = 'contest' if int(self.contest) <= 100000 else 'gym'
545+
url = 'http://codeforces.com/%s/%s' % (type, self.contest)
545546
req = Utilities.get_html(url)
546547
links = self.get_problem_links(req)
547548

0 commit comments

Comments
 (0)