GithubHelp home page GithubHelp logo

cps's Introduction

Competitive Programming Scraper (CPS)

This is a web scraper I made for downloading DMOJ problem solutions. DMOJ is a platform for training in competitive programming, similar to Codeforces and Leetcode.

Here's my DMOJ profile

This project is my first written in python, and utilizes the Requests library to make HTTP requests and persist user login. It assumes that all of a users solutions are written in C++, support for other languages will be implemented at a later date.

Getting Started

First install the required libraries from the PyPI repository

pip install bs4 requests python-dotenv

Then clone the project to your machine

git clone https://github.com/JonathanYuan900/CPS.git
cd CPS

Finally, you will need to create a file called .env defining the environment variables DMOJ_USERNAME, DMOJ_PASSWORD and TARGET_DIRECTORY

For example

DMOJ_USERNAME=your_username
DMOJ_PASSWORD=your_password
TARGET_DIRECTORY=path_to_download_directory

Usage

To run the program, simply execute

python main.py

Further Notes

Download times for each solution will vary. This is because the scraper looks for your best solution within the solution ranking pages of each problem.

For a low point problem such as CCC '17 J1 - Quadrant Selection , there will be thousands of solutions spanning across multiple pages in the ranking tab. Scraping and processing my solution for this problem (placed on the 23rd page) takes around one minute to complete.

In contrast, high point problems such as COCI '14 Contest 1 #6 Kamp have a relatively small number of people submitting to them, so one's solution will have a higher chance of being placed on an earlier ranking page. Scraping and processing my solution for this problem (placed 3rd overall) takes around one second.

Therefore, the time taken to download one's problem solution generally depends on the ranking placement of said solution, and the number of people who have solved the problem.

cps's People

Contributors

jonathanyuan23 avatar

Watchers

 avatar

Forkers

williamzhang20

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.