Compare commits
2 Commits
rework
...
c95613e240
Author | SHA1 | Date | |
---|---|---|---|
c95613e240 | |||
a7babdbba4 |
33
download.go
Normal file
33
download.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
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)
|
||||||
|
}
|
Reference in New Issue
Block a user