Skip to content

Commit

Permalink
Merge pull request #409 from Nemo2011/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
z0z0r4 authored Jul 25, 2023
2 parents 843d2f4 + 77168bb commit d184c03
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOGS/v15.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 15.5.3 2023/7/25
- fix: 强行修复 Api 的相关 bug https://github.com/Nemo2011/bilibili-api/issues/405

# 15.5.2 2023/7/25
- fix: 修改新请求函数为 Api 方法 by @Drelf2018 in https://github.com/Nemo2011/bilibili-api/pull/364
- fix: 尝试修复发送图片私信的问题 by @Drelf2018 in https://github.com/Nemo2011/bilibili-api/pull/367
Expand Down
2 changes: 1 addition & 1 deletion bilibili_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
interactive_video,
)

BILIBILI_API_VERSION = "15.5.2"
BILIBILI_API_VERSION = "15.5.3"

# 如果系统为 Windows,则修改默认策略,以解决代理报错问题
if "windows" in platform.system().lower():
Expand Down
4 changes: 2 additions & 2 deletions bilibili_api/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ async def subscribe_channel(channel: Channel, credential: Credential) -> dict:
"""
api = API["channel"]["subscribe"]
data = {"id": channel.get_channel_id()}
return await Api(**api, credential=credential).update_data(data).result
return await Api(**api, credential=credential).update_data(**data).result


async def unsubscribe_channel(channel: Channel, credential: Credential) -> dict:
Expand All @@ -313,4 +313,4 @@ async def unsubscribe_channel(channel: Channel, credential: Credential) -> dict:
"""
api = API["channel"]["unsubscribe"]
data = {"id": channel.get_channel_id()}
return await Api(**api, credential=credential).update_data(data).result
return await Api(**api, credential=credential).update_data(**data).result
8 changes: 4 additions & 4 deletions bilibili_api/cheese.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ async def send_danmaku(self, danmaku: Union[Danmaku, None] = None):
"mode": danmaku.mode,
"plat": 1,
}
return await Api(**api, credential=self.credential).update_data(data).result
return await Api(**api, credential=self.credential).update_data(**data).result

async def has_liked(self):
"""
Expand Down Expand Up @@ -686,7 +686,7 @@ async def like(self, status: bool = True):

api = API_video["operate"]["like"]
data = {"aid": self.get_aid(), "like": 1 if status else 2}
return await Api(**api, credential=self.credential).update_data(data).result
return await Api(**api, credential=self.credential).update_data(**data).result

async def pay_coin(self, num: int = 1, like: bool = False):
"""
Expand All @@ -712,7 +712,7 @@ async def pay_coin(self, num: int = 1, like: bool = False):
"multiply": num,
"like": 1 if like else 0,
}
return await Api(**api, credential=self.credential).update_data(data).result
return await Api(**api, credential=self.credential).update_data(**data).result

async def set_favorite(
self, add_media_ids: List[int] = [], del_media_ids: List[int] = []
Expand Down Expand Up @@ -741,7 +741,7 @@ async def set_favorite(
"add_media_ids": ",".join(map(lambda x: str(x), add_media_ids)),
"del_media_ids": ",".join(map(lambda x: str(x), del_media_ids)),
}
return await Api(**api, credential=self.credential).update_data(data).result
return await Api(**api, credential=self.credential).update_data(**data).result

async def get_danmaku_xml(self):
"""
Expand Down
1 change: 0 additions & 1 deletion bilibili_api/data/api/dynamic.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@
"url": "https://api.vc.bilibili.com/dynamic_draft/v1/dynamic_draft/get_drafts",
"method": "GET",
"verify": false,
"params": null,
"comment": "获取待发送定时动态列表"
},
"publish_now": {
Expand Down
1 change: 0 additions & 1 deletion bilibili_api/data/api/favorite-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"ps":"int: 每页数量",
"up_mid":"int: 用户 UID"
},
"#": "jsonp",
"comment": "获取自己的收藏/订阅的收藏夹/合集"
}
},
Expand Down
4 changes: 0 additions & 4 deletions bilibili_api/data/api/live.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,12 @@
"url": "https://api.live.bilibili.com/room/v1/Area/getList",
"method": "GET",
"verify": false,
"params": null,
"comment": "获取直播间分区信息"
},
"user_info": {
"url": "https://api.live.bilibili.com/xlive/web-ucenter/user/get_user_info",
"method": "GET",
"verify": true,
"params": null,
"comment": "获取直播用户等级等信息"
},
"user_guards": {
Expand All @@ -87,7 +85,6 @@
"url": "https://api.live.bilibili.com/xlive/web-room/v1/gift/bag_list",
"method": "GET",
"verify": "true",
"params": null,
"comment": "获取自己的礼物包裹"
},
"dahanghai": {
Expand Down Expand Up @@ -130,7 +127,6 @@
"url": "https://api.live.bilibili.com/xlive/web-ucenter/user/live_info",
"method": "GET",
"verify": false,
"params": null,
"comment": "获取自己粉丝牌,粉丝勋章,大航海等数据"
},
"general_info": {
Expand Down
2 changes: 1 addition & 1 deletion bilibili_api/data/api/rank.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"operate": {
"subscribe": {
"url": "https://api.bilibili.com/x/copyright-music-publicity/toplist/subscribe/update",
"method": "GET",
"method": "POST",
"verify": false,
"params": {
"list_id": "int: 1",
Expand Down
4 changes: 2 additions & 2 deletions bilibili_api/interactive_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,10 @@ async def get_graph_version(self) -> int:
cid = page_list[0]["cid"]

# 获取剧情图版本号
api = "https://api.bilibili.com/x/player/v2"
url = "https://api.bilibili.com/x/player/v2"
params = {"bvid": bvid, "cid": cid}

resp = await Api(**api, credential=credential).update_params(**params).result
resp = await Api(method="GET", url=url, credential=credential).update_params(**params).result
return resp["interaction"]["graph_version"]

async def get_edge_info(self, edge_id: Union[int, None] = None):
Expand Down
2 changes: 1 addition & 1 deletion bilibili_api/rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ async def get_live_sailing_rank() -> dict:
dict: 调用 API 返回的结果
"""
api = API["info"]["live_sailing_rank"]
return await Api(**api).result
return await Api(**api).update_params(**{}).result


async def get_live_energy_user_rank(
Expand Down
8 changes: 4 additions & 4 deletions bilibili_api/utils/network_httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,31 +191,31 @@ def update_data(self, **kwargs) -> "Api":
"""
毫无亮点的更新 data
"""
self.data.update(kwargs)
self.data = kwargs
self.__result = None
return self

def update_params(self, **kwargs) -> "Api":
"""
毫无亮点的更新 params
"""
self.params.update(kwargs)
self.params = kwargs
self.__result = None
return self

def update_files(self, **kwargs) -> "Api":
"""
毫无亮点的更新 files
"""
self.files.update(kwargs)
self.files = kwargs
self.__result = None
return self

def update_headers(self, **kwargs) -> "Api":
"""
毫无亮点的更新 headers
"""
self.headers.update(kwargs)
self.headers = kwargs
self.__result = None
return self

Expand Down
4 changes: 2 additions & 2 deletions bilibili_api/video_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def subscribe_tag(self) -> dict:
api = API_video["operate"]["subscribe_tag"]

data = {"tag_id": self.__tag_id}
return await Api(**api, credential=self.credential).update_data(data).result
return await Api(**api, credential=self.credential).update_data(**data).result

async def unsubscribe_tag(self) -> dict:
"""
Expand All @@ -125,4 +125,4 @@ async def unsubscribe_tag(self) -> dict:
api = API_video["operate"]["unsubscribe_tag"]

data = {"tag_id": self.__tag_id}
return await Api(**api, credential=self.credential).update_data(data).result
return await Api(**api, credential=self.credential).update_data(**data).result
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="bilibili-api-python",
version="15.5.2",
version="15.5.3",
license="GPLv3+",
author="Nemo2011",
author_email="[email protected]",
Expand Down

0 comments on commit d184c03

Please sign in to comment.