Skip to content
This repository has been archived by the owner on Feb 1, 2025. It is now read-only.

Commit

Permalink
Merge pull request #39 from huajiqaq/patch-1
Browse files Browse the repository at this point in the history
解决报错 优化描述
  • Loading branch information
ICE99125 authored May 5, 2024
2 parents 14d2f13 + ba4c39c commit b236954
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions bilibili.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@
# 获取当日投币情况
COIN_LOG = " https://api.bilibili.com/x/member/web/coin/log"


class BiliBili:
headers = {
headers = {
"user-agent": "Mozilla/5.0",
"Content-Type": "application/x-www-form-urlencoded",
"Referer": "https://www.bilibili.com/",
}
}

class BiliBili:
headers = headers.copy()

def __init__(self, **config) -> None:
self.cookie = config.get("cookie")
Expand Down Expand Up @@ -204,7 +205,7 @@ def video_suggest(ps: int = 50, pn: int = 1) -> list or None:
]
"""

rep = req.get(RECOMMAND, params={"ps": ps, "pn": pn}).json()
rep = req.get(RECOMMAND, params={"ps": ps, "pn": pn},headers=headers).json()

if rep["code"] == 0:
res = []
Expand All @@ -223,7 +224,7 @@ def video_suggest(ps: int = 50, pn: int = 1) -> list or None:

return res
else:
failed(f"获取视频推荐列表失败")
failed(f"获取视频推荐列表失败, 原因: {rep['message']}")

return [{"bvid": "BV1LS4y1C7Pa"}]

Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
],
"push": {
# 合并发送消息, 只合并未单独配置 push 的账号
# 只作用于在multi并未配置 push 的组
"type": "pushplus",
"key": "xxx",
},
Expand Down

0 comments on commit b236954

Please sign in to comment.