knee_scraper-0.1.2 has been yanked.
Web Scraping Library
This Rust library enables recursive web scraping, media downloading, and content extraction from websites. With robust error handling and media support, the library is designed for flexible and scalable use in various web scraping scenarios.
Features
- Recursive Scraping: Start scraping from any URL and recursively follow links.
- Media Downloading: Download images, videos, and other media assets.
- Content Extraction: Extract text, meta tags, forms, and JavaScript contents from web pages.
- Error Logging: Logs errors to a file for later analysis.
- Random Delays: Mimics human behavior by adding random delays between requests.
Installation
To install the library, add the following to your Cargo.toml:
[]
= "0.1.2"
Basic Recursive Scraping Example
use ;
use HashSet;
async
let html = "<a href='/about'>About Us</a>";
let base_url = "https://example.com";
// Extract links from the HTML content
let links = extract_links;
Advanced Example with Robots.txt, Open Directories, and Cookies
[]
= "0.1.2"
= "0.3.30"
= "0.8.5"
= "1.10.6"
= "0.12.7"
= "0.20.0"
= { = "1.40.0", = ["full", "fs"] }
= "2.5.2"
use ;
use Client;
use HashSet;
use sleep;
use Duration;
async