pub struct Soup { /* private fields */ }Expand description
Parses HTML & provides methods to query & manipulate the document
Implementations§
source§impl Soup
impl Soup
sourcepub fn new(html: &str) -> Soup
pub fn new(html: &str) -> Soup
Create a new Soup instance from a string slice
Example
let html = r#"
<!doctype html>
<html>
<head>
<title>page title</title>
</head>
<body>
<h1>Heading</h1>
<p>Some text</p>
<p>Some more text</p>
</body>
</html>
"#;
let soup = Soup::new(html);sourcepub fn from_reader<R: Read>(reader: R) -> Fallible<Soup>
pub fn from_reader<R: Read>(reader: R) -> Fallible<Soup>
Create a new Soup instance from something that implements Read
This is good for parsing the output of an HTTP response, for example.
use soup::prelude::*;
let response = reqwest::get("https://docs.rs/soup")?;
let soup = Soup::from_reader(response)?;