neteasedown fix a bug

This commit is contained in:
xtaodada 2022-01-24 11:39:49 +08:00
parent fe09ee1a1d
commit 00fe3ee7fd
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 3 additions and 3 deletions

View File

@ -272,7 +272,7 @@
}, },
{ {
"name": "neteasedown", "name": "neteasedown",
"version": "1.226", "version": "1.23",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "11.4 kb", "size": "11.4 kb",

View File

@ -11,6 +11,7 @@ from pagermaid.listener import listener
from pagermaid.utils import alias_command, execute, pip_install from pagermaid.utils import alias_command, execute, pip_install
pip_install("pyncm") pip_install("pyncm")
pip_install("mutagen")
from mutagen.mp3 import EasyMP3 from mutagen.mp3 import EasyMP3
from mutagen.id3 import ID3, APIC from mutagen.id3 import ID3, APIC
@ -19,7 +20,6 @@ from mutagen.oggvorbis import OggVorbis
from pyncm import GetCurrentSession, apis, DumpSessionAsString, SetCurrentSession, LoadSessionFromString from pyncm import GetCurrentSession, apis, DumpSessionAsString, SetCurrentSession, LoadSessionFromString
from pyncm.utils.helper import TrackHelper from pyncm.utils.helper import TrackHelper
from pyncm.apis import LoginFailedException from pyncm.apis import LoginFailedException
from pyncm.apis.cloudsearch import CloudSearchType
from pyncm.apis.login import LoginLogout from pyncm.apis.login import LoginLogout
from telethon.tl.types import DocumentAttributeAudio from telethon.tl.types import DocumentAttributeAudio
@ -210,7 +210,7 @@ async def ned(context):
if song_id.isdigit(): if song_id.isdigit():
song_id = int(song_id) song_id = int(song_id)
else: else:
search_data = apis.cloudsearch.GetSearchResult(song_id, CloudSearchType(1), 1) search_data = apis.cloudsearch.GetSearchResult(song_id, 1, 1)
if search_data.get("result", {}).get("songCount", 0) >= 1: if search_data.get("result", {}).get("songCount", 0) >= 1:
song_id = search_data["result"]["songs"][0]["id"] song_id = search_data["result"]["songs"][0]["id"]
else: else: