Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use select::document::Document;
- use select::predicate::*;
- #[tokio::main]
- async fn main() -> Result<(), Box<dyn std::error::Error>> {
- // make GET request to target URL and retrieve response
- //...
- // parse the response text into a Document
- let document = Document::from(resp.as_str());
- // find the price element using its HTML tag and class
- if let Some(price_node) = document.find(Name("p").and(Class("price"))).next() {
- println!("Price: {}", price_node.text());
- }
- Ok(())
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement