refactor, bypass dns filtering using google dns, yts host resolution using qwant
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user