Created
May 16, 2017 23:08
-
-
Save AbstractBeliefs/e21abbfb332b7e42817f6a4b6f03d88d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling scraper-rust v0.1.0 (file:///home/gareth/development/rsstool/ingesters/scraper-rust) | |
error[E0277]: the trait bound `select::document::Document: std::convert::From<&std::string::String>` is not satisfied | |
--> src/main.rs:23:15 | |
| | |
23 | let dom = Document::from(&body); | |
| ^^^^^^^^^^^^^^ the trait `std::convert::From<&std::string::String>` is not implemented for `select::document::Document` | |
| | |
= help: the following implementations were found: | |
<select::document::Document as std::convert::From<tendril::tendril::Tendril<tendril::fmt::UTF8>>> | |
<select::document::Document as std::convert::From<&'a str>> | |
= note: required by `std::convert::From::from` | |
error: aborting due to previous error | |
error: Could not compile `scraper-rust`. | |
To learn more, run the command again with --verbose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate hyper; | |
extern crate hyper_native_tls; | |
extern crate select; | |
use hyper::Client; | |
use hyper::net::HttpsConnector; | |
use hyper_native_tls::NativeTlsClient; | |
use std::io::Read; | |
use select::document::Document; | |
use select::predicate::{Class,Name}; | |
use select::node::Node; | |
fn main() { | |
let ssl = NativeTlsClient::new().unwrap(); | |
let connector = HttpsConnector::new(ssl); | |
let client = Client::with_connector(connector); | |
let mut resp = client.get("https://google.com/").send().unwrap(); | |
let mut body = String::new(); | |
resp.read_to_string(&mut body).unwrap(); | |
let dom = Document::from(&body); | |
println!("{:?}", dom); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment