首页 > 其他 > 详细

Fixing getting video from bilibili.com by you-get

时间:2020-02-19 01:47:20      阅读:68      评论:0      收藏:0      [点我收藏+]
After the spring festival, I found that the bilibili video could not download normally.
The ERROR log:
[DEBUG] HTTP Error with code403
......
File "D:\Python36\Lib\json__init.py", line 348, in loads
‘not {!r}‘.format(s.
class.name__))
TypeError: the JSON object must be str, bytes or bytearray, not ‘NoneType‘

Log indicates that a website request was rejected.
When I use brower to play the video, it is normally.

Solution:
Adding the fake header info.
{
req.add_header(‘User-Agent‘, "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0 ")
}
in common.py (line 431) after
{
req = request.Request(url, headers=headers)
}

Result:
Try again, download the video normally.

Fixing getting video from bilibili.com by you-get

原文:https://blog.51cto.com/cfy10/2472112

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!