Timus's blog

By Timus, 10 years ago, translation, In English

Hello,

I have decided to filter problems on CF (e.g. only Div. 1 A tasks). There is no such function in the problemset. So I decided to write a small script. I am going to share it with you: GitHub

It is very easy to use it: python filter.py (Requires Python 2.7, requests, json). You can change the language of the script to English (comment the line #7 and uncomment the line #8). Script creates some files (problems.list, contests.list etc). I've made it to decrease the load to Codeforces. Only tasks in "Div. 1 Only" or "Div. 2 Only" (with standart CF rules) are considered.

The following page will be opened at the end:

I don't want to make changes to this script. Please feel free to perform any kind of changes:)

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

| Write comment?
»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks for the script, I am having a little problem.
After execution completes ,I get the page like this(picture attached), with Problem titles as
"Трамвай" for Tram. Is this some Unicode problem??
I am using Ubuntu 14.04 64-bit.

  • »
    »
    10 years ago, # ^ |
    Rev. 2   Vote: I like it +8 Vote: I do not like it

    I think you haven't changed domain(in script) to .com and you see problem names in russian

    • »
      »
      »
      10 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      I have changed to "com", and Tram in Russian isТрамвай.
      There are some words in English also on this page along with those Unique ones.

      • »
        »
        »
        »
        10 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Oh, I see. I checked it and problem is in browser. I set 'utf-8' in chromium settings and now everything works fine for russian.
        Also I think you've changes domain, but after script has already cached problem names in russian:)

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    Offtop. How did you change the interface of Ubuntu?

»
10 years ago, # |
  Vote: I like it +5 Vote: I do not like it

That's what I really needed :) Thank you!

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I downloaded Python 2.7, how do I get requests and json if I am using windows?

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    you should install pip2.7 first (HOWTO)

    then execute "C:\python27\pip2.7 install requests" where C:\python27 is the directory with python installed

    as far as i know json is included into python2.7 default modules

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

It seems that this script does not work anymore. I start to get the following error since recently.

Handle: lzhang Loading submissions for handle lzhang ... Traceback (most recent call last): File "filter.py", line 123, in problems_status = get_problems_status(submissions) File "filter.py", line 92, in get_problems_status verdict = submission["verdict"] KeyError: 'verdict'

I guess there is an update in codeforces website that breaks the script?