From 9b5c3913989754370bd7d03ac8cf2e32a6172afb Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 29 Jul 2023 19:43:27 +0800 Subject: Simulate real web app cookies & WebSocket fields --- bilibili/connect.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bilibili/connect.go (limited to 'bilibili/connect.go') diff --git a/bilibili/connect.go b/bilibili/connect.go new file mode 100644 index 0000000..472c979 --- /dev/null +++ b/bilibili/connect.go @@ -0,0 +1,13 @@ +package bilibili + +import ( + "context" + "nhooyr.io/websocket" +) + +func (b Bilibili) DialWebSocket(ctx context.Context, url string) (*websocket.Conn, error) { + ws, _, err := websocket.Dial(ctx, url, &websocket.DialOptions{ + HTTPClient: b.http, + }) + return ws, err +} -- cgit v1.2.3