refactor, bypass dns filtering using google dns, yts host resolution using qwant

This commit is contained in:
2020-05-31 15:54:24 +02:00
parent 6099b72570
commit 1fd24d0536
1164 changed files with 437 additions and 582974 deletions

View File

@ -2,6 +2,7 @@ package youtube
import (
"github.com/rylio/ytdl"
"errors"
"os"
)
@ -10,6 +11,9 @@ func Get(url string) (string, error) {
if err != nil {
return "", err
}
if len(v.Formats.Best(ytdl.FormatResolutionKey)) < 1 {
return "", errors.New("not found")
}
u, err := v.GetDownloadURL(v.Formats.Best(ytdl.FormatResolutionKey)[0])
if err != nil {
return "", err
@ -22,6 +26,9 @@ func Download(url string, file string) error {
if err != nil {
return err
}
if len(v.Formats.Best(ytdl.FormatResolutionKey)) < 1 {
return errors.New("not found")
}
format := v.Formats.Best(ytdl.FormatResolutionKey)[0]
f, err := os.Create(file)
if err != nil {