generated from lucien/actix-react-template
Compare commits
1 commit
main
...
back_end_s
Author | SHA1 | Date | |
---|---|---|---|
effd567fa5 |
2 changed files with 19 additions and 0 deletions
|
@ -9,4 +9,6 @@ actix-web = "4"
|
|||
sqlite = "0.36.1"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0.133"
|
||||
rss = "2.0.11"
|
||||
reqwest = "0.12.9"
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
use sqlite::{Connection, OpenFlags};
|
||||
use rss::{Channel, Item};
|
||||
use reqwest;
|
||||
|
||||
pub fn init() -> sqlite::Result<()> {
|
||||
let conn = Connection::open_with_flags(
|
||||
|
@ -21,3 +23,18 @@ pub fn init() -> sqlite::Result<()> {
|
|||
|
||||
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