mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-05-31 16:16:11 +08:00
🔀 merge main
This commit is contained in:
commit
40f4490b74
@ -1,6 +1,6 @@
|
||||
# Change Log
|
||||
|
||||
## 最近更新
|
||||
## v0.9.5
|
||||
|
||||
### 新功能
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
### Bug 修复
|
||||
|
||||
- 🐛 修复微博更换长内容接口 [@phidiaLam](https://github.com/phidiaLam) ([#645](https://github.com/MountainDash/nonebot-bison/pull/645))
|
||||
- :bug: 修复B站获取匿名Cookie逻辑 [@suyiiyii](https://github.com/suyiiyii) ([#644](https://github.com/MountainDash/nonebot-bison/pull/644))
|
||||
|
||||
### 文档
|
||||
|
@ -176,7 +176,7 @@ class Weibo(NewMessage):
|
||||
try:
|
||||
client = await self.ctx.get_client()
|
||||
weibo_info = await client.get(
|
||||
"https://m.weibo.cn/statuses/show",
|
||||
"https://m.weibo.cn/statuses/extend",
|
||||
params={"id": weibo_id},
|
||||
headers=_HEADER,
|
||||
)
|
||||
@ -190,7 +190,7 @@ class Weibo(NewMessage):
|
||||
|
||||
async def _parse_weibo(self, info: dict) -> Post:
|
||||
if info["isLongText"] or info["pic_num"] > 9:
|
||||
info["text"] = (await self._get_long_weibo(info["mid"]))["text"]
|
||||
info["text"] = (await self._get_long_weibo(info["mid"]))["longTextContent"]
|
||||
parsed_text = self._get_text(info["text"])
|
||||
raw_pics_list = info.get("pics", [])
|
||||
pic_urls = [img["large"]["url"] for img in raw_pics_list]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "nonebot-bison"
|
||||
version = "0.9.4"
|
||||
version = "0.9.5"
|
||||
description = "Subscribe message from social medias"
|
||||
authors = ["felinae98 <felinae225@qq.com>"]
|
||||
license = "MIT"
|
||||
|
11497
tests/platforms/static/weibo_detail_4645748019299849
vendored
11497
tests/platforms/static/weibo_detail_4645748019299849
vendored
File diff suppressed because it is too large
Load Diff
11501
tests/platforms/static/weibo_detail_4649031014551911
vendored
11501
tests/platforms/static/weibo_detail_4649031014551911
vendored
File diff suppressed because it is too large
Load Diff
@ -45,7 +45,7 @@ async def test_fetch_new(weibo, dummy_user_subinfo):
|
||||
from nonebot_bison.types import Target, SubUnit
|
||||
|
||||
ak_list_router = respx.get("https://m.weibo.cn/api/container/getIndex?containerid=1076036279793937")
|
||||
detail_router = respx.get("https://m.weibo.cn/statuses/show?id=4649031014551911")
|
||||
detail_router = respx.get("https://m.weibo.cn/statuses/extend?id=4649031014551911")
|
||||
ak_list_router.mock(return_value=Response(200, json=get_json("weibo_ak_list_0.json")))
|
||||
detail_router.mock(return_value=Response(200, text=get_file("weibo_detail_4649031014551911")))
|
||||
image_cdn_router.mock(Response(200, content=b""))
|
||||
@ -77,7 +77,7 @@ async def test_fetch_new(weibo, dummy_user_subinfo):
|
||||
@pytest.mark.asyncio
|
||||
@respx.mock
|
||||
async def test_fetch_repost(weibo):
|
||||
repost_detail_router = respx.get("https://m.weibo.cn/statuses/show?id=4645748019299849")
|
||||
repost_detail_router = respx.get("https://m.weibo.cn/statuses/extend?id=4645748019299849")
|
||||
repost_detail_router.mock(return_value=Response(200, text=get_file("weibo_detail_4645748019299849")))
|
||||
image_cdn_router.mock(Response(200, content=b""))
|
||||
raw_post = get_json("weibo_ak_list_1.json")["data"]["cards"][3]
|
||||
@ -121,7 +121,7 @@ async def test_fetch_repost(weibo):
|
||||
@pytest.mark.asyncio
|
||||
@respx.mock
|
||||
async def test_video_cover(weibo):
|
||||
router = respx.get("https://m.weibo.cn/statuses/show?id=4645748019299849")
|
||||
router = respx.get("https://m.weibo.cn/statuses/extend?id=4645748019299849")
|
||||
router.mock(return_value=Response(200, text=get_file("weibo_detail_4645748019299849")))
|
||||
image_cdn_router.mock(Response(200, content=b""))
|
||||
raw_post = get_json("weibo_ak_list_1.json")["data"]["cards"][0]
|
||||
@ -152,7 +152,7 @@ async def test_classification(weibo):
|
||||
@pytest.mark.asyncio
|
||||
@respx.mock
|
||||
async def test_parse_long(weibo):
|
||||
detail_router = respx.get("https://m.weibo.cn/statuses/show?id=4645748019299849")
|
||||
detail_router = respx.get("https://m.weibo.cn/statuses/extend?id=4645748019299849")
|
||||
detail_router.mock(return_value=Response(200, text=get_file("weibo_detail_4645748019299849")))
|
||||
raw_post = get_json("weibo_ak_list_1.json")["data"]["cards"][0]
|
||||
post = await weibo.parse(raw_post)
|
||||
|
Loading…
x
Reference in New Issue
Block a user