Compare commits

..

4 commits

2 changed files with 5 additions and 5 deletions

View file

@ -101,7 +101,7 @@ func getLargestYTFormat(input goutubedl.Result, sizeLimit float64) (format goutu
} else { } else {
size = input.Formats()[i].Filesize size = input.Formats()[i].Filesize
} }
if size <= sizeLimit { if size <= sizeLimit && input.Formats()[i].FormatID != "17" {
return input.Formats()[i], nil return input.Formats()[i], nil
} }
} }

View file

@ -50,7 +50,7 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
} }
} }
response.Content = response.Content + fmt.Sprintf("<%s>", regexp.MustCompile("http.*twitter.com").ReplaceAllString(url, "https://nitter.pussthecat.org")) response.Content = response.Content + fmt.Sprintf("\n<%s>", regexp.MustCompile("http.*twitter.com").ReplaceAllString(url, "https://nitter.pussthecat.org"))
result, err := goutubedl.New(context.Background(), url, goutubedl.Options{}) result, err := goutubedl.New(context.Background(), url, goutubedl.Options{})
if err != nil { if err != nil {
@ -100,13 +100,13 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
} }
} }
response.Content = response.Content + fmt.Sprintf("<%s>", regexp.MustCompile("http.*youtube\\.com").ReplaceAllString(url, "https://piped.kavin.rocks")) response.Content = response.Content + fmt.Sprintf("\n<%s>", regexp.MustCompile("http.*youtube\\.com").ReplaceAllString(url, "https://piped.kavin.rocks"))
result, err := goutubedl.New(context.Background(), url, goutubedl.Options{}) result, err := goutubedl.New(context.Background(), url, goutubedl.Options{})
if err != nil { if err != nil {
log.Println(err) log.Println(err)
continue continue
} else { } else if result.Info.AgeLimit < 18 && ! result.Info.IsLive {
/* /*
videoChoice, audioChoice, err := getLargestDashFormat(result, 8*1024*1024) videoChoice, audioChoice, err := getLargestDashFormat(result, 8*1024*1024)
log.Printf("Choice: %s+%s | Size: %fM\n", videoChoice.FormatID, audioChoice.FormatID, (videoChoice.Filesize+audioChoice.Filesize)/1024/1024) log.Printf("Choice: %s+%s | Size: %fM\n", videoChoice.FormatID, audioChoice.FormatID, (videoChoice.Filesize+audioChoice.Filesize)/1024/1024)
@ -141,7 +141,7 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
} else if output, _ := regexp.MatchString("(http.*instagram\\.com/p/.*)|(http.*instagram\\.com/tv/.*)|(http.*instagram\\.com/reel/.*)", url); output { } else if output, _ := regexp.MatchString("(http.*instagram\\.com/p/.*)|(http.*instagram\\.com/tv/.*)|(http.*instagram\\.com/reel/.*)", url); output {
log.Println("Instagram detected.") log.Println("Instagram detected.")
response.Content = response.Content + fmt.Sprintf("<%s>", regexp.MustCompile("http.*instagram\\.com").ReplaceAllString(url, "https://bibliogram.art")) response.Content = response.Content + fmt.Sprintf("\n%s", regexp.MustCompile("http.*instagram\\.com").ReplaceAllString(url, "https://bibliogram.art"))
result, err := goutubedl.New(context.Background(), url, goutubedl.Options{}) result, err := goutubedl.New(context.Background(), url, goutubedl.Options{})
if err != nil { if err != nil {