This commit is contained in:
2026-03-12 01:03:44 +01:00
parent 2f6f8414d0
commit 8ed01f2049
15 changed files with 180 additions and 15 deletions
+16 -3
View File
@@ -1,4 +1,8 @@
use types::jobs::{JobResponse, SearchJob, SearchResponse};
use types::{
jobs::{JobResponse, SearchJob, SearchResponse},
misc::parse_url_or_default,
queue::YoutubeSong,
};
use yt_dlp::Downloader;
pub async fn search(
@@ -13,8 +17,17 @@ pub async fn search(
.await
{
Ok(result) => match result.webpage_url {
Some(url) => JobResponse {
content: Some(SearchResponse { url }),
Some(webpage_url) => JobResponse {
content: Some(SearchResponse {
song: YoutubeSong {
title: result.title,
artist: result.channel.unwrap_or(String::new()),
url: parse_url_or_default(webpage_url),
thumbnail_url: parse_url_or_default(
result.thumbnail.unwrap_or(String::new()),
),
},
}),
error: None,
},
None => JobResponse {