I’ve been struggling with AIs for a few days to solve this problem, which I think is very simple but without any results. I think it’s a bug but I can’t detect it.
Every time I download a video with YouTubeDownloader and my CheckedListBox1 boxes are checked, everything downloads correctly, but at the end of the download, when the video file is already in the folder where it was downloaded, it is deleted. However, if I don’t leave any box checked, it downloads the fraction of the video correctly.
And my intention with this app is just to have an app to download small snippets of videos from YouTube without having to use a more robust or heavy application or having to edit the video later to remove parts that I don’t care about.
So I don’t know if I’m setting up the arguments incorrectly or if the bug is in the yt-dlp. And, of course, if it’s a yt-dlp bug, I’ll report it on the project’s github.
Private Sub Btn_Process_Click(sender As Object, e As EventArgs) Handles Btn_Process.Click
Dim MyExecutable As String = Application.StartupPath & "yt-downloaderyoutube-dl.exe"
Dim Url As String = Txt_Url.Text.ToString
Dim MyProcessStArgs As New ProcessStartInfo
Dim MyAspas As String = """"
' Inicializa a string de argumentos com a qualidade de vídeo e o formato desejado
Dim arguments As New System.Text.StringBuilder()
arguments.Append("-f ""mp4[height<=720]"" ")
' Adiciona parâmetros adicionais dependendo dos itens selecionados
If CheckedListBox1.CheckedItems.Contains("Description") Then
arguments.Append("--write-description ")
End If
If CheckedListBox1.CheckedItems.Contains("Thumbnail") Then
arguments.Append("--write-thumbnail ")
End If
If CheckedListBox1.CheckedItems.Contains("Subtitle") Then
arguments.Append("--write-auto-sub --sub-lang en --convert-subs srt ")
End If
If CheckedListBox1.CheckedItems.Contains("Audio") Then
arguments.Append("--extract-audio --audio-format mp3 ")
End If
' Adiciona a fração do vídeo que será extraído
Dim TimeToTrim As String = Txt_StartTotal.Text & "-" & Txt_EndTotal.Text
If Not String.IsNullOrWhiteSpace(TimeToTrim) Then
arguments.Append("--download-sections " & MyAspas & "*" & TimeToTrim & MyAspas & " ")
End If
' Adiciona a URL do vídeo
arguments.Append(Url)
' Configura o processo para iniciar o download
MyProcessStArgs.Arguments = arguments.ToString()
MyProcessStArgs.FileName = MyExecutable
MyProcessStArgs.UseShellExecute = False
MyProcessStArgs.CreateNoWindow = False
' Exibe o argumento completo no Txt_Output para verificação
Txt_OutPut.Text = MyProcessStArgs.Arguments
' Inicia o processo e lê a saída e erros para diagnóstico
Dim process As Process = process.Start(MyProcessStArgs)
process.WaitForExit()
End Sub
First of all, I researched in the following AIs so as not to waste your time,: Mistral, ClaudeIA, ChatGPT, I did a thorough search in the app’s official documentation in the appropriate channel “**https://github.com/yt-dlp/yt-dlp**”, and obviously in the class’s official documentation: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo
2