ok, cleanup next

This commit is contained in:
2025-07-13 12:49:06 +02:00
parent e10c3bcff2
commit b2cd8e57c4
3 changed files with 14 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
use serde::Deserialize;
use std::env;
use chrono;
use chrono::prelude::*;
use dotenv::dotenv;
#[derive(Deserialize)]
@@ -17,7 +17,7 @@ struct Videos {
#[tokio::main]
async fn main() {
dotenv.ok();
dotenv().ok();
let channellist = "https://raw.githubusercontent.com/bvanroll/home/refs/heads/master/static/yters.json";
let resp = reqwest::get(channellist)//.await.unwrap().text().await;
.await.unwrap()
@@ -25,12 +25,17 @@ async fn main() {
let channels = serde_json::from_str::<Vec<Channel>>(&resp).unwrap();
let apikey = env::var("APIKEY").unwrap();
// 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 {
let id = i.id;
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/search/?channelId={id}&part={part},id&order={order}&publishedAfter={date}&key={apikey}");
//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);
}
}