diff --git a/.idea/IPTV.iml b/.idea/IPTV.iml new file mode 100644 index 0000000..7ee078d --- /dev/null +++ b/.idea/IPTV.iml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Golang/README.md b/Golang/README.md index eb442ab..5101a01 100644 --- a/Golang/README.md +++ b/Golang/README.md @@ -29,6 +29,6 @@ http://你的IP:35455/huya/xxxxx ``` ## **BiliBili`(live.bilibili.com/)xxxxxx`:** ``` -http://你的IP:35455/bilibili/xxxxx +待重写中 ``` ## 更多平台后续会酌情添加 diff --git a/Golang/go.mod b/Golang/go.mod index f8f3ed1..77249d7 100644 --- a/Golang/go.mod +++ b/Golang/go.mod @@ -3,10 +3,8 @@ module Golang go 1.19 require ( - github.com/asmcos/requests v0.0.0-20210319030608-c839e8ae4946 github.com/dop251/goja v0.0.0-20230203172422-5460598cfa32 github.com/gin-gonic/gin v1.8.2 - github.com/json-iterator/go v1.1.12 ) require ( @@ -17,6 +15,7 @@ require ( github.com/go-playground/validator/v10 v10.11.1 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/goccy/go-json v0.9.11 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect diff --git a/Golang/go.sum b/Golang/go.sum index c604e7a..9d13fb1 100644 --- a/Golang/go.sum +++ b/Golang/go.sum @@ -1,5 +1,3 @@ -github.com/asmcos/requests v0.0.0-20210319030608-c839e8ae4946 h1:1B8lZnGJOS3E7LumjuY6lb2NzXy8vBY6N2ag/IK6JdI= -github.com/asmcos/requests v0.0.0-20210319030608-c839e8ae4946/go.mod h1:2W5PB6UTVRBypeouEebhwOJrDZOfJvPwMP1mtD8ZXM4= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/Golang/liveurls/BiliBili.go b/Golang/liveurls/BiliBili.go deleted file mode 100644 index c0cf8ce..0000000 --- a/Golang/liveurls/BiliBili.go +++ /dev/null @@ -1,69 +0,0 @@ -// Package liveurls -// @Time:2023/02/06 01:19 -// @File:BiliBili.go -// @SoftWare:Goland -// @Author:feiyang -// @Contact:TG@feiyangdigital - -//B站源码来自项目:https://github.com/driveLiving/liveRedirect 加以修正 - -package liveurls - -import ( - "github.com/asmcos/requests" - jsoniter "github.com/json-iterator/go" -) - -type BiliBili struct { - Rid string -} - -func u(roomId string, pf string, cookies string) any { - req := requests.Requests() - - fUrl := "https://api.live.bilibili.com/xlive/web-room/v1/playUrl/playUrl" - p := requests.Params{ - "cid": roomId, - "qn": "10000", - "platform": pf, - "https_url_req": "1", - "ptype": "16", - } - res, err := req.Get(fUrl, p, requests.Header{"Cookie": cookies}) - if err != nil { - return nil - } - json := jsoniter.ConfigCompatibleWithStandardLibrary - durl := json.Get([]byte(res.Text()), "data", "durl") - if durl == nil || durl.Size() == 0 { - return nil - } - s := durl.Get(durl.Size() - 1).Get("url").ToString() - return s -} -func (b *BiliBili) GetPlayUrl() any { - rUrl := "https://api.live.bilibili.com/room/v1/Room/room_init?id=" + b.Rid - resp, err := requests.Get(rUrl) - if err != nil { - return nil - } - json := jsoniter.ConfigCompatibleWithStandardLibrary - pageResult := resp.Text() - code := json.Get([]byte(pageResult), "code").ToInt() - if code != 0 { - return nil - } - cookies := resp.Cookies() - coo := "" - for _, c := range cookies { - coo = coo + c.Name + "=" + c.Value + ";" - } - - liveStatus := json.Get([]byte(pageResult), "data", "live_status").ToInt() - if liveStatus != 1 { - return nil - } - roomId := json.Get([]byte(resp.Text()), "data", "room_id").ToString() - - return u(roomId, "web", coo) -} diff --git a/Golang/main.go b/Golang/main.go index f481dde..320e3c5 100644 --- a/Golang/main.go +++ b/Golang/main.go @@ -73,17 +73,6 @@ func setupRouter(adurl string) *gin.Engine { huyaurl = adurl } c.Redirect(http.StatusMovedPermanently, huyaurl) - case "bilibili": - var biliurl string - biliobj := &liveurls.BiliBili{} - biliobj.Rid = rid - biurl := biliobj.GetPlayUrl() - if str, ok := biurl.(string); ok { - biliurl = str - } else { - biliurl = adurl - } - c.Redirect(http.StatusMovedPermanently, biliurl) } }) return r