Compare commits
10
Commits
c064452e43
...
221b2c8b0f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
221b2c8b0f | ||
|
|
6a90fd646e | ||
|
|
b62c95580a | ||
|
|
ad6ba2886f | ||
|
|
2c0a2de421 | ||
|
|
9372bdf00e | ||
|
|
ac6e483dd1 | ||
|
|
a58242147b | ||
|
|
3f098fa399 | ||
|
|
5c8beaf125 |
@@ -0,0 +1,12 @@
|
||||
[[source]]
|
||||
url = "https://mirrors.ustc.edu.cn/pypi/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
numpy = "==1.26.4"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.11"
|
||||
Generated
+63
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "36f169f2123af68050e2f684976804e779e0ba13774998aa0349892dadc2569f"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.11"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://mirrors.ustc.edu.cn/pypi/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"numpy": {
|
||||
"hashes": [
|
||||
"sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b",
|
||||
"sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818",
|
||||
"sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20",
|
||||
"sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0",
|
||||
"sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010",
|
||||
"sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a",
|
||||
"sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea",
|
||||
"sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c",
|
||||
"sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71",
|
||||
"sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110",
|
||||
"sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be",
|
||||
"sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a",
|
||||
"sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a",
|
||||
"sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5",
|
||||
"sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed",
|
||||
"sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd",
|
||||
"sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c",
|
||||
"sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e",
|
||||
"sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0",
|
||||
"sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c",
|
||||
"sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a",
|
||||
"sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b",
|
||||
"sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0",
|
||||
"sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6",
|
||||
"sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2",
|
||||
"sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a",
|
||||
"sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30",
|
||||
"sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218",
|
||||
"sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5",
|
||||
"sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07",
|
||||
"sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2",
|
||||
"sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4",
|
||||
"sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764",
|
||||
"sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef",
|
||||
"sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3",
|
||||
"sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.26.4"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
||||
@@ -1,6 +1,15 @@
|
||||
# StarBot
|
||||
<div align="center">
|
||||
|
||||
一款极速,多功能的哔哩哔哩推送机器人。
|
||||

|
||||
|
||||
[](https://pypi.org/project/starbot-bilibili)
|
||||
[](https://www.python.org)
|
||||
[](https://github.com/Starlwr/StarBot/blob/master/LICENSE)
|
||||
[](https://github.com/Starlwr/StarBot/stargazers)
|
||||
|
||||
|
||||
**一个极速,多功能的哔哩哔哩推送机器人**
|
||||
</div>
|
||||
|
||||
## 特性
|
||||
|
||||
@@ -44,3 +53,10 @@ bot.run()
|
||||
* [Ariadne](https://github.com/GraiaProject/Ariadne): 一个优雅且完备的 Python QQ 自动化框架,基于 Mirai API HTTP v2
|
||||
* [Fake-QQ-Chat-Window](https://github.com/Redlnn/Fake-QQ-Chat-Window): 伪 QQ 移动客户端聊天窗口,当前官网的推送配置在线预览基于此项目魔改实现
|
||||
* [为本项目赞赏支持的小伙伴们](https://bot.starlwr.com/about): 名单较长,详细名单可点击链接在官网查看
|
||||
* [JetBrains](https://www.jetbrains.com/?from=StarBot): 为开源项目免费提供的优秀 IDE
|
||||
|
||||
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg"/>](https://www.jetbrains.com/?from=StarBot)
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://star-history.com/#Starlwr/StarBot&Date)
|
||||
@@ -44,6 +44,9 @@ async def bind(app: Ariadne,
|
||||
|
||||
uid = remove_command_param_placeholder(uid.display)
|
||||
|
||||
# Replace
|
||||
uid = uid.replace("UID:", "")
|
||||
|
||||
if not uid.isdigit() or int(uid) == 0:
|
||||
await app.send_message(sender, MessageChain(f"请输入正确的UID~\n命令示例:{prefix}绑定 114514"), quote=source)
|
||||
return
|
||||
|
||||
@@ -90,7 +90,7 @@ async def ranking(app: Ariadne,
|
||||
|
||||
if length == 0:
|
||||
await app.send_message(sender, MessageChain(f"{up.uname} 的房间暂无{type_map[_type][2]}数据~"), quote=source)
|
||||
return
|
||||
continue
|
||||
|
||||
if page > page_length:
|
||||
await app.send_message(
|
||||
@@ -98,7 +98,7 @@ async def ranking(app: Ariadne,
|
||||
MessageChain(f"{up.uname} 的房间{type_map[_type][3]}榜页码范围为 1 ~ {page_length}\n请重新输入正确的页码~"),
|
||||
quote=source
|
||||
)
|
||||
return
|
||||
continue
|
||||
|
||||
data = await type_map[_type][1](up.room_id, start, end)
|
||||
top_count = (await type_map[_type][1](up.room_id, 0, 0))[0][1]
|
||||
|
||||
@@ -80,7 +80,7 @@ async def ranking_double(app: Ariadne,
|
||||
|
||||
if length == 0:
|
||||
await app.send_message(sender, MessageChain(f"{up.uname} 的房间暂无{type_map[_type][2]}数据~"), quote=source)
|
||||
return
|
||||
continue
|
||||
|
||||
if page > page_length:
|
||||
await app.send_message(
|
||||
@@ -88,7 +88,7 @@ async def ranking_double(app: Ariadne,
|
||||
MessageChain(f"{up.uname} 的房间{type_map[_type][3]}榜页码范围为 1 ~ {page_length}\n请重新输入正确的页码~"),
|
||||
quote=source
|
||||
)
|
||||
return
|
||||
continue
|
||||
|
||||
data = await type_map[_type][1](up.room_id, start, end)
|
||||
top_count = max(
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ class StarBot:
|
||||
"""
|
||||
StarBot 类
|
||||
"""
|
||||
VERSION = "2.0.7"
|
||||
VERSION = "2.0.10"
|
||||
STARBOT_ASCII_LOGO = "\n".join(
|
||||
(
|
||||
r" _____ _ ____ _ ",
|
||||
@@ -35,7 +35,7 @@ class StarBot:
|
||||
r" \___ \| __/ _` | '__| _ < / _ \| __|",
|
||||
r" ____) | || (_| | | | |_) | (_) | |_ ",
|
||||
r" |_____/ \__\__,_|_| |____/ \___/ \__|",
|
||||
f" StarBot - (v{VERSION}) 2023-10-15",
|
||||
f" StarBot - (v{VERSION}) 2024-06-30",
|
||||
r" Github: https://github.com/Starlwr/StarBot",
|
||||
r"",
|
||||
r"",
|
||||
|
||||
@@ -61,6 +61,8 @@ async def dynamic_spider(datasource: DataSource):
|
||||
detail = latest_dynamic["cards"][i]
|
||||
except IndexError:
|
||||
break
|
||||
except TypeError:
|
||||
break
|
||||
|
||||
dynamic_id = detail['desc']['dynamic_id']
|
||||
if await redis.exists_dynamic(dynamic_id):
|
||||
|
||||
@@ -11,7 +11,7 @@ from .PicGenerator import Color, PicGenerator
|
||||
from ..utils import config
|
||||
from ..utils.network import request
|
||||
from ..utils.utils import open_url_image, timestamp_format, split_list, limit_str_length, \
|
||||
mask_round, mask_rounded_rectangle
|
||||
mask_round, mask_rounded_rectangle, get_credential
|
||||
|
||||
|
||||
class DynamicPicGenerator:
|
||||
@@ -168,10 +168,27 @@ class DynamicPicGenerator:
|
||||
mod: 表情区块字典
|
||||
"""
|
||||
mod["img"] = await open_url_image(mod["emoji"]["icon_url"])
|
||||
|
||||
modules_url = f"https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?timezone_offset=-480&id={dynamic_id}"
|
||||
modules = (await request("GET", modules_url))["item"]["modules"]["module_dynamic"]["desc"]
|
||||
modules = modules["rich_text_nodes"] if modules else []
|
||||
|
||||
if dynamic_type == 2 or dynamic_type == 4:
|
||||
# 有些动态带有标题,不显示标题会缺少上下文
|
||||
modules_url =f"https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?timezone_offset=-480&id={dynamic_id}&features=itemOpusStyle,opusBigCover,onlyfansVote"
|
||||
modules = (await request("GET", modules_url, credential=get_credential()))["item"]["modules"]["module_dynamic"]["major"]["opus"]
|
||||
title = modules["title"]
|
||||
modules = modules["summary"]
|
||||
if modules:
|
||||
modules = modules["rich_text_nodes"]
|
||||
if title is not None:
|
||||
modules.insert(0, {
|
||||
'orig_text': f"{title}\n",
|
||||
'text': f"{title}\n",
|
||||
'type': 'RICH_TEXT_NODE_TYPE_TEXT'
|
||||
})
|
||||
else:
|
||||
modules = []
|
||||
else :
|
||||
modules_url = f"https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?timezone_offset=-480&id={dynamic_id}"
|
||||
modules = (await request("GET", modules_url, credential=get_credential()))["item"]["modules"]["module_dynamic"]["desc"]
|
||||
modules = modules["rich_text_nodes"] if modules else []
|
||||
|
||||
# 下载表情
|
||||
download_picture_tasks = []
|
||||
|
||||
Reference in New Issue
Block a user