#url #html #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

#1982 in Web programming

Download history 213/week @ 2025-02-04 35/week @ 2025-02-11

248 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–18MB
~237K SLoC