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

ptyhon小白,下载报错不知如何解决!!!!! #88

Open
say1921 opened this issue Apr 11, 2020 · 2 comments
Open

ptyhon小白,下载报错不知如何解决!!!!! #88

say1921 opened this issue Apr 11, 2020 · 2 comments

Comments

@say1921
Copy link

say1921 commented Apr 11, 2020

执行代码时在windows环境报错:raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

=============================================================

2020-04-11 12:30:21 main.py:106 [INFO] 未查找到歌曲 就值得了爱 对应的ID
2020-04-11 12:30:22 main.py:106 [INFO] 未查找到歌曲 去看星星好不好 对应的ID
Traceback (most recent call last):
File "main.py", line 209, in
main()
File "main.py", line 189, in main
res = [i for i in song_infos if i['data'] == True]
File "main.py", line 189, in
res = [i for i in song_infos if i['data'] == True]
File "C:\Users\dream\AppData\Local\Programs\Python\Python37\lib\concurrent\futures_base.py", line 598, in result_iterator
yield fs.pop().result()
File "C:\Users\dream\AppData\Local\Programs\Python\Python37\lib\concurrent\futures_base.py", line 435, in result
return self.__get_result()
File "C:\Users\dream\AppData\Local\Programs\Python\Python37\lib\concurrent\futures_base.py", line 384, in __get_result
raise self.exception
File "C:\Users\dream\AppData\Local\Programs\Python\Python37\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "main.py", line 117, in get_song_info
contents = json.loads(r.text,strict=False)
File "C:\Users\dream\AppData\Local\Programs\Python\Python37\lib\json_init
.py", line 361, in loads
return cls(**kw).decode(s)
File "C:\Users\dream\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\dream\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@CharlesPikachu
Copy link

可以试试这个项目:https://github.com/CharlesPikachu/Music-Downloader

@wymli
Copy link

wymli commented May 19, 2020

main.py get_song_info函数 113行
修改contents = json.loads(r.text)为

    song_info = {}
    contents = {}
    try:
        contents = json.loads(r.text)
    except:
        contents['errorCode'] = 0

错误原因可能是requests请求超时导致返回了空的response,无法被json解析

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants