Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

歌词请求返回Internal Server Error #117

Open
2 tasks done
yuhenghuang opened this issue Jan 21, 2025 · 1 comment
Open
2 tasks done

歌词请求返回Internal Server Error #117

yuhenghuang opened this issue Jan 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@yuhenghuang
Copy link

提交Issue之前,你应当知道:

  • Issue是用于快速定位和解决问题的,而不是这个项目的评论区。
  • 一个简明扼要的标题可以快速定位关键信息,标题不需要长篇大论,也不应过于宽泛。

问题描述

日志中报错的地方

2025/01/22 00:41:29 stdout TypeError: string indices must be integers, not 'str'
2025/01/22 00:41:29 stdout ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
2025/01/22 00:41:29 stdout song_info: list[dict] = song_info["result"]["songs"]
2025/01/22 00:41:29 stdout File "/app/mod/searchx/netease.py", line 196, in search_track

看起来是在处理网易云返回的信息的时候遇到了之前不一样的结果

代码本来希望song_info["result"]dict,结果返回的是字符串

等了2个月也没修复.难道只有我遇到这个致命的问题??

P.S. 因此还在用老旧的1.5.2版,歌词也只有酷狗

请求与响应

Request Address: http://我的服务器:28883/api/v1/lyrics/advance

Response Code: 500

# header
access-control-allow-headers: Content-Type,Authorization
access-control-allow-origin: *
content-length: 265
content-type: text/html; charset=utf-8
date: Tue, 21 Jan 2025 15:51:32 GMT
server: waitress

# body
<!doctype html>
<html lang=en>
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

日志文件

基本完整的整个报错stack

date stream content
2025/01/22 00:41:29 stdout TypeError: string indices must be integers, not 'str'
2025/01/22 00:41:29 stdout ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
2025/01/22 00:41:29 stdout song_info: list[dict] = song_info["result"]["songs"]
2025/01/22 00:41:29 stdout File "/app/mod/searchx/netease.py", line 196, in search_track
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return await search_track(session, title=title, artist=artist, album=album)
2025/01/22 00:41:29 stdout File "/app/mod/searchx/netease.py", line 154, in a_search
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return future.result()
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/asyncio/base_events.py", line 684, in run_until_complete
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return self._loop.run_until_complete(task)
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return runner.run(main)
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return asyncio.run(a_search(title=title, artist=artist, album=album))
2025/01/22 00:41:29 stdout File "/app/mod/searchx/netease.py", line 264, in search
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return func(*args, **kwargs)
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/site-packages/mygo/devtools/init.py", line 51, in inner
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout res: list = task.search(title, artist, album)
2025/01/22 00:41:29 stdout File "/app/mod/searchx/init.py", line 11, in request
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout result = self.fn(*self.args, **self.kwargs)
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
2025/01/22 00:41:29 stdout raise self._exception
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return self.__get_result()
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
2025/01/22 00:41:29 stdout future.result()
2025/01/22 00:41:29 stdout File "/app/mod/searchx/init.py", line 23, in search_all
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout lyrics_list = searchx.search_all(title, artist, album)
2025/01/22 00:41:29 stdout File "/app/api/lyrics.py", line 87, in lrc_json
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return ensure_sync(fn)(*args, **kwargs)
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/site-packages/flask_caching/init.py", line 175, in _call_fn
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout rv = self._call_fn(f, *args, **kwargs)
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/site-packages/flask_caching/init.py", line 399, in decorated_function
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return func(*args, **kwargs)
2025/01/22 00:41:29 stdout File "/app/mod/auth/init.py", line 20, in wrapper
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 865, in dispatch_request
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout rv = self.dispatch_request()
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout rv = self.handle_user_exception(e)
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
2025/01/22 00:41:29 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025/01/22 00:41:29 stdout response = self.full_dispatch_request()
2025/01/22 00:41:29 stdout File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app

系统信息

群晖DS223 (arm64)

Docker部署的lrcapi 版本1.5.7

补充信息

可能的解决方案: 更新网易云返回结果处理的逻辑

@yuhenghuang yuhenghuang added the bug Something isn't working label Jan 21, 2025
@HisAtri
Copy link
Owner

HisAtri commented Jan 21, 2025

@TooAndy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants