#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

#1945 in Web programming

Download history 229/week @ 2025-02-07 32/week @ 2025-02-14 1/week @ 2025-02-21

262 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–17MB
~237K SLoC