问题描述
这是我的代码示例
package main
import (
"fmt"
"io"
"net/http"
"github.com/kkdai/youtube"
)
func getVideo() {
client := youtube.Client{}
currentVideo,videoError := client.GetVideo("https://www.youtube.com/watch?v=kGEJNZd1hTA")
resp,err := client.GetStream(currentVideo,¤tVideo.Formats.Type("audio/webm")[0])
w.Header().Set("Content-Type",req.Header.Get("Content-Type"))
w.Header().Set("Content-disposition","attachment; filename=WHATEVER_YOU_WANT.webm")
io.copy(w,resp.Body)
}
func main() {
http.HandleFunc("/video",getVideo)
http.ListenAndServe(":8090",nil)
}
那么问题是如何将我的 webm 流转换为 mp3 并将其提供给客户端?