Skip to content

Commit

Permalink
Attempting to workaround issue downloading videos that start with "-":
Browse files Browse the repository at this point in the history
- In yet - adding video-id= prefix (to use as: download-video video-id=-xxxxxxxx)
- In yt-dlp by wrapping it in quotes
  • Loading branch information
boggydigital committed Dec 13, 2024
1 parent 9117b79 commit 99eb9e2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cli/download_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (

const ytDlpCookiesFilename = "cookies.txt"

const videoIdPrefix = "video-id="

var defaultYtDlpOptions = map[string]string{
"-S": "vcodec:h264,res:1080,acodec:m4a",
}
Expand Down Expand Up @@ -54,6 +56,10 @@ func DownloadVideo(rdx kevlar.WriteableRedux, opt *VideoOptions, videoIds ...str

for _, videoId := range videoIds {

if strings.HasPrefix(videoId, videoIdPrefix) {
videoId = strings.TrimPrefix(videoId, videoIdPrefix)
}

videoId, err = yeti.ParseVideoId(videoId)
if err != nil {
return da.EndWithError(err)
Expand Down Expand Up @@ -188,7 +194,11 @@ func downloadWithYtDlp(videoId, absFilename string, options *VideoOptions) error

arguments := make([]string, 0)

arguments = append(arguments, videoId)
if strings.HasPrefix(videoId, "-") {
arguments = append(arguments, "\""+videoId+"\"")
} else {
arguments = append(arguments, videoId)
}
arguments = append(arguments, "-o", absFilename)

if options.Ended {
Expand Down

0 comments on commit 99eb9e2

Please sign in to comment.