Crates.io | ahref |
lib.rs | ahref |
version | 0.3.0 |
source | src |
created_at | 2023-09-05 18:47:03.49819 |
updated_at | 2024-01-08 19:07:53.36523 |
description | Extract 'a' tags from html page |
homepage | |
repository | https://github.com/tenqz/ahref |
max_upload_size | |
id | 964719 |
size | 7,854 |
You can install Ahref using cargo:
cargo add ahref
Here's an example of how to use Ahref lib:
use ahref::Parser;
fn main() {
let html = "<a href='https://github.com/tenqz'>Test link</a>".to_string();
let mut parser = Parser::new(html);
println!("{:?}", parser.parse_tags());
}
As a result, all "a" tags will be displayed.
["<a href='https://github.com/tenqz'>Test link</a>"]
use ahref::Parser;
fn main() {
let html = "<a href='https://github.com/tenqz'>Test link</a>".to_string();
let mut parser = Parser::new(html);
println!("{:?}", parser.parse_links());
}
As a result, all urls will be displayed.
["https://github.com/tenqz"]