package main import ( "context" "log" "github.com/lrstanley/go-ytdlp" ) const OUTPUT_DIR = "C:/Users/Administrator/ytdlpVideos" var dl = ytdlp.New(). // FormatSort("bestvideo[ext=mp4]+bestaudio[ext=m4a]"). FormatSort("res,ext:mp4:m4a"). Output("C:/Users/Administrator/ytdlpVideos/%(uploader)s/%(title)s.%(ext)s"). LimitRate("50M"). // HTTPChunkSize("20M"). MarkWatched(). SponsorblockMark("all"). PrintJSON(). RecodeVideo("mp4"). ConcurrentFragments(4) func Download(event PBEvent, status chan error) { _, err := dl.Run(context.TODO(), event.Record.Link) if err != nil { status <- err return } log.Printf("Downloaded %s (%s)", event.Record.Id, event.Record.Link) SetDownloaded(event) }