diff options
author | Ivan Tham <[email protected]> | 2018-08-08 03:31:14 +0100 |
---|---|---|
committer | Ivan Tham <[email protected]> | 2018-08-08 03:31:14 +0100 |
commit | f0cb4fafbe4f3f1ecb23b4dd9d7357a269c1317e (patch) | |
tree | 3ad5bff53580fb35f11b5b55fc54ed550785cb0f /src | |
parent | a5c6f2afbe16d0328750f83db66b93b89111313b (diff) |
Replace title in content
Diffstat (limited to 'src')
-rw-r--r-- | src/content.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/content.rs b/src/content.rs index 0f81149..30d8f22 100644 --- a/src/content.rs +++ b/src/content.rs | |||
@@ -21,7 +21,7 @@ pub fn query_url_gen(title: &str) -> String { | |||
21 | url.push_str("prop=extracts%7Clinks&"); | 21 | url.push_str("prop=extracts%7Clinks&"); |
22 | url.push_str("indexpageids=1&"); | 22 | url.push_str("indexpageids=1&"); |
23 | url.push_str("titles="); | 23 | url.push_str("titles="); |
24 | url.push_str(&urlencoding::encode(title)); | 24 | url.push_str(&urlencoding::encode(&title.replace(" ", "_"))); |
25 | url.push_str("&"); | 25 | url.push_str("&"); |
26 | url.push_str("redirects=1&"); | 26 | url.push_str("redirects=1&"); |
27 | url.push_str("pllimit=100&"); | 27 | url.push_str("pllimit=100&"); |
diff --git a/src/main.rs b/src/main.rs index a5c10e1..982550f 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -117,8 +117,7 @@ fn search(s: &mut Cursive) { | |||
117 | 117 | ||
118 | fn on_submit(s: &mut Cursive, name: &str) { | 118 | fn on_submit(s: &mut Cursive, name: &str) { |
119 | // get article data | 119 | // get article data |
120 | let heading: String = name.to_string(); | 120 | let url = query_url_gen(name); |
121 | let url = query_url_gen(&name.replace(" ", "_")); | ||
122 | let mut extract = String::new(); | 121 | let mut extract = String::new(); |
123 | let mut link_vec: Vec<String> = vec![]; | 122 | let mut link_vec: Vec<String> = vec![]; |
124 | 123 | ||
@@ -153,6 +152,6 @@ fn on_submit(s: &mut Cursive, name: &str) { | |||
153 | ).on_event('t', |s| match s.pop_layer() { | 152 | ).on_event('t', |s| match s.pop_layer() { |
154 | _ => (), | 153 | _ => (), |
155 | }), | 154 | }), |
156 | ).title(heading), | 155 | ).title(name), |
157 | ); | 156 | ); |
158 | } | 157 | } |