Skip to content

Commit

Permalink
Trying another mitigation of videos that start with "-" for yt-dlp an…
Browse files Browse the repository at this point in the history
…d removing download cmd mitigation, since we can use full URL already
  • Loading branch information
boggydigital committed Dec 13, 2024
1 parent 9e38c84 commit cfa7b1f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions cli/download_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ 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 @@ -56,10 +54,6 @@ 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 @@ -195,10 +189,11 @@ func downloadWithYtDlp(videoId, absFilename string, options *VideoOptions) error
arguments := make([]string, 0)

if strings.HasPrefix(videoId, "-") {
arguments = append(arguments, "\""+videoId+"\"")
arguments = append(arguments, youtube_urls.VideoUrl(videoId).String())
} else {
arguments = append(arguments, videoId)
}

arguments = append(arguments, "-o", absFilename)

if options.Ended {
Expand Down

0 comments on commit cfa7b1f

Please sign in to comment.