diff options
-rw-r--r-- | src/content.rs | 8 |
1 files changed, 3 insertions, 5 deletions
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 { | |||
17 | url.push_str("/w/api.php?"); | 17 | url.push_str("/w/api.php?"); |
18 | url.push_str("action=query&"); | 18 | url.push_str("action=query&"); |
19 | url.push_str("format=json&"); | 19 | url.push_str("format=json&"); |
20 | url.push_str("prop=extracts&"); | 20 | url.push_str("prop=extracts%7Clinks&"); |
21 | url.push_str("indexpageids=1&"); | 21 | url.push_str("indexpageids=1&"); |
22 | url.push_str("titles="); | 22 | url.push_str("titles="); |
23 | url.push_str(title); | 23 | url.push_str(title); |
@@ -38,12 +38,10 @@ pub fn search_url_gen(search: &str) -> String { | |||
38 | url.push_str(search); | 38 | url.push_str(search); |
39 | url.push_str("&"); | 39 | url.push_str("&"); |
40 | url.push_str("limit=20"); | 40 | url.push_str("limit=20"); |
41 | |||
42 | url | 41 | url |
43 | |||
44 | } | 42 | } |
45 | 43 | ||
46 | pub fn get_extract(res: &mut Response) -> Result<String, reqwest::Error> { | 44 | pub fn get_extract(mut res: Response) -> Result<String, reqwest::Error> { |
47 | let v: Value = match serde_json::from_str(&res.text()?) { | 45 | let v: Value = match serde_json::from_str(&res.text()?) { |
48 | Ok(x) => x, | 46 | Ok(x) => x, |
49 | Err(x) => panic!("Failed to parse json\nReceived error {}", x), | 47 | Err(x) => panic!("Failed to parse json\nReceived error {}", x), |
@@ -121,7 +119,7 @@ pub fn get_search_results(search: &str) -> Result<Vec<String>, reqwest::Error> { | |||
121 | Ok(results) | 119 | Ok(results) |
122 | } | 120 | } |
123 | 121 | ||
124 | pub fn get_links(res: &mut Response) -> Result<Vec<String>, reqwest::Error> { | 122 | pub fn get_links(mut res: Response) -> Result<Vec<String>, reqwest::Error> { |
125 | let v: Value = match serde_json::from_str(&res.text()?) { | 123 | let v: Value = match serde_json::from_str(&res.text()?) { |
126 | Ok(x) => x, | 124 | Ok(x) => x, |
127 | Err(x) => panic!("Failed to parse json\nReceived error {}", x), | 125 | Err(x) => panic!("Failed to parse json\nReceived error {}", x), |