feat: enhance YouTube download functionality with chunked requests and audio conversion

This commit is contained in:
Fd
2026-07-17 17:24:44 +07:00
parent 43a559bd55
commit 24338beaaf
4 changed files with 133 additions and 19 deletions
+6 -2
View File
@@ -47,13 +47,17 @@ func (c *Ctx) UploadVideo(bytes []byte, caption string) (*waE2E.VideoMessage, er
}
func (c *Ctx) UploadAudio(bytes []byte) (*waE2E.AudioMessage, error) {
mime := mimetype.Detect(bytes)
mime := mimetype.Detect(bytes).String()
if mime == "video/mp4" {
mime = "audio/mp4"
}
resp, err := c.client.Upload(stdctx.Background(), bytes, whatsmeow.MediaAudio)
if err != nil {
return nil, err
}
return &waE2E.AudioMessage{
Mimetype: proto.String(mime.String()),
Mimetype: proto.String(mime),
URL: &resp.URL,
DirectPath: &resp.DirectPath,
MediaKey: resp.MediaKey,