1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/// Get the HTML content of a website to then scrape the content in it
///
/// # Arguments
///
/// * `url` - The url of the website
///
/// # Returns
///
/// * `Ok(String)` - The html content of the website
/// * `Err(Box<dyn std::error::Error>)` - An error if the request fails or the content type is not text/html
///
/// # Examples
///
/// ```
/// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error + std::marker::Send + std::marker::Sync>> {
/// use web_scraper::site::get_html;
/// use web_scraper::HtmlTag;
/// let url = "https://example.com";
/// let html = get_html(url).await.unwrap();
/// let tag = HtmlTag::DIV;
/// // Parse the <div> tags and collect the results into a vector of strings
/// let new_vector = tag.parse_tags(&html);
/// Ok(())
/// }
/// ```
pub async