summaryrefslogtreecommitdiff
path: root/common/testutil.go
diff options
context:
space:
mode:
authorKeuin <[email protected]>2023-07-02 14:48:47 +0800
committerKeuin <[email protected]>2023-07-02 14:49:17 +0800
commitb6eb2c0da4e653c6fdd278bcbdcd55ec376cd481 (patch)
treebc0d58aedf6e8613d21351cd3cdfd8cd5b5999e2 /common/testutil.go
parentb8d0d0c3b6b2ffe40921aa4c247c101dd0ce958d (diff)
Refactor: move RoomId type to the correct package. Type all room ID usages.
Diffstat (limited to 'common/testutil.go')
-rw-r--r--common/testutil.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/common/testutil.go b/common/testutil.go
deleted file mode 100644
index d6c3899..0000000
--- a/common/testutil.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package common
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "net/http"
-)
-
-/*
-Some utility function for test-purpose only.
-*/
-
-type LiveList struct {
- Code int `json:"code"`
- Message string `json:"message"`
- TTL int `json:"ttl"`
- Data struct {
- Count int `json:"count"`
- Data []struct {
- Face string `json:"face"`
- Link string `json:"link"`
- Roomid int `json:"roomid"`
- Roomname string `json:"roomname"`
- Nickname string `json:"nickname"`
- } `json:"data"`
- } `json:"data"`
-}
-
-func GetLiveListForGuestUser() (liveList LiveList, err error) {
- url := "https://api.live.bilibili.com/xlive/web-interface/v1/index/WebGetUnLoginRecList"
- resp, err := http.Get(url)
- if err != nil {
- return
- }
- if resp.StatusCode != http.StatusOK {
- err = fmt.Errorf("bad http response: %v", resp.StatusCode)
- return
- }
- b, err := io.ReadAll(resp.Body)
- if err != nil {
- return
- }
- err = json.Unmarshal(b, &liveList)
- return
-}