ok, cleanup next
This commit is contained in:
3
homegrown/email/Cargo.lock
generated
3
homegrown/email/Cargo.lock
generated
@@ -141,8 +141,10 @@ checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
"android-tzdata",
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"serde",
|
"serde",
|
||||||
|
"wasm-bindgen",
|
||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -260,6 +262,7 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
|||||||
name = "email"
|
name = "email"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
"dotenv",
|
"dotenv",
|
||||||
"google-youtube3",
|
"google-youtube3",
|
||||||
"lettre",
|
"lettre",
|
||||||
|
@@ -14,4 +14,5 @@ serde_json = "1"
|
|||||||
|
|
||||||
google-youtube3 = "*"
|
google-youtube3 = "*"
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
|
chrono = "0.4.41"
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::env;
|
use std::env;
|
||||||
use chrono;
|
use chrono::prelude::*;
|
||||||
use dotenv::dotenv;
|
use dotenv::dotenv;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
@@ -17,7 +17,7 @@ struct Videos {
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
dotenv.ok();
|
dotenv().ok();
|
||||||
let channellist = "https://raw.githubusercontent.com/bvanroll/home/refs/heads/master/static/yters.json";
|
let channellist = "https://raw.githubusercontent.com/bvanroll/home/refs/heads/master/static/yters.json";
|
||||||
let resp = reqwest::get(channellist)//.await.unwrap().text().await;
|
let resp = reqwest::get(channellist)//.await.unwrap().text().await;
|
||||||
.await.unwrap()
|
.await.unwrap()
|
||||||
@@ -25,12 +25,17 @@ async fn main() {
|
|||||||
let channels = serde_json::from_str::<Vec<Channel>>(&resp).unwrap();
|
let channels = serde_json::from_str::<Vec<Channel>>(&resp).unwrap();
|
||||||
let apikey = env::var("APIKEY").unwrap();
|
let apikey = env::var("APIKEY").unwrap();
|
||||||
// let lastMonday =
|
// let lastMonday =
|
||||||
|
let datetime: DateTime<Utc> = chrono::prelude::Utc::now() - chrono::TimeDelta::try_days(7).unwrap() ;
|
||||||
|
//let datestr = datetime.
|
||||||
|
let date= datetime.format("%Y-%m-%dT%H:%M:%SZ"); //(1970-01-01T00:00:00Z).
|
||||||
|
let part="snippet";
|
||||||
|
let order = "date";
|
||||||
for i in channels {
|
for i in channels {
|
||||||
let id = i.id;
|
let id = i.id;
|
||||||
|
let videos_request = format!("https://www.googleapis.com/youtube/v3/search/?channelId={id}&part={part},id&order={order}&publishedAfter={date}&key={apikey}");
|
||||||
let videos_request = format!("https://www.googleapis.com/youtube/v3/search/?channelId={id}&part=snippet,id&order=date&publishedAfter={date}&key={apikey}");
|
|
||||||
//let videos_request = format!("https://www.googleapis.com/youtube/v3/channels?id={id}&key={apikey}&part=contentDetails");
|
//let videos_request = format!("https://www.googleapis.com/youtube/v3/channels?id={id}&key={apikey}&part=contentDetails");
|
||||||
println!("{}", videos_request);
|
let resp = reqwest::get(videos_request).await.unwrap().text().await.unwrap();
|
||||||
|
println!("{}", resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user