mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # requirements.txt
This commit is contained in:
commit
16f9c170f4
3 changed files with 14 additions and 9 deletions
|
|
@ -6,18 +6,21 @@ nonebot2[websockets]
|
||||||
|
|
||||||
sqlalchemy~=2.0.34
|
sqlalchemy~=2.0.34
|
||||||
autopep8
|
autopep8
|
||||||
|
graiax-silkcoder[ffmpeg]
|
||||||
|
Crypto~=1.4.1
|
||||||
graiax-silkcoder
|
graiax-silkcoder
|
||||||
graiax-silkcoder[ffempeg]
|
|
||||||
Crypto
|
Crypto
|
||||||
fake_useragent
|
fake_useragent
|
||||||
pycryptodome
|
pycryptodome~=3.21.0
|
||||||
PyExecJS
|
PyExecJS~=1.5.1
|
||||||
gradio_client
|
gradio_client
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
requests~=2.32.3
|
requests~=2.31.0
|
||||||
pillow~=10.4.0
|
pillow~=11.1.0
|
||||||
yaml~=0.2.5
|
yaml~=0.2.5
|
||||||
pyyaml~=6.0.1
|
pyyaml~=6.0.1
|
||||||
|
qrcode~=7.4.2
|
||||||
|
nonebot~=1.9.1
|
||||||
|
|
@ -150,7 +150,7 @@ def netease_music_search(keyword,session):
|
||||||
params = {
|
params = {
|
||||||
"s": keyword,
|
"s": keyword,
|
||||||
"type": 1, # 1 表示搜索歌曲,2 表示搜索专辑,3 表示搜索歌手等
|
"type": 1, # 1 表示搜索歌曲,2 表示搜索专辑,3 表示搜索歌手等
|
||||||
"limit": 50, # 限制搜索结果的数量
|
"limit": 10, # 限制搜索结果的数量
|
||||||
"offset": 0, # 搜索结果的偏移量,可用于分页
|
"offset": 0, # 搜索结果的偏移量,可用于分页
|
||||||
"sub": "false",
|
"sub": "false",
|
||||||
}
|
}
|
||||||
|
|
@ -161,6 +161,8 @@ def netease_music_search(keyword,session):
|
||||||
if songs:
|
if songs:
|
||||||
filtered_data = [item for item in songs if item.get('fee') == 8]# 过滤掉付费歌曲
|
filtered_data = [item for item in songs if item.get('fee') == 8]# 过滤掉付费歌曲
|
||||||
num = 0
|
num = 0
|
||||||
|
if len(filtered_data) - 1 <= 0: # 判断返回内容是否为空
|
||||||
|
return None, None, None, None
|
||||||
num = Random().randint(0, len(filtered_data) - 1)
|
num = Random().randint(0, len(filtered_data) - 1)
|
||||||
first_song = filtered_data[num] # 获取第一首歌曲
|
first_song = filtered_data[num] # 获取第一首歌曲
|
||||||
song_name = first_song["name"]
|
song_name = first_song["name"]
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,9 @@ async def handle_function(msg: MessageEvent):
|
||||||
#搜索歌曲
|
#搜索歌曲
|
||||||
song_id,song_name,singer,song_url = netease_music_search(keyword,session)
|
song_id,song_name,singer,song_url = netease_music_search(keyword,session)
|
||||||
if song_id is None:
|
if song_id is None:
|
||||||
await music.finish("没有找到歌曲")
|
await music.finish("\n没有找到歌曲,或检索到的歌曲均为付费喔qwq\n这绝对不是我的错,绝对不是!")
|
||||||
else:
|
else:
|
||||||
await music.send(MessageSegment.text(f" 来源:网易云音乐\n歌曲:{song_name} - {singer}"))
|
await music.send(MessageSegment.text(f" 来源:网易云音乐\n歌曲:{song_name} - {singer}\n请稍等喔🎵\n\n注意:PC端QQ可能会出现无法播放情况,建议使用移动端"))
|
||||||
#返回转换后的歌曲路径
|
#返回转换后的歌曲路径
|
||||||
output_silk_path = netease_music_download(song_id, song_name, singer,session)
|
output_silk_path = netease_music_download(song_id, song_name, singer,session)
|
||||||
await music.send(MessageSegment.file_audio(Path(output_silk_path)))
|
await music.send(MessageSegment.file_audio(Path(output_silk_path)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue