diff options
Diffstat (limited to 'src/stackexchange')
-rw-r--r-- | src/stackexchange/api.rs | 2 | ||||
-rw-r--r-- | src/stackexchange/scraper.rs | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/stackexchange/api.rs b/src/stackexchange/api.rs index c9b69b4..cf326f2 100644 --- a/src/stackexchange/api.rs +++ b/src/stackexchange/api.rs @@ -153,7 +153,7 @@ impl Api { params.insert("filter", SE_FILTER); params.insert("page", "1"); if let Some(key) = &self.api_key { - params.insert("key", &key); + params.insert("key", key); } params } diff --git a/src/stackexchange/scraper.rs b/src/stackexchange/scraper.rs index 97c4bef..b1354fa 100644 --- a/src/stackexchange/scraper.rs +++ b/src/stackexchange/scraper.rs @@ -51,7 +51,7 @@ impl Scraper for DuckDuckGo { parse_with_selector(anchors, html, sites, limit).and_then(|sd| { // DDG seems to never have empty results, so assume this is blocked if sd.question_ids.is_empty() { - Err(Error::ScrapingError(String::from( + Err(Error::Scraping(String::from( "DuckDuckGo blocked this request", ))) } else { @@ -325,9 +325,7 @@ mod tests { ); match DuckDuckGo.parse(html, &sites, 2) { - Err(Error::ScrapingError(s)) if s == "DuckDuckGo blocked this request".to_string() => { - Ok(()) - } + Err(Error::Scraping(s)) if s == "DuckDuckGo blocked this request".to_string() => Ok(()), _ => Err(String::from("Failed to detect DuckDuckGo blocker")), } } |