aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNerdyPepper <[email protected]>2018-07-10 13:09:39 +0100
committerNerdyPepper <[email protected]>2018-07-10 13:09:39 +0100
commit0adf755d690252108e5bd2be3d36f6d09bd612ed (patch)
tree6ec3358bbdc04165c94566140e666d51245cace7
parent2f36286ccc98b1f43c65d9d17e36e99e2553080f (diff)
Fix url bug, function args
-rw-r--r--src/content.rs8
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
46pub fn get_extract(res: &mut Response) -> Result<String, reqwest::Error> { 44pub 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
124pub fn get_links(res: &mut Response) -> Result<Vec<String>, reqwest::Error> { 122pub 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),