小小怪_ 发表于 2023-10-26 20:48:35

爬学习通的视频为什么会出现这个

本帖最后由 小小怪_ 于 2023-10-26 20:50 编辑

Traceback (most recent call last):
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
    response = self._make_request(
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 461, in getresponse
    httplib_response = super().getresponse()
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1322, in getresponse
    response.begin()
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin
    version, status, reason = self._read_status()
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 272, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen
    retries = retries.increment(
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\util.py", line 38, in reraise
    raise value.with_traceback(tb)
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
    response = self._make_request(
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 461, in getresponse
    httplib_response = super().getresponse()
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1322, in getresponse
    response.begin()
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin
    version, status, reason = self._read_status()
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 272, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\深职院\编程\Python\Python\刷课软件\爬学习通.py", line 241, in <module>
    my_sk.video()
File "D:\深职院\编程\Python\Python\刷课软件\爬学习通.py", line 233, in video
    video_weizhi = requests.get(video_link, headers=header, params=params3)
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
File "D:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))


大佬们,我访问学习通的视频的地址,为什么会返回的这个

陶远航 发表于 2023-10-26 20:48:51

这个错误在爬取学习通视频时出现,是由于连接被中断而导致的。可能是因为服务器端关闭了连接或者发生了其他网络问题。你可以尝试重新运行代码,或者检查网络连接是否正常。如果问题仍然存在,可能需要进一步排查代码或者与平台提供商联系以获取支持。
请注意,本回答来自GPT-4
如果问题已经解决,请设置最佳答案

isdkz 发表于 2023-10-26 20:49:02

这个错误是由于连接异常导致的。具体来说,它是由学习通服务器在没有响应的情况下关闭了连接引起的。

这种错误通常有以下几种可能的原因:

1. 网络连接问题:可能是你的网络连接不稳定或中断导致的。你可以尝试重新运行代码,或者检查你的网络连接是否正常。

2. 服务器问题:学习通服务器可能出现了故障或不稳定的情况,导致无法正常响应你的请求。你可以稍后再试,或者联系学习通的技术支持团队进行咨询。

3. 请求频率限制:学习通可能对请求频率进行了限制,如果你发送过多的请求,服务器可能会关闭连接。你可以尝试降低请求频率,或者使用代理来隐藏你的真实IP地址。

综上所述,你可以先检查你的网络连接是否正常,然后尝试重新运行代码。如果问题仍然存在,你可以尝试与学习通的技术支持团队联系以获取更多帮助。
页: [1]
查看完整版本: 爬学习通的视频为什么会出现这个