From 0adf755d690252108e5bd2be3d36f6d09bd612ed Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Tue, 10 Jul 2018 17:39:39 +0530 Subject: Fix url bug, function args --- src/content.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/content.rs b/src/content.rs index 1c75360..5d702a9 100644 --- a/src/content.rs +++ b/src/content.rs @@ -17,7 +17,7 @@ pub fn query_url_gen(title: &str) -> String { url.push_str("/w/api.php?"); url.push_str("action=query&"); url.push_str("format=json&"); - url.push_str("prop=extracts&"); + url.push_str("prop=extracts%7Clinks&"); url.push_str("indexpageids=1&"); url.push_str("titles="); url.push_str(title); @@ -38,12 +38,10 @@ pub fn search_url_gen(search: &str) -> String { url.push_str(search); url.push_str("&"); url.push_str("limit=20"); - url - } -pub fn get_extract(res: &mut Response) -> Result { +pub fn get_extract(mut res: Response) -> Result { let v: Value = match serde_json::from_str(&res.text()?) { Ok(x) => x, Err(x) => panic!("Failed to parse json\nReceived error {}", x), @@ -121,7 +119,7 @@ pub fn get_search_results(search: &str) -> Result, reqwest::Error> { Ok(results) } -pub fn get_links(res: &mut Response) -> Result, reqwest::Error> { +pub fn get_links(mut res: Response) -> Result, reqwest::Error> { let v: Value = match serde_json::from_str(&res.text()?) { Ok(x) => x, Err(x) => panic!("Failed to parse json\nReceived error {}", x), -- cgit v1.2.3