summaryrefslogtreecommitdiff
path: root/bilibili/connect.go
diff options
context:
space:
mode:
authorKeuin <[email protected]>2023-07-29 19:43:27 +0800
committerKeuin <[email protected]>2023-07-29 20:21:17 +0800
commit9b5c3913989754370bd7d03ac8cf2e32a6172afb (patch)
tree9e2caca8feb9ca5a9c14a96424d23e20db4314bc /bilibili/connect.go
parenta153bf02d1cf05f020d263e9670a76ae99cfeb02 (diff)
Simulate real web app cookies & WebSocket fields
Diffstat (limited to 'bilibili/connect.go')
-rw-r--r--bilibili/connect.go13
1 files changed, 13 insertions, 0 deletions
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
+}