aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/content.rs b/src/content.rs
index 67e8d24..17ad40a 100644
--- a/src/content.rs
+++ b/src/content.rs
@@ -1,4 +1,4 @@
1pub fn url_gen(title: &str) -> String { 1pub fn query_url_gen(title: &str) -> String {
2 2
3 title.replace(" ", "%20"); 3 title.replace(" ", "%20");
4 4
@@ -8,8 +8,24 @@ pub fn url_gen(title: &str) -> String {
8 url.push_str("action=query&"); 8 url.push_str("action=query&");
9 url.push_str("format=json&"); 9 url.push_str("format=json&");
10 url.push_str("prop=extracts&"); 10 url.push_str("prop=extracts&");
11 url.push_str(format!("titles={}", title)); 11 url.push_str(format!("titles={}&", title));
12 url.push_str("explaintext=1"); 12 url.push_str("explaintext=1");
13
14 url
15}
16
17pub fn search_url_gen(search: &str) -> String {
18 // /w/api.php?action=opensearch&format=json&search=dota%202&limit=5;
19
20 search.replace(" ", "%20");
21
22 let url = "https://en.wikipedia.org";
23 url.push_str("w/api.php?");
24 url.push_str("action=opensearch&");
25 url.push_str("format=json&");
26 url.push_str(format!("search={}&", search));
27 url.push_str("limit=5");
28
13} 29}
14 30
15pub fn get_extract(title: &str, red: Response) -> String { 31pub fn get_extract(title: &str, red: Response) -> String {