This commit is contained in:
2024-06-18 00:09:58 +02:00
parent 2ec00ea02d
commit f01e13a82d
9 changed files with 0 additions and 0 deletions

32
downloader/download.go Normal file
View File

@@ -0,0 +1,32 @@
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").
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)
}