|
@@ -61,7 +61,7 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
|
n, err := res.Body.Read(p)
|
|
|
fmt.Println("n=", n)
|
|
|
str = res.Header.Get("Location")
|
|
|
- fmt.Println("res.Body = ", string(p))
|
|
|
+ //fmt.Println("res.Body = ", string(p))
|
|
|
|
|
|
comma := strings.Index(str, "/video/")
|
|
|
pos := strings.Index(str, "/?")
|
|
@@ -69,7 +69,7 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
|
|
|
|
var inData models.DyJieXi
|
|
|
baseHost = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=" + str[comma+7:pos]
|
|
|
- fmt.Println("baseHost = ", baseHost)
|
|
|
+ //fmt.Println("baseHost = ", baseHost)
|
|
|
req := requests.Requests()
|
|
|
resp, err := req.Get(baseHost)
|
|
|
|
|
@@ -121,20 +121,20 @@ func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
|
|
|
return errors.New(apis.ClientGetFail), out
|
|
|
}
|
|
|
ss, err := ioutil.ReadAll(res1.Body)
|
|
|
- fmt.Println(string(ss))
|
|
|
+ //fmt.Println(string(ss))
|
|
|
videoStr := string(ss)
|
|
|
//截取字符串
|
|
|
comma = strings.Index(videoStr, "\"")
|
|
|
pos = strings.Index(videoStr[comma+1:], "\">")
|
|
|
|
|
|
- fmt.Println(videoStr[comma+1 : pos+comma+1])
|
|
|
+ //fmt.Println(videoStr[comma+1 : pos+comma+1])
|
|
|
out.Data.VideoUrl = strings.Replace(videoStr[comma+1:pos+comma+1], "http", "https", 1)
|
|
|
out.Data.VideoUrl = out.Data.VideoUrl + ".mp4"
|
|
|
|
|
|
//截取
|
|
|
comma = strings.Index(out.Data.VideoUrl, "https://")
|
|
|
pos = strings.Index(out.Data.VideoUrl[comma+1:], ".com")
|
|
|
- fmt.Println(out.Data.VideoUrl[comma : pos+comma+4+1])
|
|
|
+ //fmt.Println(out.Data.VideoUrl[comma : pos+comma+4+1])
|
|
|
var twoUrl mysql.DysyTwoUrl
|
|
|
twoUrl.CreateTime = tools.GetCurrntTimeStr()
|
|
|
twoUrl.UpdateTime = tools.GetCurrntTimeStr()
|