fix(yt): format selector

This commit is contained in:
Kristofers Solo 2025-09-23 10:57:26 +03:00
parent fa59e0c0e5
commit b124a5bdc7
Signed by: kristoferssolo
GPG Key ID: 74FF8144483D82C8
2 changed files with 3 additions and 3 deletions

View File

@ -130,8 +130,8 @@ pub async fn download_ytdlp<P: AsRef<Path>>(
url: &str, url: &str,
cookies_path: Option<P>, cookies_path: Option<P>,
) -> Result<DownloadResult> { ) -> Result<DownloadResult> {
let default_format = "bestvideo[ext=mp4][vcodec^=avc1]+bestaudio/best"; let format_selector = env::var("YTDLP_FORMAT").unwrap_or_else(|_| "best".into());
let format_selector = env::var("YTDLP_FORMAT").unwrap_or_else(|_| default_format.into()); info!(format_selector = format_selector, "Video format");
let base_args = [ let base_args = [
"--no-playlist", "--no-playlist",

View File

@ -43,7 +43,7 @@ impl SocialHandler for YouTubeShortsHandler {
} }
async fn handle(&self, bot: &Bot, chat_id: ChatId, url: String) -> Result<()> { async fn handle(&self, bot: &Bot, chat_id: ChatId, url: String) -> Result<()> {
info!(handler = %self.name(), url = %url, "handling youtube code"); info!(handler = %self.name(), url = %url, "handling youtube url");
let cookies_path = env::var("COOKIES_PATH"); let cookies_path = env::var("COOKIES_PATH");
let dr = download_ytdlp(&url, cookies_path.as_deref().ok()).await?; let dr = download_ytdlp(&url, cookies_path.as_deref().ok()).await?;
process_download_result(bot, chat_id, dr).await process_download_result(bot, chat_id, dr).await