Update deps

This commit is contained in:
Mylloon 2023-09-07 18:29:09 +02:00
parent e4aa5864eb
commit 32329647bc
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 480 additions and 634 deletions

1092
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -12,10 +12,10 @@ license = "AGPL-3.0-or-later"
[dependencies] [dependencies]
reqwest = { version = "0.11" } reqwest = { version = "0.11" }
tokio = { version = "1.27", features = ["full"] } tokio = { version = "1.32", features = ["full"] }
scraper = "0.16" scraper = "0.17"
regex = "1.7.3" regex = "1.9"
chrono = "0.4.24" chrono = "0.4.28"
ics = "0.5" ics = "0.5"
uuid = { version = "1.2.2", features = ["v4", "fast-rng"] } uuid = { version = "1.4", features = ["v4", "fast-rng"] }
clap = { version = "4.0.32", features = ["derive"] } clap = { version = "4.4", features = ["derive"] }

View file

@ -1,4 +1,4 @@
use chrono::{DateTime, TimeZone, Utc}; use chrono::{DateTime, Utc};
use regex::{Captures, Regex}; use regex::{Captures, Regex};
use scraper::{Html, Selector}; use scraper::{Html, Selector};
use std::collections::HashMap; use std::collections::HashMap;
@ -98,8 +98,8 @@ fn anglophonization(date: &str) -> String {
.unwrap(); .unwrap();
format!( format!(
// Use 12:00 for chrono parser // Use 12:00 and UTC TZ for chrono parser
"{} 12:00", "{} 12:00 +0000",
// Replace french by english month // Replace french by english month
re.replace_all(date, |cap: &Captures| match &cap[0] { re.replace_all(date, |cap: &Captures| match &cap[0] {
month if dico.contains_key(month) => dico.get(month).unwrap(), month if dico.contains_key(month) => dico.get(month).unwrap(),
@ -114,6 +114,8 @@ fn anglophonization(date: &str) -> String {
fn get_date(date: &str) -> DateTime<Utc> { fn get_date(date: &str) -> DateTime<Utc> {
// Use and keep UTC time, we have the hour set to 12h and // Use and keep UTC time, we have the hour set to 12h and
// Paris 8 is in France so there is no problems // Paris 8 is in France so there is no problems
Utc.datetime_from_str(&anglophonization(date), "%e %B %Y %H:%M") eprintln!("-> {}", &anglophonization(date));
DateTime::parse_from_str(&anglophonization(date), "%e %B %Y %H:%M %z")
.unwrap() .unwrap()
.into()
} }