#html #url #scraper

html-url-scraper

Crate for scraping URLs from HTML pages

2 releases

0.1.1 Feb 9, 2025
0.1.0 Feb 8, 2025

#50 in #scraper

Download history

55 downloads per month

Apache-2.0

7KB
81 lines

Version License: Apache 2.0 Downloads

html-url-scraper

Simple library for quickly fetching a list of URLs from a webpage.

Example

use html_url_scraper::UrlScraper;

fn main() {
    let rt = tokio::runtime::Builder::new_current_thread()
        .enable_all()
        .build()
        .expect("Failed to create runtime");

    rt.block_on(async {
        let scraper = match UrlScraper::new("https://google.com").await {
            Ok(scraper) => scraper,
            Err(e) => {
                eprintln!("Error: {}", e);
                return;
            }
        };

        for (text, url) in scraper.into_iter() {
            println!("Текст: {}, Url: {}", text, url);
        }
    });
}

Dependencies

~6–21MB
~223K SLoC