all repos — gopipe @ 8c09f0e04a44434c6bd7e9a2e223155ad3b21670

Embed YouTube videos on Telegram, Discord and more!

only get video/mp4 formats
Marco Andronaco andronacomarco@gmail.com
Tue, 15 Oct 2024 23:45:59 +0200
commit

8c09f0e04a44434c6bd7e9a2e223155ad3b21670

parent

907efd7608540381e20c938f1b7e7a94963a3737

2 files changed, 2 insertions(+), 3 deletions(-)

jump to
M src/app/handlers.gosrc/app/handlers.go

@@ -6,7 +6,6 @@ "net/http"

"regexp" "strconv" "text/template" - "time" g "github.com/birabittoh/gopipe/src/globals" )

@@ -14,7 +13,6 @@

const ( fmtYouTubeURL = "https://www.youtube.com/watch?v=%s" err500 = "Internal Server Error" - urlDuration = 6 * time.Hour ) var (
M src/app/video.gosrc/app/video.go

@@ -6,6 +6,7 @@ "fmt"

"log" "regexp" "strconv" + "strings" "time" g "github.com/birabittoh/gopipe/src/globals"

@@ -45,7 +46,7 @@ return &formats[formatID%l]

} func formatsSelectFn(f youtube.Format) bool { - return f.AudioChannels > 1 && f.ContentLength < maxContentLength + return f.AudioChannels > 1 && f.ContentLength < maxContentLength && strings.HasPrefix(f.MimeType, "video/mp4") } func getURL(videoID string) string {