Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[tokio::main]
- async fn main() -> Result<(), Box<dyn std::error::Error>> {
- // make GET request to target URL and retrieve response
- //...
- // convert HTML to Markdown
- let md = html2md::parse_html(&resp);
- // create a Markdown parser
- let parser = pulldown_cmark::Parser::new(&md);
- // iterate over the events in the parser
- for event in parser {
- match event {
- pulldown_cmark::Event::Text(text) => {
- // check if the text contains the price
- if text.contains("$") {
- println!("Price: {}", text);
- }
- },
- _ => {},
- }
- }
- Ok(())
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement