|
@@ -45,7 +45,7 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
var out models.DyJieXiOutput
|
|
var out models.DyJieXiOutput
|
|
var dysy mysql.DysyUrlInfo
|
|
var dysy mysql.DysyUrlInfo
|
|
var p []byte
|
|
var p []byte
|
|
- //fmt.Println("test")
|
|
|
|
|
|
+
|
|
str := ""
|
|
str := ""
|
|
baseHost := in.Url
|
|
baseHost := in.Url
|
|
client := &http.Client{
|
|
client := &http.Client{
|
|
@@ -53,7 +53,6 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
return http.ErrUseLastResponse
|
|
return http.ErrUseLastResponse
|
|
},
|
|
},
|
|
}
|
|
}
|
|
- //client.Head()
|
|
|
|
|
|
|
|
res, err := client.Get(baseHost)
|
|
res, err := client.Get(baseHost)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -83,32 +82,17 @@ 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)
|
|
|
|
|
|
|
|
- //data,_ :=json.Marshal(inData)
|
|
|
|
- //fmt.Println(string(data))
|
|
|
|
//视频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))
|
|
|
|
|
|
+
|
|
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();
|
|
|
|
- //dyDto.setMusicUrl(musicUrl);
|
|
|
|
- //fmt.Println(inData.ItemList[0].Music.PlayURL.URI)
|
|
|
|
- //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);
|
|
|
|
- //dyDto.setVideoPic(videoPic);
|
|
|
|
- //封面
|
|
|
|
- //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();
|
|
|
|
- // dyDto.setDesc(desc);
|
|
|
|
- //fmt.Println(inData.ItemList[0].Desc)
|
|
|
|
|
|
+
|
|
out.Data.Desc = inData.ItemList[0].Desc
|
|
out.Data.Desc = inData.ItemList[0].Desc
|
|
|
|
|
|
//数据库创建记录
|
|
//数据库创建记录
|
|
@@ -138,51 +122,14 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
}
|
|
}
|
|
ss, err := ioutil.ReadAll(res1.Body)
|
|
ss, err := ioutil.ReadAll(res1.Body)
|
|
fmt.Println(string(ss))
|
|
fmt.Println(string(ss))
|
|
-
|
|
|
|
- //reqq := requests.Requests()
|
|
|
|
-
|
|
|
|
- // 获取 header
|
|
|
|
-
|
|
|
|
- //header, err := ubaRequestHeader("")
|
|
|
|
- //if err != nil {
|
|
|
|
- // fmt.Println(err.Error())
|
|
|
|
- //}
|
|
|
|
- //fmt.Println(header)
|
|
|
|
- //respp, err := reqq.Get(out.Data.VideoUrl, header)
|
|
|
|
- //if err != nil {
|
|
|
|
- // fmt.Println(err.Error())
|
|
|
|
- //}
|
|
|
|
- ////fmt.Println(respp.Text())
|
|
|
|
- //fmt.Println(respp.Text()[0:100])
|
|
|
|
- //index := strings.Index(respp.Text(), "src")
|
|
|
|
- //fmt.Println("index = ", index)
|
|
|
|
-
|
|
|
|
- //打开视频连接
|
|
|
|
- //reqq := requests.Requests()
|
|
|
|
-
|
|
|
|
- //resp, err = reqq.Get(out.Data.VideoUrl)
|
|
|
|
- //if err != nil {
|
|
|
|
- // fmt.Println("err =", err.Error())
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- //respp, err := http.Post(out.Data.VideoUrl, "text/html", nil)
|
|
|
|
- //if err != nil {
|
|
|
|
- // fmt.Println("http get error", err)
|
|
|
|
- //}
|
|
|
|
- //body, err := ioutil.ReadAll(respp.Body)
|
|
|
|
- //if err != nil {
|
|
|
|
- // fmt.Println("read error", err)
|
|
|
|
- //
|
|
|
|
- //}
|
|
|
|
- //str = respp.Header.Get("Location")
|
|
|
|
- //fmt.Println("str = ", str)
|
|
|
|
-
|
|
|
|
- //fmt.Println(string(body)[0:100])
|
|
|
|
- //index := strings.Index(string(body), "src")
|
|
|
|
- //fmt.Println("index = ", index)
|
|
|
|
- //fmt.Println("resp = ", resp.Text())
|
|
|
|
- //fmt.Println("resp = ", resp.SaveFile("./name"))
|
|
|
|
- //fmt.Println("resp = ", string(resp.Content()))
|
|
|
|
|
|
+ videoStr := string(ss)
|
|
|
|
+ //截取字符串
|
|
|
|
+ //comma := strings.Index(videoStr, "\"")
|
|
|
|
+ comma = strings.Index(videoStr, "\"")
|
|
|
|
+ pos = strings.Index(videoStr[comma+1:], "\"")
|
|
|
|
+ fmt.Println(videoStr[comma+1 : pos])
|
|
|
|
+ //strings.Index(videoStr[comma:])
|
|
|
|
+ //fmt.Println(videoStr[comma:lastComma])
|
|
|
|
|
|
return nil, out
|
|
return nil, out
|
|
|
|
|