show code~哈哈。火山引擎的『录音文件识别-娱乐-标准版』demo。

  1. package main
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. "net/http"
  7. )
  8. func httpPostJson() {
  9. url := "https://openspeech.bytedance.com/api/v1/auc/submit"
  10. app := make(map[string]interface{})
  11. app["appid"] = "258*****" //这个要换
  12. app["token"] = "ixn_Ttp6nxH-e5jg9k0*****" //这个要换
  13. app["cluster"] = "volc_auc_video"
  14. user := make(map[string]interface{})
  15. user["uid"] = "3888080801989"
  16. audio := make(map[string]interface{})
  17. audio["format"] = "mp4"
  18. audio["format"] = "https://heygoodvideo.tos-cn-guangzhou.volces.com/110_110_110_C_1691745137775_002606_5d77ee46.mp4"
  19. additions := make(map[string]interface{})
  20. additions["use_itn"] = "False"
  21. additions["with_speaker_info"] = "True"
  22. org := make(map[string]interface{})
  23. org["app"] = app
  24. org["user"] = user
  25. org["audio"] = audio
  26. org["additions"] = additions
  27. bytesData, err := json.Marshal(org)
  28. if err != nil {
  29. fmt.Println(err.Error())
  30. return
  31. }
  32. req, err := http.NewRequest("POST", url, bytes.NewBuffer(bytesData))
  33. req.Header.Set("Content-Type", "application/json")
  34. client := &http.Client{}
  35. resp, err := client.Do(req)
  36. if err != nil {
  37. fmt.Println("======")
  38. fmt.Println(err)
  39. fmt.Println("------")
  40. }
  41. fmt.Println(resp)
  42. }
  43. func main() {
  44. httpPostJson()
  45. }

分类: web

标签: