下载链接:https://www.bilibili.com/video/BV1JP4y1K774
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-1813' coro=<Downloader._get_media() done, defined at
/Users/biandan/Desktop/Lighting-bilibili-download-0.3/lighting_downloader.py:336>
exception=LocalProtocolError('Invalid input ConnectionInputs.RECV_DATA in state ConnectionState.CLOSED')>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 224,
in process_input
func, target_state = self.transitions[(self.state, input)]
KeyError: (<ConnectionState.CLOSED: 3>, <ConnectionInputs.RECV_DATA: 11>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 111, in handle_async_request
status, headers = await self._receive_response(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 228, in _receive_response
event = await self._receive_stream_event(request, stream_id)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 259, in _receive_stream_event
await self._receive_events(request, stream_id)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 278, in _receive_events
events = await self._read_incoming_data(request)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 340, in _read_incoming_data
events = self._h2_state.receive_data(data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 1463,
in receive_data
events.extend(self._receive_frame(frame))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 1487,
in _receive_frame
frames, events = self._frame_dispatch_tableframe.class
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 1673,
in _receive_data_frame
events = self.state_machine.process_input(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 228,
in process_input
raise ProtocolError(
h2.exceptions.ProtocolError: Invalid input ConnectionInputs.RECV_DATA in state ConnectionState.CLOSED
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_transports/default.py",
line 60, in map_httpcore_exceptions
yield
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_transports/default.py",
line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File
"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/connection_pool.py",
line 253, in handle_async_request
raise exc
File
"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/connection_pool.py",
line 237, in handle_async_request
response = await connection.handle_async_request(request)
File
"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http_proxy.py", line
310, in handle_async_request
return await self._connection.handle_async_request(request)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 141, in handle_async_request
raise LocalProtocolError(exc) # pragma: nocover
httpcore.LocalProtocolError: Invalid input ConnectionInputs.RECV_DATA in state ConnectionState.CLOSED
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/biandan/Desktop/Lighting-bilibili-download-0.3/lighting_downloader.py", line 349, in _get_media
await asyncio.gather(*cors)
File "/Users/biandan/Desktop/Lighting-bilibili-download-0.3/lighting_downloader.py", line 366, in _get_media_part
async with self.client.stream("GET", random.choice(media_urls),
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 199, in aenter
return await anext(self.gen)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1549,
in stream
response = await self.send(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1593,
in send
response = await self._send_handling_auth(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1621,
in _send_handling_auth
response = await self._send_handling_redirects(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1658,
in _send_handling_redirects
response = await self._send_single_request(request)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1695,
in _send_single_request
response = await transport.handle_async_request(request)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_transports/default.py",
line 352, in handle_async_request
with map_httpcore_exceptions():
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_transports/default.py",
line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Invalid input ConnectionInputs.RECV_DATA in state ConnectionState.CLOSED
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 224,
in process_input
func, target_state = self.transitions[(self.state, input)]
KeyError: (<ConnectionState.CLOSED: 3>, <ConnectionInputs.RECV_DATA: 11>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 111, in handle_async_request
status, headers = await self._receive_response(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 228, in _receive_response
event = await self._receive_stream_event(request, stream_id)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 259, in _receive_stream_event
await self._receive_events(request, stream_id)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 278, in _receive_events
events = await self._read_incoming_data(request)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 340, in _read_incoming_data
events = self._h2_state.receive_data(data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 1463,
in receive_data
events.extend(self._receive_frame(frame))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 1487,
in _receive_frame
frames, events = self._frame_dispatch_tableframe.class
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 1673,
in _receive_data_frame
events = self.state_machine.process_input(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/h2/connection.py", line 228,
in process_input
raise ProtocolError(
h2.exceptions.ProtocolError: Invalid input ConnectionInputs.RECV_DATA in state ConnectionState.CLOSED
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_transports/default.py",
line 60, in map_httpcore_exceptions
yield
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_transports/default.py",
line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File
"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/connection_pool.py",
line 253, in handle_async_request
raise exc
File
"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/connection_pool.py",
line 237, in handle_async_request
response = await connection.handle_async_request(request)
File
"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http_proxy.py", line
310, in handle_async_request
return await self._connection.handle_async_request(request)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpcore/_async/http2.py",
line 141, in handle_async_request
raise LocalProtocolError(exc) # pragma: nocover
httpcore.LocalProtocolError: Invalid input ConnectionInputs.RECV_DATA in state ConnectionState.CLOSED
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/biandan/Desktop/Lighting-bilibili-download-0.3/bili_cmd.py", line 56, in
asyncio.run(main(parser.parse_args()))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 646, in
run_until_complete
return future.result()
File "/Users/biandan/Desktop/Lighting-bilibili-download-0.3/bili_cmd.py", line 9, in main
await d.get_series(args.key, quality=args.q, image=args.image)
File "/Users/biandan/Desktop/Lighting-bilibili-download-0.3/lighting_downloader.py", line 255, in get_series
await asyncio.gather(*cors)
File "/Users/biandan/Desktop/Lighting-bilibili-download-0.3/lighting_downloader.py", line 309, in get_video
await asyncio.gather(
File "/Users/biandan/Desktop/Lighting-bilibili-download-0.3/lighting_downloader.py", line 349, in _get_media
await asyncio.gather(*cors)
File "/Users/biandan/Desktop/Lighting-bilibili-download-0.3/lighting_downloader.py", line 366, in _get_media_part
async with self.client.stream("GET", random.choice(media_urls),
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 199, in aenter
return await anext(self.gen)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1549,
in stream
response = await self.send(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1593,
in send
response = await self._send_handling_auth(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1621,
in _send_handling_auth
response = await self._send_handling_redirects(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1658,
in _send_handling_redirects
response = await self._send_single_request(request)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1695,
in _send_single_request
response = await transport.handle_async_request(request)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_transports/default.py",
line 352, in handle_async_request
with map_httpcore_exceptions():
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_transports/default.py",
line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Invalid input ConnectionInputs.RECV_DATA in state ConnectionState.CLOSED