| Crates.io | ferrisfetcher |
| lib.rs | ferrisfetcher |
| version | 0.1.0 |
| created_at | 2025-12-01 00:28:40.549136+00 |
| updated_at | 2025-12-01 00:28:40.549136+00 |
| description | A cutting-edge, high-level web scraping library crafted in Rust |
| homepage | https://github.com/M1tsumi/FerrisFetcher |
| repository | https://github.com/M1tsumi/FerrisFetcher |
| max_upload_size | |
| id | 1959038 |
| size | 211,243 |
FerrisFetcher is a cutting-edge, high-level web scraping library crafted in Rust. Leveraging Tokio's asynchronous prowess for concurrent operations and Reqwest's efficient HTTP handling, FerrisFetcher provides a powerful, performant, and user-friendly web scraping solution.
Add FerrisFetcher to your Cargo.toml:
[dependencies]
ferrisfetcher = "0.1.0"
tokio = { version = "1.0", features = ["full"] }
use ferrisfetcher::FerrisFetcher;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fetcher = FerrisFetcher::new()?;
let result = fetcher.scrape("https://example.com").await?;
println!("Title: {}", result.title.unwrap_or_default());
println!("Status: {}", result.status_code);
Ok(())
}
use ferrisfetcher::{FerrisFetcher, Config};
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::new()
.with_user_agent("MyScraper/1.0")
.with_timeout(Duration::from_secs(30))
.with_max_concurrent_requests(10)
.without_rate_limit();
let fetcher = FerrisFetcher::with_config(config)?;
let result = fetcher.scrape("https://example.com").await?;
println!("Scraped: {} ({}ms)", result.url, result.scrape_time_ms);
Ok(())
}
use ferrisfetcher::{
FerrisFetcher,
ExtractionRuleBuilder,
ExtractionType
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut fetcher = FerrisFetcher::new()?;
// Add extraction rules
fetcher.add_extraction_rule(
ExtractionRuleBuilder::new("headings", "h1, h2, h3")
.extraction_type(ExtractionType::Text)
.multiple(true)
.build()
);
fetcher.add_extraction_rule(
ExtractionRuleBuilder::new("links", "a[href]")
.extraction_type(ExtractionType::Attribute)
.attribute("href")
.multiple(true)
.build()
);
let result = fetcher.scrape("https://example.com").await?;
// Access extracted data
if let Some(headings) = result.extracted_data.get("headings") {
println!("Found {} headings", headings.len());
for heading in headings {
println!(" - {}", heading);
}
}
Ok(())
}
use ferrisfetcher::FerrisFetcher;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fetcher = FerrisFetcher::new()?;
let urls = vec![
"https://example.com",
"https://example.org",
"https://example.net",
];
let results = fetcher.scrape_multiple(&urls).await?;
println!("Successfully scraped {} URLs", results.len());
for result in results {
println!(" {} - {}", result.url, result.title.unwrap_or_default());
}
Ok(())
}
use ferrisfetcher::{FerrisFetcher, Config, presets};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fetcher = FerrisFetcher::with_config_and_rules(
Config::new(),
presets::article() // Predefined rules for article extraction
)?;
let result = fetcher.scrape("https://news.example.com/article").await?;
// Automatically extracted article data
println!("Title: {:?}", result.extracted_data.get("title"));
println!("Author: {:?}", result.extracted_data.get("author"));
println!("Content: {:?}", result.extracted_data.get("content"));
Ok(())
}
use ferrisfetcher::{FerrisFetcherBuilder, ExtractionRuleBuilder, ExtractionType};
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fetcher = FerrisFetcherBuilder::new()
.user_agent("AdvancedScraper/1.0")
.timeout(Duration::from_secs(20))
.max_concurrent_requests(8)
.without_rate_limit()
.header("X-Custom-Header", "value")?
.add_rule(
ExtractionRuleBuilder::new("images", "img[src]")
.extraction_type(ExtractionType::Attribute)
.attribute("src")
.multiple(true)
.build()
)
.build()?;
let result = fetcher.scrape("https://example.com").await?;
println!("Found {} images",
result.extracted_data.get("images").map_or(0, |v| v.len()));
Ok(())
}
FerrisFetcher is built with a modular architecture:
Run the test suite:
cargo test
Run examples:
cargo run --example basic_scraping
cargo run --example data_extraction
cargo run --example concurrent_scraping
cargo run --example builder_pattern
FerrisFetcher is designed for high performance:
FerrisFetcher promotes ethical scraping practices:
FerrisFetcher supports extensive configuration:
We welcome contributions! Please see our Contributing Guidelines for details.
git clone https://github.com/M1tsumi/FerrisFetcher.git
cd FerrisFetcher
cargo build
cargo test
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
FerrisFetcher - The Rust web scraping solution that's fast, reliable, and respectful. ๐ฆโจ