Skip to content

Commit

Permalink
youtube: add quality=low|high aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
mlvzk committed Jul 2, 2019
1 parent c1fd879 commit 2898227
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions service/youtube/youtube.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,17 @@ func (s Youtube) Download(meta, options map[string]string) (io.Reader, error) {
videoFormat ytdl.Format
videoFormatFound bool
)
if quality == "best" {
switch quality {
case "worst", "low":
videoFormat, videoFormatFound = findWorstVideo(formats)
case "best", "high":
videoFormat, videoFormatFound = findBestVideo(formats)
} else if quality == "medium" {
default:
videoFormat, videoFormatFound = findMediumVideo(formats)
if !videoFormatFound {
// fallback to best if medium not found
videoFormat, videoFormatFound = findBestVideo(formats)
}
} else {
videoFormat, videoFormatFound = findWorstVideo(formats)
}

if !audioFormatFound || !videoFormatFound {
Expand Down

0 comments on commit 2898227

Please sign in to comment.