mirror of
https://github.com/lyx0/nourybot-matrix.git
synced 2024-11-13 19:49:54 +01:00
fix youtu.be download
This commit is contained in:
parent
f4b752cc04
commit
911a0fb724
3 changed files with 5 additions and 5 deletions
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ BINARY_NAME=Nourybot-Matrix.out
|
|||
|
||||
dev:
|
||||
go build -o ${BINARY_NAME} cmd/bot/*
|
||||
./${BINARY_NAME} --database "./db/nourybot.db"
|
||||
./${BINARY_NAME}
|
||||
|
||||
build:
|
||||
go build -o ${BINARY_NAME} cmd/bot/*
|
||||
|
|
|
@ -48,7 +48,7 @@ func (app *application) YafDownload(evt *event.Event, link, uuid string) {
|
|||
|
||||
// For some reason youtube links return webm as result.Info.Ext but
|
||||
// are in reality mp4.
|
||||
if strings.HasPrefix(link, "https://www.youtube.com/") {
|
||||
if strings.HasPrefix(link, "https://www.youtube.com/") || strings.HasPrefix(link, "https://youtu.be/") {
|
||||
rExt = "mp4"
|
||||
} else {
|
||||
rExt = result.Info.Ext
|
||||
|
@ -88,7 +88,7 @@ func (app *application) GofileDownload(evt *event.Event, link string) {
|
|||
}
|
||||
// For some reason youtube links return webm as result.Info.Ext but
|
||||
// are in reality mp4.
|
||||
if strings.HasPrefix(link, "https://www.youtube.com/") {
|
||||
if strings.HasPrefix(link, "https://www.youtube.com/") || strings.HasPrefix(link, "https://youtu.be/") {
|
||||
rExt = "mp4"
|
||||
} else {
|
||||
rExt = result.Info.Ext
|
||||
|
|
|
@ -31,7 +31,6 @@ import (
|
|||
)
|
||||
|
||||
var debug = flag.Bool("debug", false, "Enable debug logs")
|
||||
var database = flag.String("database", "./db/nourybot.db", "SQLite database path")
|
||||
|
||||
//var database = flag.String("database", "test.db", "SQLite database path")
|
||||
|
||||
|
@ -50,6 +49,7 @@ func main() {
|
|||
homeserver := os.Getenv("MATRIX_HOMESERVER")
|
||||
username := os.Getenv("MATRIX_USERNAME")
|
||||
password := os.Getenv("MATRIX_PASSWORD")
|
||||
database := os.Getenv("SQLITE_DATABASE")
|
||||
|
||||
client, err := mautrix.NewClient(homeserver, "", "")
|
||||
if err != nil {
|
||||
|
@ -115,7 +115,7 @@ func main() {
|
|||
|
||||
})
|
||||
|
||||
cryptoHelper, err := cryptohelper.NewCryptoHelper(app.MatrixClient, []byte("meow"), *database)
|
||||
cryptoHelper, err := cryptohelper.NewCryptoHelper(app.MatrixClient, []byte("meow"), database)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue