diff --git a/README.md b/README.md index 9770f371..b6c2861c 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,6 @@ Bililive-go是一个支持多种直播平台的直播录制工具,运行在 CL www.huya.com 滋瓷 - - 全民直播 - www.quanmin.tv - 滋瓷 - CC直播 cc.163.com diff --git a/src/api/live.go b/src/api/live.go index d30404c1..cc44d623 100755 --- a/src/api/live.go +++ b/src/api/live.go @@ -21,7 +21,6 @@ var LivePlatformCNNameMap = map[string]string{ "www.yizhibo.com": "一直播", "www.twitch.tv": "twitch", "www.huya.com": "虎牙", - "www.quanmin.tv": "全民", "cc.163.com": "CC直播", "www.openrec.tv": "openrec", } @@ -96,8 +95,6 @@ func NewLive(url *url.URL) (Live, error) { live = &TwitchLive{abstractLive: baseLive} case "www.huya.com": live = &HuYaLive{abstractLive: baseLive} - case "www.quanmin.tv": - live = &QuanMinLive{abstractLive: baseLive} case "cc.163.com": live = &CCLive{abstractLive: baseLive} case "www.openrec.tv": diff --git a/src/api/quanmin_live.go b/src/api/quanmin_live.go deleted file mode 100644 index 82d184d6..00000000 --- a/src/api/quanmin_live.go +++ /dev/null @@ -1,73 +0,0 @@ -package api - -import ( - "fmt" - "net/url" - "regexp" - - "github.com/tidwall/gjson" - - "github.com/hr3lxphr6j/bililive-go/src/lib/http" -) - -type QuanMinLive struct { - abstractLive -} - -func (q *QuanMinLive) requestRoomInfo() (string, error) { - dom, err := http.Get(q.Url.String(), nil, nil) - if err != nil { - return "", err - } - if res := regexp.MustCompile("你想要的页面不存在噢!").FindStringSubmatch(string(dom)); res != nil { - return "", &RoomNotExistsError{q.Url} - } - return regexp.MustCompile(`var roomModel = (.*)`).FindStringSubmatch(string(dom))[1], nil - -} - -func (q *QuanMinLive) GetInfo() (info *Info, err error) { - defer func() { - if e := recover(); e != nil { - err = e.(error) - } - }() - - roomModel, err := q.requestRoomInfo() - if err != nil { - return nil, err - } - info = &Info{ - Live: q, - HostName: gjson.Get(roomModel, "nick").String(), - RoomName: gjson.Get(roomModel, "title").String(), - Status: gjson.Get(roomModel, "status").String() == "2", - } - q.cachedInfo = info - return info, nil -} - -func (q *QuanMinLive) GetStreamUrls() (us []*url.URL, err error) { - defer func() { - if e := recover(); e != nil { - err = e.(error) - } - }() - - roomModel, err := q.requestRoomInfo() - if err != nil { - return nil, err - } - us = make([]*url.URL, 0) - gjson.Get(roomModel, "room_lines").ForEach(func(key, value gjson.Result) bool { - level := value.Get("flv.main_pc").String() - src := value.Get(fmt.Sprintf("flv.%s.src", level)).String() - u, err := url.Parse(src) - if err != nil { - return true - } - us = append(us, u) - return true - }) - return us, nil -} diff --git a/src/api/quanmin_live_test.go b/src/api/quanmin_live_test.go deleted file mode 100644 index 964c09d1..00000000 --- a/src/api/quanmin_live_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package api - -import ( - "net/url" - "testing" -) - -const quanminTestUrl = "https://www.quanmin.tv/8741269" - -func TestQuanMinLive_GetInfo(t *testing.T) { - u, _ := url.Parse(quanminTestUrl) - live, _ := NewLive(u) - t.Log(live.GetInfo()) -} - -func TestQuanMinLive_GetStreamUrls(t *testing.T) { - u, _ := url.Parse(quanminTestUrl) - live, _ := NewLive(u) - t.Log(live.GetStreamUrls()) -}