This commit is contained in:
Simon
2025-08-31 17:22:51 +00:00
parent 437deb388b
commit 8f5fc41bd2

View File

@@ -71,7 +71,8 @@ impl NoodlemagazineProvider {
query: &str, query: &str,
options: ServerOptions, options: ServerOptions,
) -> Result<Vec<VideoItem>> { ) -> Result<Vec<VideoItem>> {
let video_url = format!("{}/video/{}?p={}", self.url, query, page); let search_string = query.replace(" ", "%20");
let video_url = format!("{}/video/{}?p={}", self.url, search_string, page);
// Check our Video Cache. If the result is younger than 1 hour, we return it. // Check our Video Cache. If the result is younger than 1 hour, we return it.
let old_items = match cache.get(&video_url) { let old_items = match cache.get(&video_url) {
Some((time, items)) => { Some((time, items)) => {
@@ -106,7 +107,7 @@ impl NoodlemagazineProvider {
return vec![]; return vec![];
} }
let mut items: Vec<VideoItem> = Vec::new(); let mut items: Vec<VideoItem> = Vec::new();
let raw_videos = html.split("class=\"more\"").collect::<Vec<&str>>()[0] let raw_videos = html.split("- Made with <svg ").collect::<Vec<&str>>()[0]
.split("<div class=\"item\">") .split("<div class=\"item\">")
.collect::<Vec<&str>>()[1..] .collect::<Vec<&str>>()[1..]
.to_vec(); .to_vec();
@@ -115,9 +116,9 @@ impl NoodlemagazineProvider {
// for (index, line) in vid.iter().enumerate() { // for (index, line) in vid.iter().enumerate() {
// println!("Line {}: {}", index, line); // println!("Line {}: {}", index, line);
// } // }
let video_url: String = video_segment.split("<a href=\"").collect::<Vec<&str>>()[1] let video_url: String = format!("{}{}",self.url, video_segment.split("<a href=\"").collect::<Vec<&str>>()[1]
.split("\"") .split("\"")
.collect::<Vec<&str>>()[0].to_string(); .collect::<Vec<&str>>()[0].to_string());
let mut title = video_segment.split("\"title\">").collect::<Vec<&str>>()[1] let mut title = video_segment.split("\"title\">").collect::<Vec<&str>>()[1]
.split("<") .split("<")
.collect::<Vec<&str>>()[0] .collect::<Vec<&str>>()[0]