requests库中使用response.json()报错:json.decoder.JSONDecodeError: Expecting value
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json

·
报错
原因
请求得到的数据,不是标准的json格式数据,不能采用response.json()
函数解析,采用response.text
查看一下数据格式,发现多了jQueryxxxxxxxxx
解决
数据请求的地址为
url = 'https://liveapi.huya.com/moment/getMomentContent?callback=jQuery1124023700002544508125_1658109026112&videoId=699727183&uid=&_=1658109026118'
将地址里面的callback删除,变为
url = 'https://liveapi.huya.com/moment/getMomentContent?videoId=699727183&uid=&_=1658109026118'
改变url请求地址以后,再次使用response.json()
就可以了




适用于现代 C++ 的 JSON。
最近提交(Master分支:5 个月前 )
34665ae6
binary -> binary_t
Signed-off-by: Robert Chisholm <robert.chisholm@sheffield.ac.uk> 15 天前
f3dc4684
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.9 to 3.28.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0...b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 22 天前
更多推荐
所有评论(0)