aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNerdyPepper <[email protected]>2018-07-16 16:44:46 +0100
committerNerdyPepper <[email protected]>2018-07-16 16:44:46 +0100
commit5b06a4ef9b8b2d9cc18f18c4ff6cfddf632f7483 (patch)
treec0f4476fd90aac3eb620c4e773bc978b9697e31d
parent6f84a1ef0be7cc3b3272d5916810213038f3d875 (diff)
Fix url handling
-rw-r--r--Cargo.toml1
-rw-r--r--src/content.rs5
2 files changed, 4 insertions, 2 deletions
diff --git a/Cargo.toml b/Cargo.toml
index c9adcf3..286bdaf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,3 +8,4 @@ reqwest = { git = "https://github.com/seanmonstar/reqwest" }
8serde_json = { git = "https://github.com/serde-rs/json" } 8serde_json = { git = "https://github.com/serde-rs/json" }
9cursive = { git = "https://github.com/gyscos/Cursive" } 9cursive = { git = "https://github.com/gyscos/Cursive" }
10regex = "1" 10regex = "1"
11urlencoding = "1.0.0"
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;
2extern crate serde_json; 2extern crate serde_json;
3extern crate cursive; 3extern crate cursive;
4extern crate regex; 4extern crate regex;
5extern crate urlencoding;
5 6
6use cursive::theme::Effect; 7use cursive::theme::Effect;
7use cursive::utils::markup::StyledString; 8use 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