merge upstream

This commit is contained in:
Azide 2022-05-16 17:24:40 +08:00
commit abb0dd5746
33 changed files with 5087 additions and 4731 deletions

View File

@ -14,10 +14,10 @@ workflows:
pre-steps:
- run:
command: |
if [ -z "${CIRCLE_PULL_REQUEST##*/}" ]
if [[ -n "${CIRCLE_PULL_REQUEST##*/}" && ${CIRCLE_BRANCH} =~ "pull/" ]]
then
IS_PR=false
else
IS_PR=true
else
IS_PR=false
fi
echo '{ "is_pr": '$IS_PR' }' >> /home/circleci/params.json

View File

@ -90,13 +90,13 @@ workflows:
filters:
tags:
ignore: /.*/
tag: ${CIRCLE_BRANCH}
tag: ${CIRCLE_BRANCH//\//-}
cache_from: '$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME:${CIRCLE_BRANCH}'
- docker/publish:
<<: *docker-push
dockerfile: docker/Dockerfile_with_frontend_sentry
name: "docker/publish-sentry"
tag: sentry,${CIRCLE_TAG}-sentry
tag: sentry,${CIRCLE_TAG//\//-}-sentry
cache_from: '$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME:sentry'
- docker/publish:
<<: *docker-push
@ -107,7 +107,7 @@ workflows:
only: [main, dev]
tags:
ignore: /.*/
tag: ${CIRCLE_BRANCH}-sentry
tag: ${CIRCLE_BRANCH//\//-}-sentry
cache_from: '$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME:${CIRCLE_BRANCH}-sentry'
jobs:
@ -159,9 +159,9 @@ jobs:
# - run: sed -e '41,45d' -i pyproject.toml
- python/install-packages:
pkg-manager: poetry
- run:
name: Install browser
command: poetry run playwright install-deps && poetry run playwright install chromium
# - run:
# name: Install browser
# command: poetry run playwright install-deps && poetry run playwright install chromium
- run:
name: Coverage test
command: poetry run pytest --cov-report html --cov-report xml --cov=./src/plugins/nonebot_bison --junitxml=test-results/junit.xml
@ -213,5 +213,6 @@ jobs:
name: Publish to Github Release
command: |
go install github.com/tcnksm/ghr@latest
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./dist
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} \
-delete ${CIRCLE_TAG} -n ${CIRCLE_TAG} -b $(git log --format=%B -n 1 $CIRCLE_SHA1) ./dist

1
.gitignore vendored
View File

@ -22,6 +22,7 @@
__pycache__/
*.py[cod]
*$py.class
venv_test/
# C extensions
*.so

View File

@ -11,12 +11,12 @@ repos:
- id: isort
- repo: https://github.com/psf/black
rev: 22.1.0
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v2.6.2
hooks:
- id: prettier
types_or: [markdown, ts, tsx]

View File

@ -66,5 +66,19 @@
## [0.5.1]
- 使用了新的私聊进行群管理的方式
- 使用了新的私聊进行群管理的方式:从`管理-*`替换为`群管理`命令
- 默认关闭自动重发功能
- 添加了 [推送消息合并转发功能](https://nonebot-bison.vercel.app/usage/#%E9%85%8D%E7%BD%AE)
- 添加了`添加订阅`命令事件的中途取消功能
- 优化了`添加订阅`命令的聊天处理逻辑
## [0.5.2]
- 修复了微博获取全文时接口失效的问题
- 修复了 bilibili 空列表时的报错
## [0.5.3]
- 可以发送转发微博中原微博的图片
- 优化了删除订阅时的相关问题
- 添加泰拉记事社的订阅

View File

@ -28,8 +28,18 @@
支持的平台:
- 微博
- 图文
- 视频
- 纯文字
- Bilibili
- 视频
- 图文
- 专栏
- 转发
- 纯文字
- RSS
- 富文本转换为纯文本
- 提取出所有图片
- 明日方舟
- 塞壬唱片新闻
- 游戏内公告
@ -37,6 +47,8 @@
- 网易云音乐
- 歌手发布新专辑
- 电台更新
- FF14
- 游戏公告
## 功能
@ -68,6 +80,10 @@ yarn && yarn build
`COMMAND_START=["/"]`则应发送`/添加订阅`
3. 微博漏订阅了
微博更新了新的风控措施,某些含有某些关键词的微博会获取不到。
4. 无法使用后台管理页面
1. 确认自己正确配置了 nonebot 的端口,如果在远程或容器外访问网页请确保`HOST=0.0.0.0`
2. 确认自己的云服务器的防火墙配置正确
3. 确认自己使用了正确的方法安装插件
## 参与开发

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -2,8 +2,9 @@
home: true
heroText: Nonebot Bison
tagline: 本bot励志做全泰拉骑车最快的信使
actionText: 快速部署
actionLink: /usage/
actions:
- text: 快速部署
link: /usage/
features:
- title: 拓展性强
details: 没有自己想要的网站?只要简单的爬虫知识就可以给它适配一个新的网站

View File

@ -2,7 +2,32 @@
sidebar: auto
---
# 开发指南
# 基本开发须知
## 语言以及工具
1. 本项目使用了`python3.9`的特性进行开发,所以请确保你的 Python 版本>=3.9
2. 本项目使用 poetry 进行依赖管理,请确保开发之前已经进行过`poetry install`,运行时在`poetry shell`的环境中进行运行
3. 本项目使用的 node 项目管理工具是 yarn
## 前端
本项目使用了前端,如果单独 clone 仓库本身,里面是**不包含**编译过的前端的,请使用`yarn && yarn build`进行前端的构建。
如果想要开发前端,推荐在`.env.dev`中加入`BISON_OUTER_URL="http://localhost:3000/bison/"`,然后分别运行 bot 和`yarn dev`
::: warning
请在开发前端的时候删除项目根目录中的`node_modules`,否则编译和运行的时候可能会出现奇怪的问题。
:::
## 文档
文档的相关部分在`docs`目录中,可以在项目根目录执行`yarn docs:dev`预览文件更改效果。
## 代码格式
本项目使用了 pre-commit 来进行代码美化和格式化。在`poetry shell`状态下执行`pre-commit install`来安装 git hook可自动在 commit 时
格式化代码。
# 适配新网站
本插件需要你的帮助!只需要会写简单的爬虫,就能给本插件适配新的网站。

View File

@ -88,7 +88,7 @@ sidebar: auto
1. 安装 pip 包`nonebot-bison`
2. 在`bot.py`中导入插件`nonebot_bison`
### 自动安装
#### 使用 nb-cli 安装
使用`nb-cli`执行:`nb plugin install nonebot_bison`
@ -111,6 +111,9 @@ sidebar: auto
默认`True`
- `BISON_OUTER_URL`: 从外部访问服务器的地址,默认为`http://localhost:8080/bison`,如果你的插件部署
在服务器上,建议配置为`http://<你的服务器ip>:8080/bison`
::: warning
如果需要从外网或者 Docker 容器外访问后台页面,请确保`HOST=0.0.0.0`
:::
- `BISON_FILTER_LOG`: 是否过滤来自`nonebot`的 warning 级以下的 log如果你的 bot 只运行了这个插件可以考虑
开启,默认关
- `BISON_USE_QUEUE`: 是否用队列的方式发送消息,降低发送频率,默认开
@ -124,9 +127,9 @@ sidebar: auto
::: details 配置项示例
- 当`BISON_USE_PIC_MERGE=1`时:
![simple1](./pic/forward-msg-simple1.png)
![simple1](/images/forward-msg-simple1.png)
- 当`BISON_USE_PIC_MERGE=2`时:
![simple1](./pic/forward-msg-simple2.png)
![simple1](/images/forward-msg-simple2.png)
:::
::: warning
@ -149,27 +152,33 @@ sidebar: auto
所有命令都需要@bot 触发
- 添加订阅(仅管理员和群主和 SUPERUSER`添加订阅`
::: tip 关于中止订阅
对于[**v0.5.1**](https://github.com/felinae98/nonebot-bison/releases/tag/v0.5.1)及以上的版本中,已经为`添加订阅`命令添加了中止订阅的功能。
在添加订阅命令的~~几乎~~各个阶段,都可以向 Bot 发送`取消`消息来中止订阅过程(需要订阅发起者本人发送)
:::
- 查询订阅:`查询订阅`
- 删除订阅(仅管理员和群主和 SUPERUSER`删除订阅`
#### 私聊机器人获取后台地址
`后台管理`,之后点击返回的链接
如果你是 superuser那么你可以管理所有群的订阅如果你是 bot 所在的群的其中部分群的管理,
你可以管理你管理的群里的订阅;如果你不是任意一个群的管理,那么 bot 将会报错。
如果你是 superuser那么你可以管理所有群的订阅
如果你是 bot 所在的群的其中部分群的管理,你可以管理你管理的群里的订阅;
如果你不是任意一个群的管理,那么 bot 将会报错。
::: tip
可以和 bot 通过临时聊天触发
:::
::: warning
网页的身份鉴别机制全部由 bot 返回的链接确定,所以这个链接并不能透露给别人。
网页的身份鉴别机制全部由 bot 返回的链接确定,所以这个链接并不能透露给别人。
并且链接会过期,所以一段时间后需要重新私聊 bot 获取新的链接。
:::
#### 私聊机器人进行配置(需要 SUPERUER 权限)
- 添加订阅:`管理-添加订阅`
- 查询订阅:`管理-查询订阅`
- 删除订阅:`管理-删除订阅`
请私聊 bot`群管理`
::: tip 关于中止订阅
与普通的[`添加订阅`](#在本群中进行配置)命令一样,在`群管理`命令中使用的`添加订阅`命令也可以使用`取消`来中止订阅过程
:::
### 所支持平台的 uid

741
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-bison"
version = "0.5.0"
version = "0.5.2"
description = "Subscribe message from social medias"
authors = ["felinae98 <felinae225@qq.com>"]
license = "MIT"

View File

@ -1,5 +1,4 @@
import asyncio
from asyncio.tasks import Task
from datetime import datetime
from typing import Optional, Type
@ -12,7 +11,7 @@ from nonebot.internal.params import ArgStr
from nonebot.internal.rule import Rule
from nonebot.log import logger
from nonebot.matcher import Matcher
from nonebot.params import Depends, EventMessage, EventPlainText, EventToMe, EventType
from nonebot.params import Depends, EventPlainText, EventToMe
from nonebot.permission import SUPERUSER
from nonebot.rule import to_me
from nonebot.typing import T_State
@ -245,38 +244,46 @@ def do_del_sub(del_sub: Type[Matcher]):
config: Config = Config()
user_info = state["target_user_info"]
assert isinstance(user_info, User)
sub_list = config.list_subscribe(
# state.get("_user_id") or event.group_id, "group"
user_info.user,
user_info.user_type,
)
res = "订阅的帐号为:\n"
state["sub_table"] = {}
for index, sub in enumerate(sub_list, 1):
state["sub_table"][index] = {
"target_type": sub["target_type"],
"target": sub["target"],
}
res += "{} {} {} {}\n".format(
index, sub["target_type"], sub["target_name"], sub["target"]
try:
sub_list = config.list_subscribe(
# state.get("_user_id") or event.group_id, "group"
user_info.user,
user_info.user_type,
)
platform = platform_manager[sub["target_type"]]
if platform.categories:
res += " [{}]".format(
", ".join(
map(lambda x: platform.categories[Category(x)], sub["cats"])
)
assert sub_list
except AssertionError:
await del_sub.finish("暂无已订阅账号\n请使用“添加订阅”命令添加订阅")
else:
res = "订阅的帐号为:\n"
state["sub_table"] = {}
for index, sub in enumerate(sub_list, 1):
state["sub_table"][index] = {
"target_type": sub["target_type"],
"target": sub["target"],
}
res += "{} {} {} {}\n".format(
index, sub["target_type"], sub["target_name"], sub["target"]
)
if platform.enable_tag:
res += " {}".format(", ".join(sub["tags"]))
res += "\n"
res += "请输入要删除的订阅的序号"
await bot.send(event=event, message=Message(await parse_text(res)))
platform = platform_manager[sub["target_type"]]
if platform.categories:
res += " [{}]".format(
", ".join(
map(lambda x: platform.categories[Category(x)], sub["cats"])
)
)
if platform.enable_tag:
res += " {}".format(", ".join(sub["tags"]))
res += "\n"
res += "请输入要删除的订阅的序号\n输入'取消'中止"
await bot.send(event=event, message=Message(await parse_text(res)))
@del_sub.receive()
async def do_del(event: Event, state: T_State):
user_msg = str(event.get_message()).strip()
if user_msg == "取消":
await del_sub.finish("删除中止")
try:
index = int(str(event.get_message()).strip())
index = int(user_msg)
config = Config()
user_info = state["target_user_info"]
assert isinstance(user_info, User)
@ -317,12 +324,19 @@ del_sub_matcher = on_command(
del_sub_matcher.handle()(set_target_user_info)
do_del_sub(del_sub_matcher)
group_manage_matcher = on_command("群管理",rule=to_me(),permission=SUPERUSER,priority=4)
group_manage_matcher = on_command("群管理", rule=to_me(), permission=SUPERUSER, priority=4)
@group_manage_matcher.handle()
async def send_group_list(bot: Bot, event: GroupMessageEvent, state: T_State):
await group_manage_matcher.finish(Message("该功能只支持私聊使用请私聊Bot"))
@group_manage_matcher.handle()
async def send_group_list_private(bot: Bot, event: GroupMessageEvent, state: T_State):
await group_manage_matcher.finish(Message("该功能只支持私聊使用请私聊Bot"))
@group_manage_matcher.handle()
async def send_group_list(bot: Bot, event: PrivateMessageEvent, state: T_State):
groups = await bot.call_api("get_group_list")
@ -381,13 +395,13 @@ async def do_dispatch_command(
"message",
Rule(),
permission,
None,
True,
handlers=None,
temp=True,
priority=0,
block=True,
plugin=matcher.plugin,
module=matcher.module,
expire_time=datetime.now() + bot.config.session_expire_timeout,
expire_time=datetime.now(),
default_state=matcher.state,
default_type_updater=matcher.__class__._default_type_updater,
default_permission_updater=matcher.__class__._default_permission_updater,
@ -400,34 +414,3 @@ async def do_dispatch_command(
do_del_sub(new_matcher)
new_matcher_ins = new_matcher()
asyncio.create_task(new_matcher_ins.run(bot, event, state))
test_matcher = on_command("testtt")
@test_matcher.handle()
async def _handler(bot: Bot, event: Event, matcher: Matcher, state: T_State):
permission = await matcher.update_permission(bot, event)
new_matcher = Matcher.new(
"message",
Rule(),
permission,
None,
True,
priority=0,
block=True,
plugin=matcher.plugin,
module=matcher.module,
expire_time=datetime.now() + bot.config.session_expire_timeout,
default_state=matcher.state,
default_type_updater=matcher.__class__._default_type_updater,
default_permission_updater=matcher.__class__._default_permission_updater,
)
async def h():
logger.warning("yes")
await new_matcher.send("666")
new_matcher.handle()(h)
new_matcher_ins = new_matcher()
await new_matcher_ins.run(bot, event, state)

View File

@ -189,3 +189,47 @@ class MonsterSiren(NewMessage):
compress=True,
override_use_pic=False,
)
class TerraHistoricusComic(NewMessage):
categories = {4: "泰拉记事社漫画"}
platform_name = "arknights"
name = "明日方舟游戏信息"
enable_tag = False
enabled = True
is_common = False
schedule_type = "interval"
schedule_kw = {"seconds": 30}
has_target = False
async def get_target_name(self, _: Target) -> str:
return "明日方舟游戏信息"
async def get_sub_list(self, _) -> list[RawPost]:
async with httpx.AsyncClient() as client:
raw_data = await client.get(
"https://terra-historicus.hypergryph.com/api/recentUpdate"
)
return raw_data.json()["data"]
def get_id(self, post: RawPost) -> Any:
return f'{post["comicCid"]}/{post["episodeCid"]}'
def get_date(self, _) -> None:
return None
def get_category(self, _) -> Category:
return Category(4)
async def parse(self, raw_post: RawPost) -> Post:
url = f'https://terra-historicus.hypergryph.com/comic/{raw_post["comicCid"]}/episode/{raw_post["episodeCid"]}'
return Post(
"terra-historicus",
text=f'{raw_post["title"]} - {raw_post["episodeShortTitle"]}',
pics=[raw_post["coverUrl"]],
url=url,
target_name="泰拉记事社漫画",
compress=True,
override_use_pic=False,
)

View File

@ -47,7 +47,7 @@ class Bilibili(NewMessage):
)
res_dict = json.loads(res.text)
if res_dict["code"] == 0:
return res_dict["data"]["cards"]
return res_dict["data"].get("cards")
else:
return []

View File

@ -123,14 +123,18 @@ class Weibo(NewMessage):
"Mobile Safari/537.36",
}
info = raw_post["mblog"]
if info["isLongText"] or info["pic_num"] > 9:
retweeted = False
if info.get("retweeted_status"):
retweeted = True
pic_num = info["retweeted_status"]["pic_num"] if retweeted else info["pic_num"]
if info["isLongText"] or pic_num > 9:
async with httpx.AsyncClient() as client:
res = await client.get(
"https://m.weibo.cn/detail/{}".format(info["mid"]), headers=header
)
try:
full_json_text = re.search(
r'"status": ([\s\S]+),\s+"hotScheme"', res.text
r'"status": ([\s\S]+),\s+"call"', res.text
).group(1)
info = json.loads(full_json_text)
except:
@ -140,7 +144,12 @@ class Weibo(NewMessage):
)
)
parsed_text = self._get_text(info["text"])
pic_urls = [img["large"]["url"] for img in info.get("pics", [])]
raw_pics_list = (
info["retweeted_status"].get("pics", [])
if retweeted
else info.get("pics", [])
)
pic_urls = [img["large"]["url"] for img in raw_pics_list]
detail_url = "https://weibo.com/{}/{}".format(info["user"]["id"], info["bid"])
# return parsed_text, detail_url, pic_urls
return Post(

View File

@ -24,7 +24,7 @@ class Post:
pics: list[Union[str, bytes]] = field(default_factory=list)
extra_msg: list[Message] = field(default_factory=list)
_message: Optional[list] = None
_message: Optional[list[Message]] = None
def _use_pic(self):
if not self.override_use_pic is None:
@ -107,10 +107,10 @@ class Post:
self.pics = self.pics[matrix[0] * matrix[1] :]
self.pics.insert(0, target_io.getvalue())
async def generate_messages(self):
async def generate_messages(self) -> list[Message]:
if self._message is None:
await self._pic_merge()
msgs = []
msg_segments: list[MessageSegment] = []
text = ""
if self.text:
if self._use_pic():
@ -123,22 +123,24 @@ class Post:
if self.target_name:
text += " {}".format(self.target_name)
if self._use_pic():
msgs.append(await parse_text(text))
msg_segments.append(await parse_text(text))
if not self.target_type == "rss" and self.url:
msgs.append(MessageSegment.text(self.url))
msg_segments.append(MessageSegment.text(self.url))
else:
if self.url:
text += " \n详情: {}".format(self.url)
msgs.append(MessageSegment.text(text))
msg_segments.append(MessageSegment.text(text))
for pic in self.pics:
# if isinstance(pic, bytes):
# pic = 'base64://' + base64.b64encode(pic).decode()
# msgs.append(Message("[CQ:image,file={url}]".format(url=pic)))
msgs.append(MessageSegment.image(pic))
msg_segments.append(MessageSegment.image(pic))
if self.compress:
msgs = [reduce(lambda x, y: x.append(y), msgs, Message())]
msgs = [reduce(lambda x, y: x.append(y), msg_segments, Message())]
else:
msgs = list(
map(lambda msg_segment: Message([msg_segment]), msg_segments)
)
msgs.extend(self.extra_msg)
self._message = msgs
assert len(self._message) > 0, f"message list empty, {self}"
return self._message
def __str__(self):

View File

@ -17,6 +17,18 @@ scheduler = AsyncIOScheduler(timezone="Asia/Shanghai")
@get_driver().on_startup
async def _start():
for platform_name, platform in platform_manager.items():
if platform.schedule_type in ["cron", "interval", "date"]:
logger.info(
f"start scheduler for {platform_name} with {platform.schedule_type} {platform.schedule_kw}"
)
scheduler.add_job(
fetch_and_send,
platform.schedule_type,
**platform.schedule_kw,
args=(platform_name,),
)
scheduler.configure({"apscheduler.timezone": "Asia/Shanghai"})
scheduler.start()
@ -65,19 +77,6 @@ async def fetch_and_send(target_type: str):
)
for platform_name, platform in platform_manager.items():
if platform.schedule_type in ["cron", "interval", "date"]:
logger.info(
f"start scheduler for {platform_name} with {platform.schedule_type} {platform.schedule_kw}"
)
scheduler.add_job(
fetch_and_send,
platform.schedule_type,
**platform.schedule_kw,
args=(platform_name,),
)
class CustomLogHandler(LoguruHandler):
def filter(self, record: logging.LogRecord):
return record.msg != (

View File

@ -1,5 +1,5 @@
from email import message
import time
from email import message
from typing import List, Literal, Union
from nonebot.adapters.onebot.v11.bot import Bot
@ -33,23 +33,19 @@ async def _do_send(
elif user_type == "group-forward":
await bot.send_group_forward_msg(group_id=user, messages=msg)
async def _do_send_forward(
bot: "Bot", user: str, msgs: list
):
async def _do_send_forward(bot: "Bot", user: str, msgs: list):
group_msg = []
bot_info = await bot.call_api("get_login_info")#猜测返回list 第一个为user_id第二个为nickname
bot_info = await bot.call_api("get_login_info") # 猜测返回list 第一个为user_id第二个为nickname
for msg in msgs:
sub_msg = {
"type": "node",
"data": {
"name": f"{bot_info[0]}",
"uin": f"{bot_info[1]}",
"content": msg
}
"data": {"name": f"{bot_info[0]}", "uin": f"{bot_info[1]}", "content": msg},
}
group_msg.append(sub_msg)
await bot.call_api("send_group_forward_msg", group_id=user, message=group_msg)
async def do_send_msgs():
global LAST_SEND_TIME
if time.time() - LAST_SEND_TIME < 1.5:
@ -81,11 +77,14 @@ async def _send_msgs_dispatch(
await _do_send(bot, user, user_type, msg)
async def send_msgs(bot: Bot, user, user_type: Literal["private", "group"], msgs: list):
async def send_msgs(
bot: Bot, user, user_type: Literal["private", "group"], msgs: list[Message]
):
if not plugin_config.bison_use_pic_merge or user_type == "private":
for msg in msgs:
await _send_msgs_dispatch(bot, user, user_type, msg)
return
msgs = msgs.copy()
if plugin_config.bison_use_pic_merge == 1:
await _send_msgs_dispatch(bot, user, "group", msgs.pop(0))
if msgs:
@ -95,14 +94,28 @@ async def send_msgs(bot: Bot, user, user_type: Literal["private", "group"], msgs
group_bot_info = await bot.get_group_member_info(
group_id=user, user_id=int(bot.self_id), no_cache=True
) # 调用api获取群内bot的相关参数
forward_msg = Message(
[
MessageSegment.node_custom(
group_bot_info["user_id"],
nickname=group_bot_info["card"] or group_bot_info["nickname"],
content=msg,
)
for msg in msgs
]
)
# forward_msg = Message(
# [
# MessageSegment.node_custom(
# group_bot_info["user_id"],
# nickname=group_bot_info["card"] or group_bot_info["nickname"],
# content=msg,
# )
# for msg in msgs
# ]
# )
# FIXME: Because of https://github.com/nonebot/adapter-onebot/issues/9
forward_msg = [
{
"type": "node",
"data": {
"name": group_bot_info["card"] or group_bot_info["nickname"],
"uin": group_bot_info["user_id"],
"content": msg,
},
}
for msg in msgs
]
await _send_msgs_dispatch(bot, user, "group-forward", forward_msg)

View File

@ -0,0 +1,24 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="keywords" content="明日方舟,明日方舟官网,明日方舟手游,二次元,明日方舟Arknights,魔物娘,战棋,策略,塔防,塔防RPG,Arknights,人外,Monster" />
<meta name="description" content="《明日方舟》是一款魔物主题的策略手游。在游戏中,玩家将管理一艘满载“ 魔物干员”的方舟,为调查来源神秘的矿石灾难而踏上旅途。在这个宽广而危机四伏的世界中,你或许会看到废土中的城市废墟,或许会看到仿若幻境的亚人国度,或许会遭遇无法解读的神秘,或许参与无比残酷的战争。在有关幻想与异种生命的世界中,体验史诗与想象,情感与牵绊!" />
<link rel="icon" href="data:;base64,=" />
<title>公告</title>
<link rel="stylesheet" href="../../assets/css/announcement.v_0_1_2.css" />
</head>
<body>
<div class="main">
<div class="container">
<div class="banner-image-container cover">
<a class="cover-jumper" href="uniwebview://move?target=recruit&amp;param1=NORM_24_0_1">
<img class="banner-image" src="https://ak.hycdn.cn/announce/images/20211209/ff886833a69b48e513ff911f64f6d881.JPG" />
</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,91 @@
{
"focusAnnounceId": "816",
"announceList": [
{
"announceId": "809",
"title": "冰原信使系列\n新装限时上架",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/809_1640060505.html",
"day": 21,
"month": 12,
"group": "ACTIVITY"
},
{
"announceId": "810",
"title": "寒武纪系列\n限时复刻上架",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/810_1640060511.html",
"day": 21,
"month": 12,
"group": "ACTIVITY"
},
{
"announceId": "806",
"title": "跨年欢庆·回首\n限时寻访说明",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/806_1639379808.html",
"day": 14,
"month": 12,
"group": "ACTIVITY"
},
{
"announceId": "802",
"title": "「制作组通讯」\n#15期",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/802_1638871766.html",
"day": 8,
"month": 12,
"group": "SYSTEM"
},
{
"announceId": "97",
"title": "新人寻访特惠\n必得六星干员",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/97_1606379786.html",
"day": 30,
"month": 4,
"group": "ACTIVITY"
},
{
"announceId": "95",
"title": "通关特定关卡\n赠送专属时装",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/95_1606379781.html",
"day": 30,
"month": 4,
"group": "ACTIVITY"
},
{
"announceId": "192",
"title": "《明日方舟》\n公测开启说明",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/192_1606379744.html",
"day": 30,
"month": 4,
"group": "SYSTEM"
},
{
"announceId": "98",
"title": "《明日方舟》\n公平运营申明",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/98_1638970453.html",
"day": 30,
"month": 4,
"group": "SYSTEM"
},
{
"announceId": "94",
"title": "常驻活动介绍",
"isWebUrl": true,
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/94_1606379757.html",
"day": 30,
"month": 4,
"group": "ACTIVITY"
}
],
"extra": {
"enable": false,
"name": "额外活动"
}
}

View File

@ -0,0 +1 @@
{"code":0,"msg":"","data":[{"coverUrl":"https://web.hycdn.cn/comic/pic/20220507/c4da4fb95587101f1867a30fe85cb557.png","comicCid":"6253","title":"123罗德岛","subtitle":"你可能不知道的罗德岛小剧场!","episodeCid":"5771","episodeType":1,"episodeShortTitle":"「流明」篇","updateTime":1652025600},{"coverUrl":"https://web.hycdn.cn/comic/pic/20220505/5c296539f5dc808603f20dda86879c9c.png","comicCid":"0696","title":"A1行动预备组","subtitle":"","episodeCid":"2897","episodeType":1,"episodeShortTitle":"01","updateTime":1651852800},{"coverUrl":"https://web.hycdn.cn/comic/pic/20220428/f4dc1e91420d18eccb80d60bba322d42.png","comicCid":"6253","title":"123罗德岛","subtitle":"你可能不知道的罗德岛小剧场!","episodeCid":"6346","episodeType":1,"episodeShortTitle":"「艾丽妮」篇","updateTime":1651507200}]}

View File

@ -0,0 +1 @@
{"code":0,"msg":"","data":[{"coverUrl":"https://web.hycdn.cn/comic/pic/20220507/ab8a2ff408ec7d587775aed70b178ec0.png","comicCid":"6253","title":"123罗德岛","subtitle":"你可能不知道的罗德岛小剧场!","episodeCid":"4938","episodeType":1,"episodeShortTitle":"「掠风」篇","updateTime":1652112000},{"coverUrl":"https://web.hycdn.cn/comic/pic/20220507/c4da4fb95587101f1867a30fe85cb557.png","comicCid":"6253","title":"123罗德岛","subtitle":"你可能不知道的罗德岛小剧场!","episodeCid":"5771","episodeType":1,"episodeShortTitle":"「流明」篇","updateTime":1652025600},{"coverUrl":"https://web.hycdn.cn/comic/pic/20220505/5c296539f5dc808603f20dda86879c9c.png","comicCid":"0696","title":"A1行动预备组","subtitle":"","episodeCid":"2897","episodeType":1,"episodeShortTitle":"01","updateTime":1651852800},{"coverUrl":"https://web.hycdn.cn/comic/pic/20220428/f4dc1e91420d18eccb80d60bba322d42.png","comicCid":"6253","title":"123罗德岛","subtitle":"你可能不知道的罗德岛小剧场!","episodeCid":"6346","episodeType":1,"episodeShortTitle":"「艾丽妮」篇","updateTime":1651507200}]}

View File

@ -15,7 +15,7 @@
<style>html, body {margin: 0 !important;padding: 0 !important;}html, body, #app {height: 100%;}[v-cloak] {display: none;}.wb-item-wrap .card9.card{margin:0}.f-weibo .m-img-box{background-color:#e6e6e6}.empty-bg{width:100%;background-color:#e6e6e6;height:.375rem}.inline-block{display:inline-block}.txt-margin{margin:0 0 1rem 0}.width-min{width:4.375rem}.anim-load{animation:load .5s ease-out;-moz-animation:load .5s ease-out;-webkit-animation:load .5s ease-out;-o-animation:load .5s ease-out}@keyframes load{0%{background-color:#fff}100%{background-color:#e6e6e6}}@-moz-keyframes load{0%{background-color:#fff}100%{background-color:#e6e6e6}}@-webkit-keyframes load{0%{background-color:#fff}100%{background-color:#e6e6e6}}.f-more{letter-spacing:.1rem}.f-weibo .f-card-title{margin:-1rem -1rem .5rem -1rem;padding:0 1rem;border-width:0}.f-weibo .m-avatar-box .m-img-box .m-icon{font-size:14px}.iosx3 .card9 .f-card-title{border-width:0}.iosx2 .card9 .f-card-title{border-width:0}.f-weibo.card9{border-bottom:1px solid #e6e6e6}.iosx3 .f-weibo.card9{border-bottom:.36px solid #e6e6e6}.iosx2 .f-weibo.card9{border-bottom:.5px solid #e6e6e6}.f-weibo.card9>.card-wrap{margin-left:.75rem;margin-right:.75rem}.f-weibo.card9.m-panel{border-top-width:0}.f-weibo.card .card-wrap .f-col-wrap{padding:0 .9375rem}.f-weibo.card9 .m-box-col{min-width:0}.f-weibo.card9 .weibo-top{padding:0 0 0 .25rem}.f-weibo.card9 .weibo-top .m-box-col .m-icon{margin-left:3px}.f-weibo.card9 .weibo-main .weibo-og{padding:.75rem 0 0 .25rem}.f-weibo.card9 .weibo-main .card-wrap ~ .weibo-rp{margin-top:0.5rem}.f-weibo.card9 .weibo-main .media-b{margin:.625rem 0 -.375rem}.f-weibo.card9 .weibo-main .media-b .m-auto-list{margin:0 0 -.25rem}.f-weibo .weibo-top .m-text-box{margin:.15rem 0 .15rem .5rem}.f-weibo .f-r{float:right}.f-weibo .weibo-main .weibo-og{font-size:.9375rem}.f-weibo .weibo-rp .weibo-text{font-size:.9375rem}.f-weibo .weibo-rp .f-footer-ctrl{padding:0.625rem 0 0}.f-weibo .f-bg-img{background-size:cover;background-repeat:no-repeat;background-position:center;position:absolute;width:100%;height:100%}.f-footer-ctrl{border-top-width:0;height:1.1rem;padding: 1rem .375rem 1rem 0;margin: 0 0.75rem}.f-footer-ctrl .m-diy-btn{color:rgba(40,47,60,0.8);height:100%;float:left}.f-footer-ctrl .m-diy-btn+.m-diy-btn{margin-left:1.6875rem}.f-footer-ctrl .m-diy-btn .m-icon{font-size:16px}.f-footer-ctrl aside{float:right;color:rgba(40,47,60,0.8)}.f-footer-ctrl .m-font{font-size:1rem;vertical-align:middle}.f-footer-ctrl .m-diy-btn h4{font-size:.8125rem;display:inline-block;margin-top:0;margin-left:.25rem}.dbfalls a {color: #333;}.dbfalls .m-icon-like {filter: contrast(0);}</style>
<style>
</style>
<link href="//h5.sinaimg.cn/m/weibo-lite/css/app.952c2508.css" rel="preload" as="style"><link href="//h5.sinaimg.cn/m/weibo-lite/css/vendor.d90db39c.css" rel="preload" as="style"><link href="//h5.sinaimg.cn/m/weibo-lite/js/app.fd9603ad.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/js/manifest.5ecace0f.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/js/vendor.36b3e5f0.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/css/vendor.d90db39c.css" rel="stylesheet"><link href="//h5.sinaimg.cn/m/weibo-lite/css/app.952c2508.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="//h5.sinaimg.cn/m/weibo-lite/favicon-32.png"><link rel="icon" type="image/png" sizes="16x16" href="//h5.sinaimg.cn/m/weibo-lite/favicon-16.png"><link rel="manifest" href="//h5.sinaimg.cn/m/weibo-lite/manifest.json"><meta name="theme-color" content="#F3F3F3"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="微博Lite"><link rel="apple-touch-icon" href="//h5.sinaimg.cn/m/weibo-lite/appicon.png"><link rel="mask-icon" href="//h5.sinaimg.cn/m/weibo-lite/mask-icon.svg" color="#F3F3F3"><meta name="msapplication-TileImage" content="//h5.sinaimg.cn/m/weibo-lite/appicon.png"><meta name="msapplication-TileColor" content="#000000"></head>
<link href="//h5.sinaimg.cn/m/weibo-lite/css/app.2b65fef8.css" rel="preload" as="style"><link href="//h5.sinaimg.cn/m/weibo-lite/css/vendor.ed418b16.css" rel="preload" as="style"><link href="//h5.sinaimg.cn/m/weibo-lite/js/app.11a3fee7.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/js/manifest.bb6ddc12.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/js/vendor.14bfc30c.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/css/vendor.ed418b16.css" rel="stylesheet"><link href="//h5.sinaimg.cn/m/weibo-lite/css/app.2b65fef8.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="//h5.sinaimg.cn/m/weibo-lite/favicon-32.png"><link rel="icon" type="image/png" sizes="16x16" href="//h5.sinaimg.cn/m/weibo-lite/favicon-16.png"><link rel="manifest" href="//h5.sinaimg.cn/m/weibo-lite/manifest.json"><meta name="theme-color" content="#F3F3F3"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="微博Lite"><link rel="apple-touch-icon" href="//h5.sinaimg.cn/m/weibo-lite/appicon.png"><meta name="msapplication-TileColor" content="#000000"></head>
<body>
<div id="app" class="m-container-max">
@ -30,15 +30,23 @@
<script>
var config = {
env: 'prod',
version: 'v2.9.9',
version: 'v2.10.4',
login: [][0],
st: '581567',
st: '0e7c66',
uid: '',
pageConfig: [null][0] || {},
preferQuickapp: '0',
wm: ''
}
var $render_data = [{
"hotScheme": "https://m.weibo.cn/p/index?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&luicode=20000061&lfid=4645748019299849",
"appScheme": "https://m.weibo.cn?luicode=20000061&lfid=4645748019299849",
"callUinversalLink": false,
"callWeibo": false,
"schemeOrigin": false,
"appLink": "sinaweibo://detail?mblogid=4645748019299849&luicode=20000061&lfid=4645748019299849",
"xianzhi_scheme": "xianzhi://mblogshow?mid=4645748019299849",
"third_scheme": "sinaweibo://detail?mblogid=4645748019299849&luicode=20000061&lfid=4645748019299849",
"status": {
"visible": {
"type": 0,
@ -50,22 +58,20 @@
"edit_count": 2,
"can_edit": false,
"edit_at": "Wed Jun 16 10:51:10 +0800 2021",
"version": 6,
"show_additional_indication": 0,
"text": "<a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&isnewpage=1&luicode=20000061&lfid=4645748019299849\" data-hide=\"\"><span class=\"surl-text\">#明日方舟#</span></a> <a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E9%9F%B3%E5%BE%8B%E8%81%94%E8%A7%89%23&extparam=%23%E9%9F%B3%E5%BE%8B%E8%81%94%E8%A7%89%23&luicode=20000061&lfid=4645748019299849\" data-hide=\"\"><span class=\"surl-text\">#音律联觉#</span></a><br />2021明日方舟音律联觉Ambience Synesthesia专场演出官方录播将于6月12日10:30正式上线本次录播为大会员专享相关信息可关注 <a data-url=\"http://t.cn/A6VRxRhv\" href=\"http://t.cn/A6VRxRhv\" data-hide=\"\"><span class='url-icon'><img style='width: 1rem;height: 1rem' src='https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_web_default.png'></span><span class=\"surl-text\">网页链接</span></a><br /><br />一、音律联觉原声EP将于2021年6月12日正式上架塞壬唱片官网及网易云音乐敬请期待。<br />【歌曲列表】<br />1. CanNot Wait For<br />2. ManiFesto:<br />3. 灯华梦踏<br />4. 前航远歌<br /><br />二、【明日方舟·音律联觉】BILIBILI个性装扮套装即将上线相关信息可关注明日方舟BILIBILI官方账号。<br /><br />三、明日方舟音律联觉主题黑胶礼盒现已上架,详情可关注“明日方舟朝陇山”。<br /><br />关注并转发本条微博,我们将通过<a href='/n/微博抽奖平台'>@微博抽奖平台</a> 抽取十位博士送出【音律联觉主题黑胶礼盒各一套】将于6月12日开奖。<br />开奖后奖品会在出货后寄出。 <a data-url=\"http://t.cn/A6VR9W6h\" href=\"https://video.weibo.com/show?fid=1034:4645779462357001\" data-hide=\"\"><span class='url-icon'><img style='width: 1rem;height: 1rem' src='https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_video_default.png'></span><span class=\"surl-text\">明日方舟Arknights的微博视频</span></a> <a data-url=\"http://t.cn/A6Vk6ARb\" href=\"http://t.cn/A6Vk6ARb\" data-hide=\"\"><span class='url-icon'><img style='width: 1rem;height: 1rem' src='https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_web_default.png'></span><span class=\"surl-text\">抽奖详情</span></a>",
"text": "<a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&extparam=%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&luicode=20000061&lfid=4645748019299849\" data-hide=\"\"><span class=\"surl-text\">#明日方舟#</span></a> <a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E9%9F%B3%E5%BE%8B%E8%81%94%E8%A7%89%23&extparam=%23%E9%9F%B3%E5%BE%8B%E8%81%94%E8%A7%89%23&luicode=20000061&lfid=4645748019299849\" data-hide=\"\"><span class=\"surl-text\">#音律联觉#</span></a><br />2021明日方舟音律联觉Ambience Synesthesia专场演出官方录播将于6月12日10:30正式上线本次录播为大会员专享相关信息可关注 <a href=\"https://weibo.cn/sinaurl?u=http%3A%2F%2Fmrfz.biligame.com%2Fyllj%2F\" data-hide=\"\"><span class='url-icon'><img style='width: 1rem;height: 1rem' src='https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_web_default.png'></span><span class=\"surl-text\">网页链接</span></a><br /><br />一、音律联觉原声EP将于2021年6月12日正式上架塞壬唱片官网及网易云音乐敬请期待。<br />【歌曲列表】<br />1. CanNot Wait For<br />2. ManiFesto:<br />3. 灯华梦踏<br />4. 前航远歌<br /><br />二、【明日方舟·音律联觉】BILIBILI个性装扮套装即将上线相关信息可关注明日方舟BILIBILI官方账号。<br /><br />三、明日方舟音律联觉主题黑胶礼盒现已上架,详情可关注“明日方舟朝陇山”。<br /><br />关注并转发本条微博,我们将通过<a href='/n/微博抽奖平台'>@微博抽奖平台</a> 抽取十位博士送出【音律联觉主题黑胶礼盒各一套】将于6月12日开奖。<br />开奖后奖品会在出货后寄出。 <a href=\"https://video.weibo.com/show?fid=1034:4645779462357001\" data-hide=\"\"><span class='url-icon'><img style='width: 1rem;height: 1rem' src='https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_video_default.png'></span><span class=\"surl-text\">明日方舟Arknights的微博视频</span></a> <a href=\"https://lottery.media.weibo.com/lottery/h5/history/list?mid=4645748019299849\" data-hide=\"\"><span class='url-icon'><img style='width: 1rem;height: 1rem' src='https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_web_default.png'></span><span class=\"surl-text\">抽奖详情</span></a>",
"textLength": 663,
"source": "微博视频号",
"favorited": false,
"pic_ids": [],
"pic_types": "",
"is_paid": false,
"mblog_vip_type": 0,
"user": {
"id": 6279793937,
"screen_name": "明日方舟Arknights",
"profile_image_url": "https://tvax4.sinaimg.cn/crop.0.0.756.756.180/006QZngZly8gdj05mufr9j30l00l0dq4.jpg?KID=imgbed,tva&Expires=1623989141&ssig=bok%2BaSMkyI",
"profile_image_url": "https://tvax4.sinaimg.cn/crop.0.0.756.756.180/006QZngZly8gdj05mufr9j30l00l0dq4.jpg?KID=imgbed,tva&Expires=1651261093&ssig=Kt4QCJvDiS",
"profile_url": "https://m.weibo.cn/u/6279793937?uid=6279793937&luicode=20000061&lfid=4645748019299849",
"statuses_count": 1229,
"statuses_count": 1682,
"verified": true,
"verified_type": 2,
"verified_type_ext": 50,
@ -75,26 +81,28 @@
"gender": "f",
"mbtype": 12,
"urank": 4,
"mbrank": 6,
"mbrank": 7,
"follow_me": false,
"following": false,
"followers_count": 1370905,
"follow_count": 33,
"follow_count": 37,
"followers_count": "149.9万",
"followers_count_str": "149.9万",
"cover_image_phone": "https://wx4.sinaimg.cn/crop.0.0.640.640.640/006QZngZly1gq8sa16csgj30u00u0akt.jpg",
"avatar_hd": "https://wx4.sinaimg.cn/orj480/006QZngZly8gdj05mufr9j30l00l0dq4.jpg",
"like": false,
"like_me": false,
"badge": {
"user_name_certificate": 1
"user_name_certificate": 1,
"pc_new": 6,
"brand_account_2021": 2
}
},
"reposts_count": 9036,
"comments_count": 2126,
"attitudes_count": 37169,
"reposts_count": 7640,
"comments_count": 2206,
"reprint_cmt_count": 0,
"attitudes_count": 39114,
"pending_approval_count": 0,
"isLongText": true,
"reward_exhibition_type": 0,
"hide_flag": 0,
"mlevel": 0,
"darwin_tags": [
{
@ -106,14 +114,16 @@
}
],
"mblogtype": 0,
"more_info_type": 0,
"content_auth": 0,
"safe_tags": 524288,
"comment_manage_info": {
"comment_permission_type": -1,
"approval_comment_type": 0,
"comment_sort_type": 0
},
"pic_num": 0,
"fid": 4645555891339375,
"alchemy_params": {
"ug_red_envelope": false
},
"new_comment_style": 0,
"page_info": {
"type": "video",
"object_type": 11,
@ -134,16 +144,16 @@
"content1": "明日方舟Arknights的微博视频",
"content2": "#明日方舟# #音律联觉#\n2021明日方舟音律联觉Ambience Synesthesia专场演出官方录播将于6月12日10:30正式上线本次录播为大会员专享相关信息可关注 http://mrfz.biligame.com/yllj/\n\n一、音律联觉原声EP将于2021年6",
"video_orientation": "horizontal",
"play_count": "90万次播放",
"play_count": "180万次播放",
"media_info": {
"stream_url": "https://f.video.weibocdn.com/0041nQjugx07Ni6Zk3Qk01041200iTHD0E010.mp4?label=mp4_ld&template=640x360.25.0&trans_finger=40a32e8439c5409a63ccf853562a60ef&ori=0&ps=1BThihd3VLAY5R&Expires=1623981941&ssig=hSngFD8FpC&KID=unistore,video",
"stream_url_hd": "https://f.video.weibocdn.com/0013IQ0Ugx07Ni6ZE67l01041200thj80E010.mp4?label=mp4_hd&template=852x480.25.0&trans_finger=62b30a3f061b162e421008955c73f536&ori=0&ps=1BThihd3VLAY5R&Expires=1623981941&ssig=6VvgygBUL9&KID=unistore,video",
"stream_url": "https://f.video.weibocdn.com/0041nQjugx07Ni6Zk3Qk01041200iTHD0E010.mp4?label=mp4_ld&template=640x360.25.0&trans_finger=40a32e8439c5409a63ccf853562a60ef&ori=0&ps=1BThihd3VLAY5R&Expires=1651253893&ssig=Umld3VsLPh&KID=unistore,video",
"stream_url_hd": "https://f.video.weibocdn.com/0013IQ0Ugx07Ni6ZE67l01041200thj80E010.mp4?label=mp4_hd&template=852x480.25.0&trans_finger=62b30a3f061b162e421008955c73f536&ori=0&ps=1BThihd3VLAY5R&Expires=1651253893&ssig=ahb4z6%2BvPl&KID=unistore,video",
"duration": 103.1650000000000062527760746888816356658935546875
},
"urls": {
"mp4_720p_mp4": "https://f.video.weibocdn.com/004gx4yOgx07Ni70wB1601041200QZHs0E010.mp4?label=mp4_720p&template=1280x720.25.0&trans_finger=1f0da16358befad33323e3a1b7f95fc9&ori=0&ps=1BThihd3VLAY5R&Expires=1623981941&ssig=8QKq0RXs99&KID=unistore,video",
"mp4_hd_mp4": "https://f.video.weibocdn.com/0013IQ0Ugx07Ni6ZE67l01041200thj80E010.mp4?label=mp4_hd&template=852x480.25.0&trans_finger=62b30a3f061b162e421008955c73f536&ori=0&ps=1BThihd3VLAY5R&Expires=1623981941&ssig=6VvgygBUL9&KID=unistore,video",
"mp4_ld_mp4": "https://f.video.weibocdn.com/0041nQjugx07Ni6Zk3Qk01041200iTHD0E010.mp4?label=mp4_ld&template=640x360.25.0&trans_finger=40a32e8439c5409a63ccf853562a60ef&ori=0&ps=1BThihd3VLAY5R&Expires=1623981941&ssig=hSngFD8FpC&KID=unistore,video"
"mp4_720p_mp4": "https://f.video.weibocdn.com/004gx4yOgx07Ni70wB1601041200QZHs0E010.mp4?label=mp4_720p&template=1280x720.25.0&trans_finger=1f0da16358befad33323e3a1b7f95fc9&ori=0&ps=1BThihd3VLAY5R&Expires=1651253893&ssig=m8si69tT6A&KID=unistore,video",
"mp4_ld_mp4": "https://f.video.weibocdn.com/0041nQjugx07Ni6Zk3Qk01041200iTHD0E010.mp4?label=mp4_ld&template=640x360.25.0&trans_finger=40a32e8439c5409a63ccf853562a60ef&ori=0&ps=1BThihd3VLAY5R&Expires=1651253893&ssig=Umld3VsLPh&KID=unistore,video",
"mp4_hd_mp4": "https://f.video.weibocdn.com/0013IQ0Ugx07Ni6ZE67l01041200thj80E010.mp4?label=mp4_hd&template=852x480.25.0&trans_finger=62b30a3f061b162e421008955c73f536&ori=0&ps=1BThihd3VLAY5R&Expires=1651253893&ssig=ahb4z6%2BvPl&KID=unistore,video"
}
},
"bid": "Kjc77D1jz",
@ -158,25 +168,13 @@
}
],
"status_title": "明日方舟·音律联觉",
"ok": 1,
"scheme": "https://weibo.cn/appurl?scheme=sinaweibo%3A%2F%2Fdetail%3Fmblogid%3D4645748019299849%26luicode%3D20000061%26lfid%3D4645748019299849&luicode=20000061&lfid=4645748019299849",
"tipScheme": "https://weibo.cn/appurl?scheme=sinaweibo%3A%2F%2Fdetail%3Fmblogid%3D4645748019299849%26luicode%3D20000061%26lfid%3D4645748019299849&luicode=20000061&lfid=4645748019299849"
"ok": 1
},
"hotScheme": "https://m.weibo.cn/p/index?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&luicode=20000061&lfid=4645748019299849",
"appScheme": "https://m.weibo.cn?luicode=20000061&lfid=4645748019299849",
"callUinversalLink": false,
"callWeibo": false,
"hit": true,
"is_gray": 0,
"schemeOrigin": false,
"appLink": "sinaweibo://detail?mblogid=4645748019299849&luicode=20000061&lfid=4645748019299849",
"xianzhi_scheme": "xianzhi://mblogshow?mid=4645748019299849",
"third_scheme": "sinaweibo://detail?mblogid=4645748019299849&luicode=20000061&lfid=4645748019299849",
"call": "1"
"call": 1
}][0] || {};
var __wb_performance_data={v:"v8",m:"mainsite",pwa:1,sw:0};
</script>
<script src="https://h5.sinaimg.cn/upload/1005/16/2017/11/30/wbp.js" id="__wb_performance_log" data-rate="0.1"></script>
<script src="//h5.sinaimg.cn/m/weibo-lite/js/manifest.5ecace0f.js"></script><script src="//h5.sinaimg.cn/m/weibo-lite/js/vendor.36b3e5f0.js"></script><script src="//h5.sinaimg.cn/m/weibo-lite/js/app.fd9603ad.js"></script></body>
<script src="//h5.sinaimg.cn/m/weibo-lite/js/manifest.bb6ddc12.js"></script><script src="//h5.sinaimg.cn/m/weibo-lite/js/vendor.14bfc30c.js"></script><script src="//h5.sinaimg.cn/m/weibo-lite/js/app.11a3fee7.js"></script></body>
</html>

View File

@ -15,7 +15,7 @@
<style>html, body {margin: 0 !important;padding: 0 !important;}html, body, #app {height: 100%;}[v-cloak] {display: none;}.wb-item-wrap .card9.card{margin:0}.f-weibo .m-img-box{background-color:#e6e6e6}.empty-bg{width:100%;background-color:#e6e6e6;height:.375rem}.inline-block{display:inline-block}.txt-margin{margin:0 0 1rem 0}.width-min{width:4.375rem}.anim-load{animation:load .5s ease-out;-moz-animation:load .5s ease-out;-webkit-animation:load .5s ease-out;-o-animation:load .5s ease-out}@keyframes load{0%{background-color:#fff}100%{background-color:#e6e6e6}}@-moz-keyframes load{0%{background-color:#fff}100%{background-color:#e6e6e6}}@-webkit-keyframes load{0%{background-color:#fff}100%{background-color:#e6e6e6}}.f-more{letter-spacing:.1rem}.f-weibo .f-card-title{margin:-1rem -1rem .5rem -1rem;padding:0 1rem;border-width:0}.f-weibo .m-avatar-box .m-img-box .m-icon{font-size:14px}.iosx3 .card9 .f-card-title{border-width:0}.iosx2 .card9 .f-card-title{border-width:0}.f-weibo.card9{border-bottom:1px solid #e6e6e6}.iosx3 .f-weibo.card9{border-bottom:.36px solid #e6e6e6}.iosx2 .f-weibo.card9{border-bottom:.5px solid #e6e6e6}.f-weibo.card9>.card-wrap{margin-left:.75rem;margin-right:.75rem}.f-weibo.card9.m-panel{border-top-width:0}.f-weibo.card .card-wrap .f-col-wrap{padding:0 .9375rem}.f-weibo.card9 .m-box-col{min-width:0}.f-weibo.card9 .weibo-top{padding:0 0 0 .25rem}.f-weibo.card9 .weibo-top .m-box-col .m-icon{margin-left:3px}.f-weibo.card9 .weibo-main .weibo-og{padding:.75rem 0 0 .25rem}.f-weibo.card9 .weibo-main .card-wrap ~ .weibo-rp{margin-top:0.5rem}.f-weibo.card9 .weibo-main .media-b{margin:.625rem 0 -.375rem}.f-weibo.card9 .weibo-main .media-b .m-auto-list{margin:0 0 -.25rem}.f-weibo .weibo-top .m-text-box{margin:.15rem 0 .15rem .5rem}.f-weibo .f-r{float:right}.f-weibo .weibo-main .weibo-og{font-size:.9375rem}.f-weibo .weibo-rp .weibo-text{font-size:.9375rem}.f-weibo .weibo-rp .f-footer-ctrl{padding:0.625rem 0 0}.f-weibo .f-bg-img{background-size:cover;background-repeat:no-repeat;background-position:center;position:absolute;width:100%;height:100%}.f-footer-ctrl{border-top-width:0;height:1.1rem;padding: 1rem .375rem 1rem 0;margin: 0 0.75rem}.f-footer-ctrl .m-diy-btn{color:rgba(40,47,60,0.8);height:100%;float:left}.f-footer-ctrl .m-diy-btn+.m-diy-btn{margin-left:1.6875rem}.f-footer-ctrl .m-diy-btn .m-icon{font-size:16px}.f-footer-ctrl aside{float:right;color:rgba(40,47,60,0.8)}.f-footer-ctrl .m-font{font-size:1rem;vertical-align:middle}.f-footer-ctrl .m-diy-btn h4{font-size:.8125rem;display:inline-block;margin-top:0;margin-left:.25rem}.dbfalls a {color: #333;}.dbfalls .m-icon-like {filter: contrast(0);}</style>
<style>
</style>
<link href="//h5.sinaimg.cn/m/weibo-lite/css/app.952c2508.css" rel="preload" as="style"><link href="//h5.sinaimg.cn/m/weibo-lite/css/vendor.d90db39c.css" rel="preload" as="style"><link href="//h5.sinaimg.cn/m/weibo-lite/js/app.fd9603ad.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/js/manifest.5ecace0f.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/js/vendor.36b3e5f0.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/css/vendor.d90db39c.css" rel="stylesheet"><link href="//h5.sinaimg.cn/m/weibo-lite/css/app.952c2508.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="//h5.sinaimg.cn/m/weibo-lite/favicon-32.png"><link rel="icon" type="image/png" sizes="16x16" href="//h5.sinaimg.cn/m/weibo-lite/favicon-16.png"><link rel="manifest" href="//h5.sinaimg.cn/m/weibo-lite/manifest.json"><meta name="theme-color" content="#F3F3F3"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="微博Lite"><link rel="apple-touch-icon" href="//h5.sinaimg.cn/m/weibo-lite/appicon.png"><link rel="mask-icon" href="//h5.sinaimg.cn/m/weibo-lite/mask-icon.svg" color="#F3F3F3"><meta name="msapplication-TileImage" content="//h5.sinaimg.cn/m/weibo-lite/appicon.png"><meta name="msapplication-TileColor" content="#000000"></head>
<link href="//h5.sinaimg.cn/m/weibo-lite/css/app.2b65fef8.css" rel="preload" as="style"><link href="//h5.sinaimg.cn/m/weibo-lite/css/vendor.ed418b16.css" rel="preload" as="style"><link href="//h5.sinaimg.cn/m/weibo-lite/js/app.11a3fee7.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/js/manifest.bb6ddc12.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/js/vendor.14bfc30c.js" rel="preload" as="script"><link href="//h5.sinaimg.cn/m/weibo-lite/css/vendor.ed418b16.css" rel="stylesheet"><link href="//h5.sinaimg.cn/m/weibo-lite/css/app.2b65fef8.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="//h5.sinaimg.cn/m/weibo-lite/favicon-32.png"><link rel="icon" type="image/png" sizes="16x16" href="//h5.sinaimg.cn/m/weibo-lite/favicon-16.png"><link rel="manifest" href="//h5.sinaimg.cn/m/weibo-lite/manifest.json"><meta name="theme-color" content="#F3F3F3"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="微博Lite"><link rel="apple-touch-icon" href="//h5.sinaimg.cn/m/weibo-lite/appicon.png"><meta name="msapplication-TileColor" content="#000000"></head>
<body>
<div id="app" class="m-container-max">
@ -30,15 +30,23 @@
<script>
var config = {
env: 'prod',
version: 'v2.9.9',
version: 'v2.10.4',
login: [][0],
st: '4ae7c5',
st: 'b26f2e',
uid: '',
pageConfig: [null][0] || {},
preferQuickapp: '0',
wm: ''
}
var $render_data = [{
"hotScheme": "https://m.weibo.cn/p/index?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&luicode=20000061&lfid=4649031014551911",
"appScheme": "https://m.weibo.cn?luicode=20000061&lfid=4649031014551911",
"callUinversalLink": false,
"callWeibo": false,
"schemeOrigin": false,
"appLink": "sinaweibo://detail?mblogid=4649031014551911&luicode=20000061&lfid=4649031014551911",
"xianzhi_scheme": "xianzhi://mblogshow?mid=4649031014551911",
"third_scheme": "sinaweibo://detail?mblogid=4649031014551911&luicode=20000061&lfid=4649031014551911",
"status": {
"visible": {
"type": 0,
@ -49,14 +57,13 @@
"mid": "4649031014551911",
"can_edit": false,
"show_additional_indication": 0,
"text": "<a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&isnewpage=1&luicode=20000061&lfid=4649031014551911\" data-hide=\"\"><span class=\"surl-text\">#明日方舟#</span></a> 06月17日16:00闪断更新公告 <br /><br />感谢您对《明日方舟》的关注与支持。《明日方舟》计划将于2021年06月17日16:00 ~ 16:10 期间进行服务器闪断更新。届时将造成玩家强制掉线,无法登录等问题。 为确保您的游戏内帐号数据正常,请在本次闪断更新时提前结束关卡。本次更新给各位玩家带来的不便,敬请谅解!<br /><br />闪断更新时间:<br />2021年06月17日16:00 ~ 16:10 期间<br /><br />更新内容:<br />◆SideStory「沃伦姆德的薄暮」复刻活动开启<br />◆调整了基建奖章下【家装建构奖章】的计数规则<br />◆修复了【绮良】技能“锚点捕捉”开启时,无法选中部分敌方单位的问题<br /><br />闪断补偿:合成玉*200<br />补偿范围2021年06月17日16:00更新前所有注册并创建角色的玩家含游客账号<br /><br />*本次维护不排除延迟开启的可能,如若延迟则请关注官方发布的具体开服时间*",
"text": "<a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&extparam=%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&luicode=20000061&lfid=4649031014551911\" data-hide=\"\"><span class=\"surl-text\">#明日方舟#</span></a> 06月17日16:00闪断更新公告 <br /><br />感谢您对《明日方舟》的关注与支持。《明日方舟》计划将于2021年06月17日16:00 ~ 16:10 期间进行服务器闪断更新。届时将造成玩家强制掉线,无法登录等问题。 为确保您的游戏内帐号数据正常,请在本次闪断更新时提前结束关卡。本次更新给各位玩家带来的不便,敬请谅解!<br /><br />闪断更新时间:<br />2021年06月17日16:00 ~ 16:10 期间<br /><br />更新内容:<br />◆SideStory「沃伦姆德的薄暮」复刻活动开启<br />◆调整了基建奖章下【家装建构奖章】的计数规则<br />◆修复了【绮良】技能“锚点捕捉”开启时,无法选中部分敌方单位的问题<br /><br />闪断补偿:合成玉*200<br />补偿范围2021年06月17日16:00更新前所有注册并创建角色的玩家含游客账号<br /><br />*本次维护不排除延迟开启的可能,如若延迟则请关注官方发布的具体开服时间*",
"textLength": 671,
"source": "微博 weibo.com",
"favorited": false,
"pic_ids": [
"006QZngZgy1grl2q3n98jj30rs2084qp"
],
"pic_types": "",
"thumbnail_pic": "https://wx1.sinaimg.cn/thumbnail/006QZngZgy1grl2q3n98jj30rs2084qp.jpg",
"bmiddle_pic": "http://wx1.sinaimg.cn/bmiddle/006QZngZgy1grl2q3n98jj30rs2084qp.jpg",
"original_pic": "https://wx1.sinaimg.cn/large/006QZngZgy1grl2q3n98jj30rs2084qp.jpg",
@ -65,9 +72,9 @@
"user": {
"id": 6279793937,
"screen_name": "明日方舟Arknights",
"profile_image_url": "https://tvax4.sinaimg.cn/crop.0.0.756.756.180/006QZngZly8gdj05mufr9j30l00l0dq4.jpg?KID=imgbed,tva&Expires=1623934220&ssig=peAOY3wvpb",
"profile_image_url": "https://tvax4.sinaimg.cn/crop.0.0.756.756.180/006QZngZly8gdj05mufr9j30l00l0dq4.jpg?KID=imgbed,tva&Expires=1651261073&ssig=MxMwuX7WU4",
"profile_url": "https://m.weibo.cn/u/6279793937?uid=6279793937&luicode=20000061&lfid=4649031014551911",
"statuses_count": 1229,
"statuses_count": 1682,
"verified": true,
"verified_type": 2,
"verified_type_ext": 50,
@ -77,56 +84,60 @@
"gender": "f",
"mbtype": 12,
"urank": 4,
"mbrank": 6,
"mbrank": 7,
"follow_me": false,
"following": false,
"followers_count": 1370671,
"follow_count": 33,
"follow_count": 37,
"followers_count": "149.9万",
"followers_count_str": "149.9万",
"cover_image_phone": "https://wx4.sinaimg.cn/crop.0.0.640.640.640/006QZngZly1gq8sa16csgj30u00u0akt.jpg",
"avatar_hd": "https://wx4.sinaimg.cn/orj480/006QZngZly8gdj05mufr9j30l00l0dq4.jpg",
"like": false,
"like_me": false,
"badge": {
"user_name_certificate": 1
"user_name_certificate": 1,
"pc_new": 6,
"brand_account_2021": 2
}
},
"picStatus": "1",
"reposts_count": 83,
"comments_count": 583,
"attitudes_count": 16670,
"reposts_count": 81,
"comments_count": 656,
"reprint_cmt_count": 0,
"attitudes_count": 20119,
"pending_approval_count": 0,
"isLongText": true,
"reward_exhibition_type": 0,
"hide_flag": 0,
"mlevel": 0,
"darwin_tags": [
{
"object_type": "fangle",
"object_id": "1022:23126100007595647269150721",
"display_name": "1 份奖品待领取",
"object_id": "1022:23126100007583245918607363",
"display_name": "热门游戏 动态»",
"enterprise_uid": null,
"bd_object_type": "fangle"
}
],
"mblogtype": 0,
"more_info_type": 0,
"number_display_strategy": {
"apply_scenario_flag": 3,
"display_text_min_number": 1000000,
"display_text": "100万+"
},
"content_auth": 0,
"pic_num": 1,
"alchemy_params": {
"ug_red_envelope": false
"comment_manage_info": {
"comment_permission_type": -1,
"approval_comment_type": 0,
"comment_sort_type": 0
},
"pic_num": 1,
"new_comment_style": 0,
"page_info": {
"type": "search_topic",
"object_type": 0,
"page_pic": {
"url": "https://wx4.sinaimg.cn/large/006QZngZly1gebqvb31dcj30dw0dwgn4.jpg"
},
"page_url": "https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&isnewpage=1&luicode=20000061&lfid=4649031014551911",
"page_url": "https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&extparam=%23%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F%23&luicode=20000061&lfid=4649031014551911",
"page_title": "#明日方舟#",
"content1": "0讨论 0阅读 "
},
@ -163,25 +174,13 @@
}
],
"status_title": "家装建构奖章",
"ok": 1,
"scheme": "https://weibo.cn/appurl?scheme=sinaweibo%3A%2F%2Fdetail%3Fmblogid%3D4649031014551911%26luicode%3D20000061%26lfid%3D4649031014551911&luicode=20000061&lfid=4649031014551911",
"tipScheme": "https://weibo.cn/appurl?scheme=sinaweibo%3A%2F%2Fdetail%3Fmblogid%3D4649031014551911%26luicode%3D20000061%26lfid%3D4649031014551911&luicode=20000061&lfid=4649031014551911"
"ok": 1
},
"hotScheme": "https://m.weibo.cn/p/index?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&luicode=20000061&lfid=4649031014551911",
"appScheme": "https://m.weibo.cn?luicode=20000061&lfid=4649031014551911",
"callUinversalLink": false,
"callWeibo": false,
"hit": true,
"is_gray": 1,
"schemeOrigin": false,
"appLink": "sinaweibo://detail?mblogid=4649031014551911&luicode=20000061&lfid=4649031014551911",
"xianzhi_scheme": "xianzhi://mblogshow?mid=4649031014551911",
"third_scheme": "sinaweibo://detail?mblogid=4649031014551911&luicode=20000061&lfid=4649031014551911",
"call": "1"
"call": 1
}][0] || {};
var __wb_performance_data={v:"v8",m:"mainsite",pwa:1,sw:0};
</script>
<script src="https://h5.sinaimg.cn/upload/1005/16/2017/11/30/wbp.js" id="__wb_performance_log" data-rate="0.1"></script>
<script src="//h5.sinaimg.cn/m/weibo-lite/js/manifest.5ecace0f.js"></script><script src="//h5.sinaimg.cn/m/weibo-lite/js/vendor.36b3e5f0.js"></script><script src="//h5.sinaimg.cn/m/weibo-lite/js/app.fd9603ad.js"></script></body>
<script src="//h5.sinaimg.cn/m/weibo-lite/js/manifest.bb6ddc12.js"></script><script src="//h5.sinaimg.cn/m/weibo-lite/js/vendor.14bfc30c.js"></script><script src="//h5.sinaimg.cn/m/weibo-lite/js/app.11a3fee7.js"></script></body>
</html>

View File

@ -18,6 +18,11 @@ def arknights_list_0():
return get_json("arknights_list_0.json")
@pytest.fixture(scope="module")
def arknights_list__1():
return get_json("arknights_list_-1.json")
@pytest.fixture(scope="module")
def arknights_list_1():
return get_json("arknights_list_1.json")
@ -36,6 +41,73 @@ def monster_siren_list_1():
@pytest.mark.asyncio
@respx.mock
async def test_fetch_new(
arknights,
dummy_user_subinfo,
arknights_list_0,
arknights_list__1,
monster_siren_list_0,
monster_siren_list_1,
):
ak_list_router = respx.get(
"https://ak-conf.hypergryph.com/config/prod/announce_meta/IOS/announcement.meta.json"
)
detail_router = respx.get(
"https://ak.hycdn.cn/announce/IOS/announcement/807_1640060583.html"
)
version_router = respx.get(
"https://ak-conf.hypergryph.com/config/prod/official/IOS/version"
)
preannouncement_router = respx.get(
"https://ak-conf.hypergryph.com/config/prod/announce_meta/IOS/preannouncement.meta.json"
)
monster_siren_router = respx.get("https://monster-siren.hypergryph.com/api/news")
terra_list = respx.get("https://terra-historicus.hypergryph.com/api/recentUpdate")
ak_list_router.mock(return_value=Response(200, json=arknights_list__1))
detail_router.mock(
return_value=Response(200, text=get_file("arknights-detail-807"))
)
version_router.mock(
return_value=Response(200, json=get_json("arknights-version-0.json"))
)
preannouncement_router.mock(
return_value=Response(200, json=get_json("arknights-pre-0.json"))
)
monster_siren_router.mock(return_value=Response(200, json=monster_siren_list_0))
terra_list.mock(return_value=Response(200, json=get_json("terra-hist-0.json")))
target = ""
res = await arknights.fetch_new_post(target, [dummy_user_subinfo])
assert ak_list_router.called
assert len(res) == 0
assert not detail_router.called
mock_data = arknights_list_0
ak_list_router.mock(return_value=Response(200, json=mock_data))
res3 = await arknights.fetch_new_post(target, [dummy_user_subinfo])
assert len(res3[0][1]) == 1
assert detail_router.called
post = res3[0][1][0]
assert post.target_type == "arknights"
assert post.text == ""
assert post.url == ""
assert post.target_name == "明日方舟游戏内公告"
assert len(post.pics) == 1
# assert(post.pics == ['https://ak-fs.hypergryph.com/announce/images/20210623/e6f49aeb9547a2278678368a43b95b07.jpg'])
print(res3[0][1])
await post.generate_messages()
terra_list.mock(return_value=Response(200, json=get_json("terra-hist-1.json")))
res = await arknights.fetch_new_post(target, [dummy_user_subinfo])
assert len(res) == 1
post = res[0][1][0]
assert post.target_type == "terra-historicus"
assert post.text == "123罗德岛 - 「掠风」篇"
assert post.url == "https://terra-historicus.hypergryph.com/comic/6253/episode/4938"
assert post.pics == [
"https://web.hycdn.cn/comic/pic/20220507/ab8a2ff408ec7d587775aed70b178ec0.png"
]
@pytest.mark.render
@respx.mock
async def test_send_with_render(
arknights,
dummy_user_subinfo,
arknights_list_0,
@ -56,6 +128,7 @@ async def test_fetch_new(
"https://ak-conf.hypergryph.com/config/prod/announce_meta/IOS/preannouncement.meta.json"
)
monster_siren_router = respx.get("https://monster-siren.hypergryph.com/api/news")
terra_list = respx.get("https://terra-historicus.hypergryph.com/api/recentUpdate")
ak_list_router.mock(return_value=Response(200, json=arknights_list_0))
detail_router.mock(
return_value=Response(200, text=get_file("arknights-detail-805"))
@ -67,6 +140,7 @@ async def test_fetch_new(
return_value=Response(200, json=get_json("arknights-pre-0.json"))
)
monster_siren_router.mock(return_value=Response(200, json=monster_siren_list_0))
terra_list.mock(return_value=Response(200, json=get_json("terra-hist-0.json")))
target = ""
res = await arknights.fetch_new_post(target, [dummy_user_subinfo])
assert ak_list_router.called

View File

@ -281,3 +281,49 @@ async def test_abort_add_on_tag(app: App):
True,
)
ctx.should_finished()
# 删除订阅阶段中止
@pytest.mark.asyncio
async def test_abort_del_sub(app: App):
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.message import Message
from nonebot_bison.config import Config
from nonebot_bison.config_manager import del_sub_matcher
from nonebot_bison.platform import platform_manager
config = Config()
config.user_target.truncate()
config.add_subscribe(
10000,
"group",
"6279793937",
"明日方舟Arknights",
"weibo",
[platform_manager["weibo"].reverse_category["图文"]],
["明日方舟"],
)
async with app.test_matcher(del_sub_matcher) as ctx:
bot = ctx.create_bot(base=Bot)
assert isinstance(bot, Bot)
event = fake_group_message_event(
message=Message("删除订阅"), to_me=True, sender=fake_admin_user
)
ctx.receive_event(bot, event)
ctx.should_pass_rule()
ctx.should_pass_permission()
ctx.should_call_send(
event,
Message(
"订阅的帐号为:\n1 weibo 明日方舟Arknights 6279793937\n [图文] 明日方舟\n请输入要删除的订阅的序号\n输入'取消'中止"
),
True,
)
event_abort = fake_group_message_event(
message=Message("取消"), sender=fake_admin_user
)
ctx.receive_event(bot, event_abort)
ctx.should_call_send(event_abort, "删除中止", True)
ctx.should_finished()
subs = config.list_subscribe(10000, "group")
assert subs

View File

@ -383,12 +383,12 @@ async def test_add_with_get_id(app: App):
ctx.should_rejected()
ctx.should_call_send(
event_4_query,
[MessageSegment(*BotReply.add_reply_on_id_input_search())],
Message([MessageSegment(*BotReply.add_reply_on_id_input_search())]),
True,
)
"""
line 362:
知道为什么要在这里这样写
关于Message([MessageSegment(*BotReply.add_reply_on_id_input_search())]):
异客知道为什么要在这里这样写
没有[]的话assert不了(should_call_send使用[MessageSegment(...)]的格式进行比较)
不在这里MessageSegment()的话也assert不了(指不能让add_reply_on_id_input_search直接返回一个MessageSegment对象)
amen
@ -403,3 +403,5 @@ async def test_add_with_get_id(app: App):
True,
)
ctx.should_finished()
subs = config.list_subscribe(10000, "group")
assert len(subs) == 0

View File

@ -82,4 +82,3 @@ async def test_query_with_superuser_group_tome(app: App):
ctx.should_pass_rule()
ctx.should_pass_permission()
ctx.should_call_send(event, Message("该功能只支持私聊使用请私聊Bot"), True)

View File

@ -67,7 +67,7 @@ async def test_del_sub(app: App):
ctx.should_call_send(
event,
Message(
"订阅的帐号为:\n1 weibo 明日方舟Arknights 6279793937\n [图文] 明日方舟\n请输入要删除的订阅的序号"
"订阅的帐号为:\n1 weibo 明日方舟Arknights 6279793937\n [图文] 明日方舟\n请输入要删除的订阅的序号\n输入'取消'中止"
),
True,
)
@ -87,15 +87,28 @@ async def test_del_sub(app: App):
assert len(subs) == 0
async def test_test(app: App):
@pytest.mark.asyncio
async def test_del_empty_sub(app: App):
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.message import Message
from nonebot_bison.config_manager import test_matcher
from nonebot_bison.config import Config
from nonebot_bison.config_manager import del_sub_matcher
from nonebot_bison.platform import platform_manager
async with app.test_matcher(test_matcher) as ctx:
config = Config()
config.user_target.truncate()
async with app.test_matcher(del_sub_matcher) as ctx:
bot = ctx.create_bot(base=Bot)
event = fake_group_message_event(message=Message("testtt"))
assert isinstance(bot, Bot)
event = fake_group_message_event(
message=Message("删除订阅"), to_me=True, sender=fake_admin_user
)
ctx.receive_event(bot, event)
ctx.should_pass_permission()
ctx.should_pass_rule()
ctx.should_call_send(event, "666", True)
ctx.should_pass_permission()
ctx.should_finished()
ctx.should_call_send(
event,
"暂无已订阅账号\n请使用“添加订阅”命令添加订阅",
True,
)

View File

@ -1,13 +1,12 @@
import asyncio
import pytest
from nonebot.adapters.onebot.v11.message import Message
from nonebug import App
@pytest.mark.asyncio
async def test_send_no_queue(app: App):
import nonebot
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.message import Message
from nonebot_bison.plugin_config import plugin_config
from nonebot_bison.send import send_msgs
@ -16,16 +15,16 @@ async def test_send_no_queue(app: App):
bot = ctx.create_bot(base=Bot)
assert isinstance(bot, Bot)
ctx.should_call_api(
"send_group_msg", {"group_id": "1233", "message": "msg1"}, True
"send_group_msg", {"group_id": "1233", "message": Message("msg1")}, True
)
ctx.should_call_api(
"send_group_msg", {"group_id": "1233", "message": "msg2"}, True
"send_group_msg", {"group_id": "1233", "message": Message("msg2")}, True
)
ctx.should_call_api(
"send_private_msg", {"user_id": "666", "message": "priv"}, True
"send_private_msg", {"user_id": "666", "message": Message("priv")}, True
)
await send_msgs(bot, "1233", "group", ["msg1", "msg2"])
await send_msgs(bot, "666", "private", ["priv"])
await send_msgs(bot, "1233", "group", [Message("msg1"), Message("msg2")])
await send_msgs(bot, "666", "private", [Message("priv")])
assert ctx.wait_list.empty()
@ -33,9 +32,10 @@ async def test_send_no_queue(app: App):
async def test_send_queue(app: App):
import nonebot
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.message import Message
from nonebot_bison import send
from nonebot_bison.plugin_config import plugin_config
from nonebot_bison.send import LAST_SEND_TIME, do_send_msgs, send_msgs
from nonebot_bison.send import do_send_msgs, send_msgs
async with app.test_api() as ctx:
new_bot = ctx.create_bot(base=Bot)
@ -48,7 +48,7 @@ async def test_send_queue(app: App):
"send_group_msg", {"group_id": "1233", "message": "test msg"}, True
)
await bot.call_api("send_group_msg", group_id="1233", message="test msg")
await send_msgs(bot, "1233", "group", ["msg"])
await send_msgs(bot, "1233", "group", [Message("msg")])
ctx.should_call_api(
"send_group_msg", {"group_id": "1233", "message": "msg"}, True
)
@ -59,6 +59,14 @@ async def test_send_queue(app: App):
assert ctx.wait_list.empty()
def gen_node(id, name, content: Message):
return {"type": "node", "data": {"name": name, "uin": id, "content": content}}
def _merge_messge(nodes):
return nodes
@pytest.mark.asyncio
async def test_send_merge_no_queue(app: App):
from nonebot.adapters.onebot.v11.bot import Bot
@ -103,15 +111,8 @@ async def test_send_merge_no_queue(app: App):
{"group_id": 633, "user_id": 8888, "no_cache": True},
{"user_id": 8888, "card": "admin", "nickname": "adminuser"},
)
merged_message = Message(
[
MessageSegment.node_custom(
user_id=8888, nickname="admin", content=message[1]
),
MessageSegment.node_custom(
user_id=8888, nickname="admin", content=message[2]
),
]
merged_message = _merge_messge(
[gen_node(8888, "admin", message[1]), gen_node(8888, "admin", message[2])]
)
ctx.should_call_api(
"send_group_forward_msg",
@ -136,17 +137,11 @@ async def test_send_merge_no_queue(app: App):
{"group_id": 633, "user_id": 8888, "no_cache": True},
{"user_id": 8888, "card": None, "nickname": "adminuser"},
)
merged_message = Message(
merged_message = _merge_messge(
[
MessageSegment.node_custom(
user_id=8888, nickname="adminuser", content=message[1]
),
MessageSegment.node_custom(
user_id=8888, nickname="adminuser", content=message[2]
),
MessageSegment.node_custom(
user_id=8888, nickname="adminuser", content=message[3]
),
gen_node(8888, "adminuser", message[1]),
gen_node(8888, "adminuser", message[2]),
gen_node(8888, "adminuser", message[3]),
]
)
ctx.should_call_api(
@ -198,17 +193,11 @@ async def test_send_merge2_no_queue(app: App):
{"group_id": 633, "user_id": 8888, "no_cache": True},
{"user_id": 8888, "card": "admin", "nickname": "adminuser"},
)
merged_message = Message(
merged_message = _merge_messge(
[
MessageSegment.node_custom(
user_id=8888, nickname="admin", content=message[0]
),
MessageSegment.node_custom(
user_id=8888, nickname="admin", content=message[1]
),
MessageSegment.node_custom(
user_id=8888, nickname="admin", content=message[2]
),
gen_node(8888, "admin", message[0]),
gen_node(8888, "admin", message[1]),
gen_node(8888, "admin", message[2]),
]
)
ctx.should_call_api(