mirror of
https://github.com/kristoferssolo/tg-relay-rs.git
synced 2025-12-20 11:04:41 +00:00
fix(yt): format selector
This commit is contained in:
parent
fa59e0c0e5
commit
b124a5bdc7
@ -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",
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user