|
@@ -5,7 +5,6 @@ import (
|
|
|
"dysy/models"
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
- "fmt"
|
|
|
"github.com/asmcos/requests"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"net/http"
|
|
@@ -40,7 +39,7 @@ func DouYinUrlJieXi(c *gin.Context) {
|
|
|
|
|
|
func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
|
var out models.DyJieXiOutput
|
|
|
- fmt.Println("test")
|
|
|
+
|
|
|
str := ""
|
|
|
baseHost := in.Url
|
|
|
client := &http.Client{
|
|
@@ -54,16 +53,11 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
|
return errors.New(apis.ClientGetFail), out
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
str = res.Header.Get("Location")
|
|
|
|
|
|
comma := strings.Index(str, "/video/")
|
|
|
pos := strings.Index(str, "/?")
|
|
|
- fmt.Println(comma, pos, str[comma+7:pos])
|
|
|
+
|
|
|
|
|
|
var inData models.DyJieXi
|
|
|
baseHost = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=" + str[comma+7:pos]
|
|
@@ -80,29 +74,29 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
|
return errors.New(apis.JsonUnmarshalFail), out
|
|
|
|
|
|
}
|
|
|
- fmt.Println(inData)
|
|
|
+
|
|
|
|
|
|
var videoUrl = inData.ItemList[0].Video.PlayAddr.URLList[0]
|
|
|
- fmt.Println(inData.ItemList[0].Video.PlayAddr.URLList[0])
|
|
|
- fmt.Println(inData.ItemList[0].Video.PlayAddr.URI)
|
|
|
- fmt.Println(strings.Replace(videoUrl, "playwm", "play", 1))
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
out.Data.VideoUrl = strings.Replace(videoUrl, "playwm", "play", 1)
|
|
|
|
|
|
|
|
|
|
|
|
- fmt.Println(inData.ItemList[0].Music.PlayURL.URI)
|
|
|
+
|
|
|
|
|
|
out.Data.AudioUrl = inData.ItemList[0].Music.PlayURL.URI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- fmt.Println(inData.ItemList[0].Video.DynamicCover.URLList[0])
|
|
|
+
|
|
|
out.Data.VideoPic = inData.ItemList[0].Video.DynamicCover.URLList[0]
|
|
|
|
|
|
|
|
|
|
|
|
- fmt.Println(inData.ItemList[0].Desc)
|
|
|
+
|
|
|
out.Data.Desc = inData.ItemList[0].Desc
|
|
|
return nil, out
|
|
|
|