mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-08 04:43:00 +08:00
Revert "fix(platform-bilibili/bilibililive):为相关接口添加UA, 修复接口信息获取失败的问题"
This reverts commit ac505f51d3dc2fa9d3a5b2e4357d18ab7bda81f1.
This commit is contained in:
parent
e2ad4f944e
commit
2c6ff40512
@ -27,16 +27,11 @@ class Bilibili(NewMessage):
|
|||||||
name = "B站"
|
name = "B站"
|
||||||
has_target = True
|
has_target = True
|
||||||
parse_target_promot = "请输入用户主页的链接"
|
parse_target_promot = "请输入用户主页的链接"
|
||||||
UA = {
|
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko",
|
|
||||||
}
|
|
||||||
|
|
||||||
async def get_target_name(self, target: Target) -> Optional[str]:
|
async def get_target_name(self, target: Target) -> Optional[str]:
|
||||||
async with http_client() as client:
|
async with http_client() as client:
|
||||||
res = await client.get(
|
res = await client.get(
|
||||||
"https://api.bilibili.com/x/space/acc/info",
|
"https://api.bilibili.com/x/space/acc/info", params={"mid": target}
|
||||||
params={"mid": target},
|
|
||||||
headers=self.UA,
|
|
||||||
)
|
)
|
||||||
res_data = json.loads(res.text)
|
res_data = json.loads(res.text)
|
||||||
if res_data["code"]:
|
if res_data["code"]:
|
||||||
@ -176,16 +171,11 @@ class Bilibililive(StatusChange):
|
|||||||
schedule_kw = {"seconds": 10}
|
schedule_kw = {"seconds": 10}
|
||||||
name = "Bilibili直播"
|
name = "Bilibili直播"
|
||||||
has_target = True
|
has_target = True
|
||||||
UA = {
|
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko",
|
|
||||||
}
|
|
||||||
|
|
||||||
async def get_target_name(self, target: Target) -> Optional[str]:
|
async def get_target_name(self, target: Target) -> Optional[str]:
|
||||||
async with http_client() as client:
|
async with http_client() as client:
|
||||||
res = await client.get(
|
res = await client.get(
|
||||||
"https://api.bilibili.com/x/space/acc/info",
|
"https://api.bilibili.com/x/space/acc/info", params={"mid": target}
|
||||||
params={"mid": target},
|
|
||||||
headers=self.UA,
|
|
||||||
)
|
)
|
||||||
res_data = json.loads(res.text)
|
res_data = json.loads(res.text)
|
||||||
if res_data["code"]:
|
if res_data["code"]:
|
||||||
@ -198,7 +188,6 @@ class Bilibililive(StatusChange):
|
|||||||
res = await client.get(
|
res = await client.get(
|
||||||
"https://api.bilibili.com/x/space/acc/info",
|
"https://api.bilibili.com/x/space/acc/info",
|
||||||
params=params,
|
params=params,
|
||||||
headers=self.UA,
|
|
||||||
timeout=4.0,
|
timeout=4.0,
|
||||||
)
|
)
|
||||||
res_dict = json.loads(res.text)
|
res_dict = json.loads(res.text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user