summaryrefslogtreecommitdiff
path: root/bilibili/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'bilibili/client.go')
-rw-r--r--bilibili/client.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/bilibili/client.go b/bilibili/client.go
index 4abad60..f4b64fd 100644
--- a/bilibili/client.go
+++ b/bilibili/client.go
@@ -10,6 +10,7 @@ import (
"github.com/keuin/slbr/types"
"net"
"net/http"
+ "net/http/cookiejar"
)
const (
@@ -39,10 +40,15 @@ func NewBilibiliWithContext(ctx context.Context, netTypes []types.IpNetType, log
transport.DialTLSContext = nil
transport.DialContext, _ = np.NextNetworkType(dialer)
+ cookieJar, _ := cookiejar.New(nil)
+ httpClient := &http.Client{
+ Jar: cookieJar,
+ }
+
return &Bilibili{
logger: logger,
userAgent: userAgent,
- http: http.DefaultClient,
+ http: httpClient,
ctx: ctx,
netTypes: nets,
}