jefferyfan3a's blog

By jefferyfan3a, history, 6 months ago, In English,

Hi! I tried to download all of the CodeForces problems down for a ib cs hl project. I used wget and I have gotten 403 forbiddened after that.And I have to use vpns to enter CodeForces now. Is there any way to fix this? Please leave reasons of why you downvoted. Don't just leave downvotes and leave.... Thank you!

 
 
 
 
  • Vote: I like it
  • +5
  • Vote: I do not like it

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by jefferyfan3a (previous revision, new revision, compare).

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I think you should post wget query you tried to execute. But besides I don't think there is REST query to download all tasks from cf and there should be one.

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I did it using python request library.

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How did you not get banned?

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How did you? :P You can use this script

      import requests
      
      with requests.Session() as s:
          problems = s.get("https://codeforces.com/api/problemset.problems").json()
      
          for problem in problems['result']['problems']:
              cid = problem['contestId']
              name = problem['index']
      
              response = s.get(f'https://codeforces.com/problemset/problem/{cid}/{name}')
              assert response.status_code == 200
      
              # Do whatever you want with `problem_page`
              problem_page = response.text
              print(f"Downloaded: Problem {name} Contest {cid}")
      
»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Does any one know how to be authorized?