k.zhang 4 years ago
commit
af6e38549c
12 changed files with 660 additions and 0 deletions
  1. 16 0
      apis/base.go
  2. 12 0
      apis/dyjx/dyjxBase.go
  3. 109 0
      apis/dyjx/url_jx.go
  4. 79 0
      apis/dyjx/url_jx_test.go
  5. 66 0
      apis/dyjx/url_test.go
  6. 0 0
      go
  7. 19 0
      go.mod
  8. 138 0
      go.sum
  9. 11 0
      main.go
  10. 9 0
      models/base.go
  11. 181 0
      models/dyjx.go
  12. 20 0
      routers/router.go

+ 16 - 0
apis/base.go

@@ -0,0 +1,16 @@
+package apis
+
+const (
+	Code400 = 400
+	Code500 = 500
+	Code200 = 200
+)
+
+const (
+	Success           = "成功"
+	InputFail         = "输入参数错误"
+	DeWaterFail       = "去水印失败"
+	ClientGetFail     = "打开链接失败"
+	RedirectUrlFail   = "重定向链接打开失败"
+	JsonUnmarshalFail = "解析json返回数据失败"
+)

+ 12 - 0
apis/dyjx/dyjxBase.go

@@ -0,0 +1,12 @@
+package dyjx
+
+import "github.com/gin-gonic/gin"
+
+// 产品接口 Attachment Controller
+func InitDyjxRouter(engine *gin.RouterGroup) {
+	v1 := engine.Group("v1")
+	{
+		v1.POST("/dewater", DouYinUrlJieXi) //去水印
+
+	}
+}

+ 109 - 0
apis/dyjx/url_jx.go

@@ -0,0 +1,109 @@
+package dyjx
+
+import (
+	"dysy/apis"
+	"dysy/models"
+	"encoding/json"
+	"errors"
+	"fmt"
+	"github.com/asmcos/requests"
+	"github.com/gin-gonic/gin"
+	"net/http"
+	"strings"
+)
+
+func DouYinUrlJieXi(c *gin.Context) {
+	//前端给端视频连接
+	var inData models.DyJieXiInput
+	var outData models.DyJieXiOutput
+
+	err := c.ShouldBindJSON(&inData)
+	if err != nil {
+		outData.Code = apis.Code400
+		outData.Message = apis.InputFail
+		c.JSON(http.StatusOK, outData)
+		return
+	}
+
+	err, outData = DeWater(inData)
+	if err != nil {
+		outData.Code = apis.Code500
+		outData.Message = err.Error()
+		c.JSON(http.StatusOK, outData)
+		return
+	}
+	outData.Code = apis.Code200
+	outData.Message = apis.Success
+	c.JSON(http.StatusOK, outData)
+
+}
+
+func DeWater(in models.DyJieXiInput) (error, models.DyJieXiOutput) {
+	var out models.DyJieXiOutput
+	fmt.Println("test")
+	str := ""
+	baseHost := in.Url
+	client := &http.Client{
+		CheckRedirect: func(req *http.Request, via []*http.Request) error {
+			return http.ErrUseLastResponse
+		},
+	}
+
+	res, err := client.Get(baseHost)
+	if err != nil {
+		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")
+
+	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]
+
+	req := requests.Requests()
+	resp, err := req.Get(baseHost)
+
+	if err != nil {
+		return errors.New(apis.RedirectUrlFail), out
+	}
+
+	err = json.Unmarshal([]byte(resp.Text()), &inData)
+	if err != nil {
+		return errors.New(apis.JsonUnmarshalFail), out
+		//fmt.Println()
+	}
+	fmt.Println(inData)
+	//视频url
+	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)
+	//音频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
+
+	//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]
+	//文案
+	//desc = dyResult.getItem_list().get(0).getDesc();
+	//                dyDto.setDesc(desc);
+	fmt.Println(inData.ItemList[0].Desc)
+	out.Data.Desc = inData.ItemList[0].Desc
+	return nil, out
+
+}

+ 79 - 0
apis/dyjx/url_jx_test.go

@@ -0,0 +1,79 @@
+package dyjx
+
+import (
+	"dysy/models"
+	"encoding/json"
+	"fmt"
+	"github.com/asmcos/requests"
+	"net/http"
+	"strings"
+	"testing"
+)
+
+//https://v.douyin.com/JvTooa3/
+func Test_UrlJx(t *testing.T) {
+	fmt.Println("test")
+	str := ""
+	baseHost := "https://v.douyin.com/JvTooa3/"
+	client := &http.Client{
+		CheckRedirect: func(req *http.Request, via []*http.Request) error {
+			return http.ErrUseLastResponse
+		},
+	}
+
+	res, err := client.Get(baseHost)
+	if err != nil {
+		fmt.Println(baseHost)
+	}
+
+	if res.StatusCode != 301 {
+		fmt.Println(baseHost)
+		//return baseHost
+	}
+	fmt.Println(res.Header.Get("Location"))
+	str = res.Header.Get("Location")
+
+	//str := "https://www.iesdouyin.com/share/video/6921910683072220429/?region=CN&mid=6921910756871670541&u_code=121d24j2h&titleType=title&did=67754443383&iid=650526374502219&utm_source=copy_link&utm_campaign=client_share&utm_medium=android&app=aweme"
+
+	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]
+
+	req := requests.Requests()
+	resp, err := req.Get(baseHost)
+	fmt.Println(resp.Text())
+	if err != nil {
+		fmt.Println(err.Error())
+	}
+
+	err = json.Unmarshal([]byte(resp.Text()), &inData)
+	if err != nil {
+		fmt.Println()
+	}
+	fmt.Println(inData)
+	//视频url
+	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))
+	//音频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])
+
+	//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])
+
+	//文案
+	//desc = dyResult.getItem_list().get(0).getDesc();
+	//                dyDto.setDesc(desc);
+	fmt.Println(inData.ItemList[0].Desc)
+
+	//https://www.iesdouyin.com/share/video/6921910683072220429/?region=CN&mid=6921910756871670541&u_code=121d24j2h&titleType=title&did=67754443383&iid=650526374502219&utm_source=copy_link&utm_campaign=client_share&utm_medium=android&app=aweme
+}

+ 66 - 0
apis/dyjx/url_test.go

@@ -0,0 +1,66 @@
+package dyjx
+
+import (
+	"dysy/models"
+	"encoding/json"
+	"fmt"
+	"github.com/asmcos/requests"
+	"testing"
+)
+
+func Test_Url(t *testing.T) {
+	var inData models.DyJieXi
+	baseHost := "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=6921910683072220429"
+
+	req := requests.Requests()
+	resp, err := req.Get(baseHost)
+	fmt.Println(resp.Text())
+	if err != nil {
+		fmt.Println(err.Error())
+	}
+
+	err = json.Unmarshal([]byte(resp.Text()), &inData)
+	if err != nil {
+		fmt.Println()
+	}
+	fmt.Println(inData)
+	//视频url
+	fmt.Println(inData.ItemList[0].Video.PlayAddr.URLList[0])
+	fmt.Println(inData.ItemList[0].Video.PlayAddr.URI)
+	//音频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])
+
+	//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])
+
+	//文案
+	//desc = dyResult.getItem_list().get(0).getDesc();
+	//                dyDto.setDesc(desc);
+	fmt.Println(inData.ItemList[0].Desc)
+	//client := &http.Client{
+	//	CheckRedirect: func(req *http.Request, via []*http.Request) error {
+	//		return http.ErrUseLastResponse
+	//	},
+	//}
+	//
+	//res, err := client.Get(baseHost)
+	////res.Body
+	//fmt.Println("res = ", res.Body)
+	//if err != nil {
+	//	//return baseHost
+	//	fmt.Println(baseHost)
+	//}
+
+	//if res.StatusCode != 301 {
+	//	fmt.Println(baseHost)
+	//	//return baseHost
+	//}
+	//fmt.Println(res.Header.Get("Location"))
+}
+
+//https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=6921910683072220429

+ 0 - 0
go


+ 19 - 0
go.mod

@@ -0,0 +1,19 @@
+module dysy
+
+go 1.14
+
+require (
+	github.com/asmcos/requests v0.0.0-20210118082303-cb8f46dd3767
+	github.com/gin-gonic/gin v1.6.3
+	github.com/go-playground/validator/v10 v10.4.1 // indirect
+	github.com/golang/protobuf v1.4.3 // indirect
+	github.com/json-iterator/go v1.1.10 // indirect
+	github.com/leodido/go-urn v1.2.1 // indirect
+	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+	github.com/modern-go/reflect2 v1.0.1 // indirect
+	github.com/ugorji/go v1.2.3 // indirect
+	golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
+	golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
+	google.golang.org/protobuf v1.25.0 // indirect
+	gopkg.in/yaml.v2 v2.4.0 // indirect
+)

+ 138 - 0
go.sum

@@ -0,0 +1,138 @@
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/asmcos/requests v0.0.0-20210118082303-cb8f46dd3767 h1:/2W6hzSR62YUThJdMsKkx4n1kpe05cH8T21Jk0j3msA=
+github.com/asmcos/requests v0.0.0-20210118082303-cb8f46dd3767/go.mod h1:2W5PB6UTVRBypeouEebhwOJrDZOfJvPwMP1mtD8ZXM4=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
+github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
+github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
+github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
+github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
+github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
+github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
+github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
+github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
+github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
+github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
+github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
+github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
+github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
+github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
+github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
+github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
+github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
+github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
+github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
+github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
+github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
+github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
+github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
+github.com/ugorji/go v1.2.3 h1:WbFSXLxDFKVN69Sk8t+XHGzVCD7R8UoAATR8NqZgTbk=
+github.com/ugorji/go v1.2.3/go.mod h1:5l8GZ8hZvmL4uMdy+mhCO1LjswGRYco9Q3HfuisB21A=
+github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
+github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
+github.com/ugorji/go/codec v1.2.3 h1:/mVYEV+Jo3IZKeA5gBngN0AvNnQltEDkR+eQikkWQu0=
+github.com/ugorji/go/codec v1.2.3/go.mod h1:5FxzDJIgeiWJZslYHPj+LS1dq1ZBQVelZFnjsFGI/Uc=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
+golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
+golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
+google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

+ 11 - 0
main.go

@@ -0,0 +1,11 @@
+package main
+
+import (
+	"dysy/routers"
+	"fmt"
+)
+
+func main() {
+	fmt.Println("hello")
+	routers.InitRouter()
+}

+ 9 - 0
models/base.go

@@ -0,0 +1,9 @@
+package models
+
+type InputBase struct {
+}
+
+type OutputBase struct {
+	Code    int    `json:"code"`    //状态码
+	Message string `json:"message"` //说明
+}

+ 181 - 0
models/dyjx.go

@@ -0,0 +1,181 @@
+package models
+
+type DyJieXiInput struct {
+	Url string `json:"url"` //短视频url
+}
+
+type DyJieXiOutput struct {
+	OutputBase
+	Data DyJieXiData `json:"data"`
+}
+
+type DyJieXiData struct {
+	VideoUrl string `json:"videoUrl"` //无水印url
+	AudioUrl string `json:"audioUrl"` //音频url
+	VideoPic string `json:"videoPic"` //文案
+	Desc     string `json:"desc"`     //封面
+}
+
+type DyJieXi struct {
+	ItemList   []ItemList `json:"item_list"`
+	Extra      Extra      `json:"extra"`
+	StatusCode int        `json:"status_code"`
+}
+type CoverHd struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type CoverLarge struct {
+	URLList []string `json:"url_list"`
+	URI     string   `json:"uri"`
+}
+type CoverMedium struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type CoverThumb struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type PlayURL struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type Music struct {
+	Title       string      `json:"title"`
+	Author      string      `json:"author"`
+	CoverHd     CoverHd     `json:"cover_hd"`
+	Duration    int         `json:"duration"`
+	Position    interface{} `json:"position"`
+	ID          int64       `json:"id"`
+	CoverLarge  CoverLarge  `json:"cover_large"`
+	CoverMedium CoverMedium `json:"cover_medium"`
+	CoverThumb  CoverThumb  `json:"cover_thumb"`
+	PlayURL     PlayURL     `json:"play_url"`
+	Status      int         `json:"status"`
+	Mid         string      `json:"mid"`
+}
+type DynamicCover struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type OriginCover struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type PlayAddr struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type Cover struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type Video struct {
+	Duration     int          `json:"duration"`
+	Height       int          `json:"height"`
+	DynamicCover DynamicCover `json:"dynamic_cover"`
+	OriginCover  OriginCover  `json:"origin_cover"`
+	Ratio        string       `json:"ratio"`
+	HasWatermark bool         `json:"has_watermark"`
+	PlayAddr     PlayAddr     `json:"play_addr"`
+	Cover        Cover        `json:"cover"`
+	Width        int          `json:"width"`
+	BitRate      interface{}  `json:"bit_rate"`
+	Vid          string       `json:"vid"`
+}
+type Statistics struct {
+	AwemeID      string `json:"aweme_id"`
+	CommentCount int    `json:"comment_count"`
+	DiggCount    int    `json:"digg_count"`
+	PlayCount    int    `json:"play_count"`
+}
+type AvatarLarger struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type AvatarThumb struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type AvatarMedium struct {
+	URI     string   `json:"uri"`
+	URLList []string `json:"url_list"`
+}
+type Author struct {
+	UID              string       `json:"uid"`
+	ShortID          string       `json:"short_id"`
+	Nickname         string       `json:"nickname"`
+	AvatarLarger     AvatarLarger `json:"avatar_larger"`
+	AvatarThumb      AvatarThumb  `json:"avatar_thumb"`
+	UniqueID         string       `json:"unique_id"`
+	FollowersDetail  interface{}  `json:"followers_detail"`
+	Geofencing       interface{}  `json:"geofencing"`
+	PolicyVersion    interface{}  `json:"policy_version"`
+	Signature        string       `json:"signature"`
+	AvatarMedium     AvatarMedium `json:"avatar_medium"`
+	PlatformSyncInfo interface{}  `json:"platform_sync_info"`
+	TypeLabel        interface{}  `json:"type_label"`
+}
+type TextExtra struct {
+	HashtagID   int64  `json:"hashtag_id"`
+	Start       int    `json:"start"`
+	End         int    `json:"end"`
+	Type        int    `json:"type"`
+	HashtagName string `json:"hashtag_name"`
+}
+type ChaList struct {
+	ChaName        string      `json:"cha_name"`
+	UserCount      int         `json:"user_count"`
+	Type           int         `json:"type"`
+	IsCommerce     bool        `json:"is_commerce"`
+	Cid            string      `json:"cid"`
+	Desc           string      `json:"desc"`
+	ConnectMusic   interface{} `json:"connect_music"`
+	ViewCount      int         `json:"view_count"`
+	HashTagProfile string      `json:"hash_tag_profile"`
+}
+type ShareInfo struct {
+	ShareWeiboDesc string `json:"share_weibo_desc"`
+	ShareDesc      string `json:"share_desc"`
+	ShareTitle     string `json:"share_title"`
+}
+type RiskInfos struct {
+	Type    int    `json:"type"`
+	Content string `json:"content"`
+	Warn    bool   `json:"warn"`
+}
+type ItemList struct {
+	Desc         string      `json:"desc"`
+	CreateTime   int         `json:"create_time"`
+	IsLiveReplay bool        `json:"is_live_replay"`
+	Music        Music       `json:"music"`
+	GroupID      int64       `json:"group_id"`
+	Images       interface{} `json:"images"`
+	Video        Video       `json:"video"`
+	Duration     int         `json:"duration"`
+	ShareURL     string      `json:"share_url"`
+	VideoLabels  interface{} `json:"video_labels"`
+	Statistics   Statistics  `json:"statistics"`
+	ImageInfos   interface{} `json:"image_infos"`
+	VideoText    interface{} `json:"video_text"`
+	Author       Author      `json:"author"`
+	TextExtra    []TextExtra `json:"text_extra"`
+	Promotions   interface{} `json:"promotions"`
+	LongVideo    interface{} `json:"long_video"`
+	ChaList      []ChaList   `json:"cha_list"`
+	ShareInfo    ShareInfo   `json:"share_info"`
+	CommentList  interface{} `json:"comment_list"`
+	AuthorUserID int64       `json:"author_user_id"`
+	IsPreview    int         `json:"is_preview"`
+	AwemeID      string      `json:"aweme_id"`
+	AwemeType    int         `json:"aweme_type"`
+	RiskInfos    RiskInfos   `json:"risk_infos"`
+	Geofencing   interface{} `json:"geofencing"`
+	LabelTopText interface{} `json:"label_top_text"`
+	ForwardID    string      `json:"forward_id"`
+}
+type Extra struct {
+	Now   int64  `json:"now"`
+	Logid string `json:"logid"`
+}

+ 20 - 0
routers/router.go

@@ -0,0 +1,20 @@
+package routers
+
+import (
+	"dysy/apis/dyjx"
+	"github.com/gin-gonic/gin"
+	"net/http"
+)
+
+func InitRouter() {
+	r := gin.New()
+
+	r.GET("/", func(c *gin.Context) { c.String(http.StatusOK, "hello!") })
+
+	r2 := r.Group("/")
+	{
+		dyjx.InitDyjxRouter(r2) //去水印
+
+	}
+	_ = r.Run(":8999")
+}