I want to get a url
from <img>
(inside of src parameter) html tag using scraper
.
I've tried this code
let image_selector = scraper::Selector::parse("#photoInner > ul > li:nth-child(2) > div > img").unwrap();
let mut inner_image: String = next_document
.select(&image_selector)
.flat_map(|el| el.attr())
.collect();
println!("{:?}", inner_image);
But I'm getting that attr
method not found in ElementRef<'_>
.
I'm not sure how to chain the methods to make this work.
HTML looks like this
<img onerror="this.src='/ui/utility/common/svg/iconI_no-image.svg?s=1&w=350&h=350';" alt="" src="https://image1.homes.jp/smallimg/image.php?file=%2Fdata%2F1700013%2Fsale%2Fimage%2F0010012-1.jpg&width=620">