|
@@ -5,7 +5,6 @@ import (
|
|
"dysy/models"
|
|
"dysy/models"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"errors"
|
|
"errors"
|
|
- "fmt"
|
|
|
|
"github.com/asmcos/requests"
|
|
"github.com/asmcos/requests"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
"net/http"
|
|
@@ -40,7 +39,7 @@ func DouYinUrlJieXi(c *gin.Context) {
|
|
|
|
|
|
func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
var out models.DyJieXiOutput
|
|
var out models.DyJieXiOutput
|
|
- fmt.Println("test")
|
|
|
|
|
|
+ //fmt.Println("test")
|
|
str := ""
|
|
str := ""
|
|
baseHost := in.Url
|
|
baseHost := in.Url
|
|
client := &http.Client{
|
|
client := &http.Client{
|
|
@@ -54,16 +53,11 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
return errors.New(apis.ClientGetFail), out
|
|
return errors.New(apis.ClientGetFail), out
|
|
}
|
|
}
|
|
|
|
|
|
- //if res.StatusCode != 301 {
|
|
|
|
- // fmt.Println(baseHost)
|
|
|
|
- // //return baseHost
|
|
|
|
- //}
|
|
|
|
- //fmt.Println(res.Header.Get("Location"))
|
|
|
|
str = res.Header.Get("Location")
|
|
str = res.Header.Get("Location")
|
|
|
|
|
|
comma := strings.Index(str, "/video/")
|
|
comma := strings.Index(str, "/video/")
|
|
pos := strings.Index(str, "/?")
|
|
pos := strings.Index(str, "/?")
|
|
- fmt.Println(comma, pos, str[comma+7:pos])
|
|
|
|
|
|
+ //fmt.Println(comma, pos, str[comma+7:pos])
|
|
|
|
|
|
var inData models.DyJieXi
|
|
var inData models.DyJieXi
|
|
baseHost = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=" + str[comma+7:pos]
|
|
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
|
|
return errors.New(apis.JsonUnmarshalFail), out
|
|
//fmt.Println()
|
|
//fmt.Println()
|
|
}
|
|
}
|
|
- fmt.Println(inData)
|
|
|
|
|
|
+ //fmt.Println(inData)
|
|
//视频url
|
|
//视频url
|
|
var videoUrl = inData.ItemList[0].Video.PlayAddr.URLList[0]
|
|
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))
|
|
|
|
|
|
+ //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)
|
|
out.Data.VideoUrl = strings.Replace(videoUrl, "playwm", "play", 1)
|
|
//音频url
|
|
//音频url
|
|
//musicUrl = dyResult.getItem_list().get(0).getMusic().getPlay_url().getUri();
|
|
//musicUrl = dyResult.getItem_list().get(0).getMusic().getPlay_url().getUri();
|
|
//dyDto.setMusicUrl(musicUrl);
|
|
//dyDto.setMusicUrl(musicUrl);
|
|
- fmt.Println(inData.ItemList[0].Music.PlayURL.URI)
|
|
|
|
|
|
+ //fmt.Println(inData.ItemList[0].Music.PlayURL.URI)
|
|
//fmt.Println(inData.ItemList[0].Music.PlayURL.URLList[0])
|
|
//fmt.Println(inData.ItemList[0].Music.PlayURL.URLList[0])
|
|
out.Data.AudioUrl = inData.ItemList[0].Music.PlayURL.URI
|
|
out.Data.AudioUrl = inData.ItemList[0].Music.PlayURL.URI
|
|
|
|
|
|
//videoPic = dyResult.getItem_list().get(0).getVideo().getDynamic_cover().getUrl_list().get(0);
|
|
//videoPic = dyResult.getItem_list().get(0).getVideo().getDynamic_cover().getUrl_list().get(0);
|
|
//dyDto.setVideoPic(videoPic);
|
|
//dyDto.setVideoPic(videoPic);
|
|
//封面
|
|
//封面
|
|
- fmt.Println(inData.ItemList[0].Video.DynamicCover.URLList[0])
|
|
|
|
|
|
+ //fmt.Println(inData.ItemList[0].Video.DynamicCover.URLList[0])
|
|
out.Data.VideoPic = inData.ItemList[0].Video.DynamicCover.URLList[0]
|
|
out.Data.VideoPic = inData.ItemList[0].Video.DynamicCover.URLList[0]
|
|
//文案
|
|
//文案
|
|
//desc = dyResult.getItem_list().get(0).getDesc();
|
|
//desc = dyResult.getItem_list().get(0).getDesc();
|
|
// dyDto.setDesc(desc);
|
|
// dyDto.setDesc(desc);
|
|
- fmt.Println(inData.ItemList[0].Desc)
|
|
|
|
|
|
+ //fmt.Println(inData.ItemList[0].Desc)
|
|
out.Data.Desc = inData.ItemList[0].Desc
|
|
out.Data.Desc = inData.ItemList[0].Desc
|
|
return nil, out
|
|
return nil, out
|
|
|
|
|