test.go
package test
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
)
type InfoRequest struct {
Bvids []string
}
type ViewInfo struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Bvid string `json:"bvid"`
Title string `json:"title"`
Desc string `json:"desc"`
} `json:"data"`
}
type InfoReponse struct {
Infos []ViewInfo
}
var Logger *log.Logger
const BILIBILI_API = "http://api.bilibili.com/x/web-interface/view?"
func init() {
file, err := os.OpenFile("test.txt", os.O_CREATE|os.O_APPEND|os.O_RDWR, 0644)
if err != nil {
panic(err)
}
Logger = log.New(io.MultiWriter(os.Stdout, file), "THELog: ", log.LstdFlags)
}
func GetBVInfo(requestBV In