-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
inke.go
51 lines (43 loc) · 1 KB
/
inke.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package tv
import (
"time"
"github.com/go-olive/tv/model"
"github.com/go-olive/tv/util"
)
func init() {
registerSite("inke", &inke{})
}
type inke struct {
base
}
func (this *inke) Name() string {
return "映客"
}
func (this *inke) Snap(tv *Tv) error {
tv.Info = &Info{
Timestamp: time.Now().Unix(),
}
return this.set(tv)
}
func (this *inke) set(tv *Tv) error {
a := new(model.InkeAutoGenerated)
req := &util.HttpRequest{
URL: "https://webapi.busi.inke.cn/web/live_share_pc?uid=" + tv.RoomID,
Method: "GET",
ResponseData: a,
ContentType: "application/json",
Header: map[string]string{
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38",
},
}
if err := req.Send(); err != nil {
return err
}
tv.roomName = a.Data.LiveName
tv.streamerName = a.Data.MediaInfo.Nick
if len(a.Data.LiveAddr) > 0 {
tv.streamUrl = a.Data.LiveAddr[0].StreamAddr
tv.roomOn = true
}
return nil
}