Returns the selected elements as strings
(&self, selector: &str)
| 18 | impl Document { |
| 19 | /// Returns the selected elements as strings |
| 20 | fn select(&self, selector: &str) -> PyResult<Vec<String>> { |
| 21 | let selector = Selector::parse(selector) |
| 22 | .map_err(|e| PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("{e:?}")))?; |
| 23 | Ok(self |
| 24 | .html |
| 25 | .select(&selector) |
| 26 | .map(|element| element.html()) |
| 27 | .collect()) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | impl Document { |