Web scraping: Difference between revisions

added Rust programming solution
(→‎{{header|Raku}}: updated raku programming solution ( with a new data source ))
(added Rust programming solution)
Line 1,776:
{{out}}
<pre>May. 09, 16:13:44</pre>
 
=={{header|Rust}}==
{{trans|Raku}}
 
<lang rust>// 202100302 Rust programming solution
 
use std::io::Read;
use regex::Regex;
 
fn main() {
 
let client = reqwest::blocking::Client::new();
let site = "https://www.utctime.net/";
let mut res = client.get(site).send().unwrap();
let mut body = String::new();
 
res.read_to_string(&mut body).unwrap();
 
let re = Regex::new(r#"<td>UTC</td><td>(.*Z)</td>"#).unwrap();
let caps = re.captures(&body).unwrap();
 
println!("Result : {:?}", caps.get(1).unwrap().as_str());
}</lang>
{{out}}
<pre>
Result : "2021-03-02T16:27:02Z"
</pre>
 
=={{header|Scala}}==
350

edits