]> git.taranathan.com Git - scrape.git/commitdiff
fix some hanging issues and optimize
authormoo <moogoesmeow123@gmail.com>
Fri, 25 Jul 2025 22:39:59 +0000 (15:39 -0700)
committermoo <moogoesmeow123@gmail.com>
Fri, 25 Jul 2025 22:39:59 +0000 (15:39 -0700)
src/analyze.rs
src/fetch.rs
src/save.rs
things.csv

index f996c0b8c6b7a0e6eed3d2bd4a1b5b61729f2e3e..a2577196f3ee2175bfbb62941673d20e448ca4c0 100644 (file)
@@ -20,6 +20,7 @@ pub async fn analyze(titles: Vec<String>) -> Result<Vec<(String, i8)>, Box<dyn s
     let mut titles = save::clean_from_csv(titles)?;
     titles.shuffle(&mut rng());
     dbg!(&titles);
+    println!("Found {} unique titles", titles.len());
 
     for title in titles {
         let ranking = analyze_title(&title, &task).await;
index f55aecf2d15fecfab744253c630adc58984bf365..fd7206da39d928562ec50877b0bf952c07710f32 100644 (file)
@@ -7,6 +7,18 @@ pub async fn fetch(urls: Vec<String>) -> Result<Vec<String>, Box<dyn std::error:
 }
 
 async fn fetch_rss_feeds(urls: Vec<String>) -> Result<Vec<Channel>, Box<dyn std::error::Error>> {
+    // let mut channels = Vec::new();
+    // for url in urls {
+    //     let channel = fetch_rss_feed(&url).await;
+    //
+    //     if let Err(e) = channel {
+    //         eprintln!("Error fetching {}: {}", url, e);
+    //         continue;
+    //     } else if let Ok(channell) = channel {
+    //         channels.push(channell);
+    //     }
+    // }
+
     let futures = urls.iter().map(|url| fetch_rss_feed(url));
     let results: Vec<Result<Channel, Box<dyn std::error::Error>>> = join_all(futures).await;
 
index fa7674ba527420a867a8d02731247b03b45b1bbe..d894b73a699bc870e8a0d7ecfd00532b470ab5e2 100644 (file)
@@ -68,7 +68,7 @@ pub fn clean_from_csv(titles: Vec<String>) -> Result<Vec<String>, Box<dyn std::e
         if !seen.contains(title) {
             unique.push(title.clone());
         }
-    }    
+    }
 
     Ok(unique)
 }
index 5c75da814012ca53186414f991fa8f525cdc150d..86d90d4f8710cf4ccabe7bcccd2f589d46deb56f 100644 (file)
@@ -629,3 +629,12 @@ Diving into Apple’s Liquid Glass,10
 Death confirmed from rare and deadly 'brain-eating amoeba' in southern lake,20
 "Moon phase today: What the moon will look like on July 25, 2025",18
 Three-person IVF technique shown to prevent inherited genetic diseases,5
+Sen. Rick Scott to fly banner urging New Yorkers who ‘hate socialism’ to move to Florida: ‘We have better beaches’,60
+"US, Israel announce targeted killings of terror leaders in Syria and Lebanon",2
+Vanessa Trump hits Southampton with ‘six black SUVs of Secret Service’,80
+Inside Jeffrey Epstein’s cozy relationship with Steve Bannon — and what’s really on his 15 hours of interview tapes,80
+"Ashley Judd, 57, shares body-positive message in swimsuit: ‘We don’t care club’",70
+"Yankees acquire third baseman Ryan McMahon from Rockies, fill major need ahead of postseason push",10
+Trump says it’s ‘no time to be talking about pardons’ for Ghislaine Maxwell as he lands in Scotland ahead of UK and EU talks – live,40
+Terrified passengers 'flew out of their seats' during dramatic Southwest nosedive to avoid mid-air crash,70
+Outrage After Alabama 3-Year-Old Dies in Hot Car While in State’s Care,60