generated from lucien/actix-react-template
force a toi lukian
This commit is contained in:
parent
e42b81539f
commit
effd567fa5
2 changed files with 19 additions and 0 deletions
|
@ -9,4 +9,6 @@ actix-web = "4"
|
||||||
sqlite = "0.36.1"
|
sqlite = "0.36.1"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0.133"
|
serde_json = "1.0.133"
|
||||||
|
rss = "2.0.11"
|
||||||
|
reqwest = "0.12.9"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
use sqlite::{Connection, OpenFlags};
|
use sqlite::{Connection, OpenFlags};
|
||||||
|
use rss::{Channel, Item};
|
||||||
|
use reqwest;
|
||||||
|
|
||||||
pub fn init() -> sqlite::Result<()> {
|
pub fn init() -> sqlite::Result<()> {
|
||||||
let conn = Connection::open_with_flags(
|
let conn = Connection::open_with_flags(
|
||||||
|
@ -21,3 +23,18 @@ pub fn init() -> sqlite::Result<()> {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn update_articles( channel: &Channel) {
|
||||||
|
let conn = Connection::open_with_flags(
|
||||||
|
"./data/data.db",
|
||||||
|
OpenFlags::new()
|
||||||
|
.with_create()
|
||||||
|
.with_read_write()
|
||||||
|
);
|
||||||
|
|
||||||
|
let flux_rss = reqwest::get("https://www.lemonde.fr/rss/une.xml")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let channel = Channel::read_from(&flux_rss[..]);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue