| Crates.io | scraprr |
| lib.rs | scraprr |
| version | 0.1.3 |
| created_at | 2025-07-24 16:44:33.937027+00 |
| updated_at | 2026-01-02 05:15:46.88126+00 |
| description | A Rust web scraping library for Python |
| homepage | https://github.com/dariush-g/scraprr |
| repository | https://github.com/dariush-g/scraprr |
| max_upload_size | |
| id | 1766293 |
| size | 23,821 |
scraprr is a library for scraping HTML from the web.
<ul>, <li>, <div>, etc.)use scraprr::{fetch_url, fetch_url_with_options, RequestOptions, extract_tag};
fn main() {
// Basic GET request
let html = fetch_url("http://localhost:8000/demo.html");
println!("Raw HTML:\n{}", html);
// Extract the first <ul> tag and its contents
let tag = extract_tag(&html, "ul");
println!("First <ul> tag:\n{}", tag);
// Custom headers, cookies, and query parameters
let opts = RequestOptions {
headers: Some({
let mut h = std::collections::HashMap::new();
h.insert("User-Agent".into(), "scrapr/0.1".into());
h
}),
cookies: Some({
let mut c = std::collections::HashMap::new();
c.insert("sessionid".into(), "abc123".into());
c
}),
query: Some({
let mut q = std::collections::HashMap::new();
q.insert("q".into(), "Rust programming".into());
q
}),
};
let response = fetch_url_with_options("https://www.wikipedia.org", opts);
println!("Wikipedia page HTML:\n{}", response);
}
import scraprr
opts = scraprr.RequestOptions(
headers={"User-Agent": "XYZ/1.0"},
cookies={"sessionid": "abc123"},
query={"q": "Shrek"}
)
text = scraprr.fetch_url_with_options("https://html.duckduckgo.com/html", opts)
print(text)
pip install scraprr
curl -sSL https://raw.githubusercontent.com/dariush-g/scraprr/main/install_scraprr.sh | bash
pip install scraprr
cargo add scraprr