diff --git a/flaskSystem/API/kw.py b/flaskSystem/API/kw.py index 44e02a3..81eedb3 100644 --- a/flaskSystem/API/kw.py +++ b/flaskSystem/API/kw.py @@ -18,7 +18,7 @@ @app.get("/kw/search/////") def kwsearch(searchKey: str, page=1, size=100,rid='', encId=''): - lst = kw.search_kw_h5(searchKey, int(page), int(size),rid,encId) # Mac端搜索接口 + lst = kw.search_kw_mac(searchKey, int(page), int(size)) # Mac端搜索接口 page = lst['page'] return { 'code': 200, diff --git a/flaskSystem/src/Api/Netease.py b/flaskSystem/src/Api/Netease.py index 6ad3b08..f908617 100644 --- a/flaskSystem/src/Api/Netease.py +++ b/flaskSystem/src/Api/Netease.py @@ -272,18 +272,19 @@ def read_local(self): return False def getMusicUrl(self, id=''): - u = 'http://music.fy6b.com/index/mp3orflac' - d = f'type=netease&id={id}&option=flac' + u = f'https://csm.sayqz.com/api/?type=apiSongUrlV1&level=hires&id={id}' + #音质 standard => 标准,higher => 较高, exhigh=>极高, lossless=>无损, hires=>Hi-Res # { # "url": "http:\/\/m704.music.126.net\/20230305234939\/ccfe8832df4e3431dbe25dfea1118f1e\/jdymusic\/obj\/wo3DlMOGwrbDjj7DisKw\/22975550396\/2dbf\/d87f\/e6f2\/11dac549d861ba74f1d599d2f4f45cea.flac?authSecret=00000186b25ff97815c80aaba23719fb", # "size": 3278433, # "br": 512.575 # } - r = self.httpw(u, 1, d.encode('utf-8'), { - "Content-Type": "application/x-www-form-urlencoded", - "User-Agent": "Dalvik/2.1.0 (Linux; U; Android 8.1.0; MI 5s Build/OPM1.171019.018)" + r = self.httpw(u, 0, head={ + "Host": "csm.sayqz.com", + "accept-encoding": "gaip", + "user-Agent": "okhttp/${project.version}" }) - r = r.json() + r = r.json()['data'][0] return r def searchMusicByTrd(self, searchKey="周杰伦", pageNum=1, pageSize=100): diff --git a/flaskSystem/src/Common/Http.py b/flaskSystem/src/Common/Http.py index 947b020..6fc39d4 100644 --- a/flaskSystem/src/Common/Http.py +++ b/flaskSystem/src/Common/Http.py @@ -23,7 +23,7 @@ def getHttp(self, url: str, method: int = 0, data: bytes = r'', - header: dict[str, str] = {}, + header: dict[str, str, str] = {}, params: dict[str, str] = {} ) -> requests.Response: """ diff --git a/flaskSystem/src/Common/Tools.py b/flaskSystem/src/Common/Tools.py index 590b314..b44078e 100644 --- a/flaskSystem/src/Common/Tools.py +++ b/flaskSystem/src/Common/Tools.py @@ -196,7 +196,7 @@ def downSingle(music, download_home, config): elif platform == 'wyy': link: str = handleWyy(music['mid']) if link is not None: - music['extra'] = 'flac' if link.find(".flac?") != -1 else 'mp3' + music['type'] = 'flac' if link.find(".flac") != -1 else 'mp3' music['singer'] = music['author_simple'] music["album"] = music['album'] musicFileInfo = f"{music['author_simple']} - {music['title']}"