mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-03-23 16:20:38 +08:00
添加私货
This commit is contained in:
parent
096da47032
commit
9bf8041860
@ -193,7 +193,6 @@ class WebLiveClient(blivedm.BLiveClient):
|
||||
assert room_key.type == RoomKeyType.ROOM_ID
|
||||
super().__init__(
|
||||
room_key.value,
|
||||
uid=0,
|
||||
session=utils.request.http_session,
|
||||
heartbeat_interval=self.HEARTBEAT_INTERVAL,
|
||||
)
|
||||
|
@ -2,6 +2,8 @@
|
||||
import asyncio
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
import pickle
|
||||
from typing import *
|
||||
|
||||
import aiohttp
|
||||
@ -13,6 +15,8 @@ import utils.async_io
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
COOKIE_JAR_PATH = os.path.join(config.DATA_PATH, 'cookie_jar.pickle')
|
||||
|
||||
# 不带这堆头部有时候也能成功请求,但是带上后成功的概率更高
|
||||
BILIBILI_COMMON_HEADERS = {
|
||||
'Origin': 'https://www.bilibili.com',
|
||||
@ -37,10 +41,17 @@ _common_server_base_url_to_circuit_breaker: Dict[str, circuitbreaker.CircuitBrea
|
||||
|
||||
|
||||
def init():
|
||||
try:
|
||||
cookie_jar = aiohttp.CookieJar()
|
||||
cookie_jar.load(COOKIE_JAR_PATH)
|
||||
except (OSError, pickle.PickleError):
|
||||
cookie_jar = None
|
||||
|
||||
global http_session
|
||||
http_session = aiohttp.ClientSession(
|
||||
response_class=CustomClientResponse,
|
||||
timeout=aiohttp.ClientTimeout(total=10),
|
||||
cookie_jar=cookie_jar,
|
||||
)
|
||||
|
||||
cfg = config.get_config()
|
||||
|
Loading…
Reference in New Issue
Block a user