diff options
author | NerdyPepper <[email protected]> | 2018-07-16 16:44:46 +0100 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2018-07-16 16:44:46 +0100 |
commit | 5b06a4ef9b8b2d9cc18f18c4ff6cfddf632f7483 (patch) | |
tree | c0f4476fd90aac3eb620c4e773bc978b9697e31d /src | |
parent | 6f84a1ef0be7cc3b3272d5916810213038f3d875 (diff) |
Fix url handling
Diffstat (limited to 'src')
-rw-r--r-- | src/content.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/content.rs b/src/content.rs index 13582f1..b72f4a8 100644 --- a/src/content.rs +++ b/src/content.rs | |||
@@ -2,6 +2,7 @@ extern crate reqwest; | |||
2 | extern crate serde_json; | 2 | extern crate serde_json; |
3 | extern crate cursive; | 3 | extern crate cursive; |
4 | extern crate regex; | 4 | extern crate regex; |
5 | extern crate urlencoding; | ||
5 | 6 | ||
6 | use cursive::theme::Effect; | 7 | use cursive::theme::Effect; |
7 | use cursive::utils::markup::StyledString; | 8 | use cursive::utils::markup::StyledString; |
@@ -19,7 +20,7 @@ pub fn query_url_gen(title: &str) -> String { | |||
19 | url.push_str("prop=extracts%7Clinks&"); | 20 | url.push_str("prop=extracts%7Clinks&"); |
20 | url.push_str("indexpageids=1&"); | 21 | url.push_str("indexpageids=1&"); |
21 | url.push_str("titles="); | 22 | url.push_str("titles="); |
22 | url.push_str(title); | 23 | url.push_str(&urlencoding::encode(title)); |
23 | url.push_str("&"); | 24 | url.push_str("&"); |
24 | url.push_str("redirects=1&"); | 25 | url.push_str("redirects=1&"); |
25 | url.push_str("pllimit=40&"); | 26 | url.push_str("pllimit=40&"); |
@@ -35,7 +36,7 @@ pub fn search_url_gen(search: &str) -> String { | |||
35 | url.push_str("action=opensearch&"); | 36 | url.push_str("action=opensearch&"); |
36 | url.push_str("format=json&"); | 37 | url.push_str("format=json&"); |
37 | url.push_str("search="); | 38 | url.push_str("search="); |
38 | url.push_str(search); | 39 | url.push_str(&urlencoding::encode(search)); |
39 | url.push_str("&"); | 40 | url.push_str("&"); |
40 | url.push_str("limit=20"); | 41 | url.push_str("limit=20"); |
41 | url | 42 | url |