| Crates.io | cscrapper |
| lib.rs | cscrapper |
| version | 0.1.3 |
| created_at | 2025-03-15 11:47:54.395831+00 |
| updated_at | 2025-08-10 21:36:25.314495+00 |
| description | Scrapper for competitive programming websites |
| homepage | https://rootcircle.github.io/blog/project/cpast.html |
| repository | https://github.com/rootCircle/cpast_mono |
| max_upload_size | |
| id | 1593494 |
| size | 97,013 |
cscrapper is a tool designed to scrape problem statements from popular competitive programming platforms like CodeChef and CodeForces. It provides a unified interface to fetch problem details, including the problem statement, input format, and constraints.
Ensure you have Rust installed on your machine. You can install Rust using rustup.
Add cscrapper as a dependency in your Cargo.toml:
[dependencies]
cscrapper = "0.1"
Here’s a complete example demonstrating how to use the cscrapper module:
use cscrapper::{get_problem_statement, CodePlatform};
#[tokio::main]
async fn main() {
// Fetch a problem statement from CodeChef
let result = get_problem_statement(CodePlatform::CodeChef("NONNEGPROD")).await;
match result {
Ok(response) => {
println!("Statement: {}", response.statement);
println!("Input Format: {}", response.input_format);
println!("Constraints: {}", response.constraints);
}
Err(e) => eprintln!("Error fetching problem statement: {:?}", e),
}
// Fetch a problem statement from CodeForces
let result = get_problem_statement(CodePlatform::CodeForces("1331", "B"));
match result {
Ok(response) => {
println!("Statement: {}", response.statement);
println!("Input Format: {}", response.input_format);
println!("Constraints: {}", response.constraints);
}
Err(e) => eprintln!("Error fetching problem statement: {:?}", e),
}
}