diff --git a/Golang/list/yylunbo.go b/Golang/list/yylunbo.go new file mode 100644 index 0000000..a56082c --- /dev/null +++ b/Golang/list/yylunbo.go @@ -0,0 +1,44 @@ +// Package list +// @Time:2023/06/03 20:35 +// @File:yylunbo.go +// @SoftWare:Goland +// @Author:feiyang +// @Contact:TG@feiyangdigital + +package list + +import ( + "io" + "net/http" +) + +type Yylist struct { +} + +type DataElement struct { + Avatar string `json:"avatar"` + Biz string `json:"biz"` + Desc string `json:"desc"` + Sid int `json:"sid"` +} + +type ApiResponse struct { + Data struct { + IsLastPage int `json:"isLastPage"` + Data []DataElement `json:"data"` + } `json:"data"` +} + +func (y *Yylist) Yylb(requesturl string) string { + client := &http.Client{} + req, _ := http.NewRequest("GET", requesturl, nil) + req.Header.Set("Upgrade-Insecure-Requests", "1") + req.Header.Set("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36") + res, err := client.Do(req) + if err != nil { + panic(err) + } + defer res.Body.Close() + body, _ := io.ReadAll(res.Body) + return string(body) +} diff --git a/Golang/main.go b/Golang/main.go index 3592db2..73e90e8 100644 --- a/Golang/main.go +++ b/Golang/main.go @@ -104,6 +104,28 @@ func setupRouter(adurl string) *gin.Engine { } }) + r.GET("/yylunbo.m3u", func(c *gin.Context) { + yylistobj := &list.Yylist{} + c.Writer.Header().Set("Content-Type", "application/octet-stream") + c.Writer.Header().Set("Content-Disposition", "attachment; filename=douyuyqk.m3u") + getTestVideoUrl(c) + + i := 1 + for { + apiRes := yylistobj.Yylb(fmt.Sprintf("https://rubiks-idx.yy.com/nav/other/pnk1/448772?channel=appstore&compAppid=yymip&exposured=80&hdid=8dce117c5c963bf9e7063e7cc4382178498f8765&hostVersion=8.25.0&individualSwitch=1&ispType=2&netType=2&openCardLive=1&osVersion=16.5&page=%d&stype=2&supportSwan=0&uid=1834958700&unionVersion=0&y0=8b799811753625ef70dbc1cc001e3a1f861c7f0261d4f7712efa5ea232f4bd3ce0ab999309cac0d7869449a56b44c774&y1=8b799811753625ef70dbc1cc001e3a1f861c7f0261d4f7712efa5ea232f4bd3ce0ab999309cac0d7869449a56b44c774&y11=9c03c7008d1fdae4873436607388718b&y12=9d8393ec004d98b7e20f0c347c3a8c24&yv=1&yyVersion=8.25.0", i)) + var res list.ApiResponse + json.Unmarshal([]byte(apiRes), &res) + for _, value := range res.Data.Data { + fmt.Fprintf(c.Writer, "#EXTINF:-1 tvg-logo=\"%s\" group-title=\"%s\", \"%s\"\n", value.Avatar, value.Biz, value.Desc) + fmt.Fprintf(c.Writer, "%s/yy/%v\n", getLivePrefix(c), value.Sid) + } + if res.Data.IsLastPage == 1 { + break + } + i++ + } + }) + r.GET("/:path/:rid", func(c *gin.Context) { path := c.Param("path") rid := c.Param("rid")