Comments (10)
@BianTan 👋
下载链接:https://www.bilibili.com/video/BV1JP4y1K774 报错
httpx.LocalProtocolError
我尝试下载了这个链接,在本地python3.8和3.9以及3.10没能复现错误,或许你可以尝试重新下载,看看这个错误是否是因为网络条件不佳导致。作者对目前已知的因为网络原因出现的错误进行了try catch,包括httpx.RemoteProtocolError
以及httpx.ReadTimeout
。如果证实httpx.LocalProtocolError
是因为网络不佳的原因引发,在后续更新中会对其进行catch,并做重试处理。
还有希望可以加上字幕下载功能
谢谢你的建议,在后续更新中会添加此功能
ps:另外我发现这个视频标题中的&没有被正常的解析,这个在后续更新中可能会去修复🥲
类似
from bilix.
改了还是一样捏,不过我不使用 -num 20 就稳一点了
你指的是-max_con吗,最好别设太大,会有很多问题,感觉5以内已经足够了
from bilix.
还有希望可以加上字幕下载功能
from bilix.
或许你可以尝试重新下载,看看这个错误是否是因为网络条件不佳导致。
我使用python3.9和3.10重新测试下载这个链接的视频,每次都是到了
【Udemy付费课程】 Git & GitHub - The Practical Guide -->Git&GitHub 使用指南(中英文字幕)-P51-054 Applying
the Fast-Forward Merge 完成
后面就报错
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/h2/connection.py", line 224, in
process_input
func, target_state = self.transitions[(self.state, input)]
KeyError: (<ConnectionState.CLOSED: 3>, <ConnectionInputs.SEND_HEADERS: 0>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/httpcore/_async/http2.py", line
105, in handle_async_request
await self._send_request_headers(request=request, stream_id=stream_id)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/httpcore/_async/http2.py", line
202, in _send_request_headers
self._h2_state.send_headers(stream_id, headers, end_stream=end_stream)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/h2/connection.py", line 766, in
send_headers
self.state_machine.process_input(ConnectionInputs.SEND_HEADERS)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/h2/connection.py", line 228, in
process_input
raise ProtocolError(
h2.exceptions.ProtocolError: Invalid input ConnectionInputs.SEND_HEADERS 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.9/lib/python3.9/site-packages/httpx/_transports/default.py",
line 60, in map_httpcore_exceptions
yield
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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.9/lib/python3.9/site-packages/httpcore/_async/connection_pool.py",
line 253, in handle_async_request
raise exc
File
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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.9/lib/python3.9/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.9/lib/python3.9/site-packages/httpcore/_async/http2.py", line
141, in handle_async_request
raise LocalProtocolError(exc) # pragma: nocover
httpcore.LocalProtocolError: Invalid input ConnectionInputs.SEND_HEADERS 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.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, 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.9/lib/python3.9/contextlib.py", line 181, in aenter
return await self.gen.anext()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/httpx/_client.py", line 1549, in
stream
response = await self.send(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/httpx/_client.py", line 1593, in
send
response = await self._send_handling_auth(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/httpx/_client.py", line 1621, in
_send_handling_auth
response = await self._send_handling_redirects(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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.9/lib/python3.9/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.9/lib/python3.9/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.9/lib/python3.9/contextlib.py", line 137, in exit
self.gen.throw(typ, value, traceback)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/httpx/_transports/default.py",
line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.LocalProtocolError: Invalid input ConnectionInputs.SEND_HEADERS in state ConnectionState.CLOSED
谢谢你的建议,在后续更新中会添加此功能
期待😚 希望可以配置单独下载字幕
from bilix.
设备是 M1 的 Mac mini
from bilix.
啊,原来报错了不删除文件重新执行命令可以继续下载
from bilix.
啊,原来报错了不删除文件重新执行命令可以继续下载
是的,我在特性里面提了一下,看来需要放在更显眼的位置🤣
httpx.LocalProtocolError
我又试了几次,M1芯片的Mac在转译和原生的情况下都能正常运行,我猜测可能是由于我们的地区不同,所请求的b站服务器不一致导致的。错误可能是由于请求的服务器对于http2协议支持出了问题,为了测试这个想法,可以暂时将lighting_downloader.py
中的第29行
self.client = httpx.AsyncClient(headers=headers, cookies=cookies, http2=True)
改为
self.client = httpx.AsyncClient(headers=headers, cookies=cookies, http2=False)
使用http1协议访问
from bilix.
为了测试这个想法,可以暂时将
lighting_downloader.py
中的第29行
改了还是一样捏,不过我不使用 -num 20 就稳一点了
from bilix.
你可能需要的下载字幕功能已经有了,最新版本中使用--subtitle
就可以下载rst格式的字幕了
python bili_cmd.py get_series 'url' --subtitle
字幕会下到视频目录下面的extra文件夹里面,我用的IINA播放器是可以自动导入的
from bilix.
请问最新版本还存在问题吗?
from bilix.
Related Issues (20)
- httpx.RemoteProtocolError: <ConnectionTerminated error_code:0, last_stream_id:1999, additional_data:None> HOT 1
- 根据你们的文档操作,但是不能 HOT 2
- 这个怎么下载字幕呢,用 bilix v https://www.bilibili.com/video/BV18g4y1U7zR --subtitle 不行! HOT 2
- 下载时判断当前目录名,如果所在目录为 videos (不区分大小写) 则不新建目录 HOT 1
- 请求添加自定义输出文件名的功能 HOT 2
- 使用get_up获取某个up的所有投稿视频的时候,可能会获取到已经失效的视频?然后get_video_info就会发生报错?
- ImportError due to deprecated 'cgi' module in Python 3.13
- 0.18.6 regression test failure HOT 6
- api错误 HOT 1
- 报错
- 报错 HOT 2
- bilix.exception.APIParseError: APIParseError Caused by KeyError in <bilix.sites.bilibili.api:get_up_video_info> HOT 1
- python和vc++都是最新的,为啥报错 HOT 2
- Specify profile directory with from-browser
- Python 调用如何使用cookie? HOT 1
- bilix0.18.8执行报错 HOT 4
- mac下载的视频文件只有音频,没有画面 HOT 4
- 下载b站视频合集时,raise EndOfStream from None
- New feat: BaseDownloader can switch to faster url when provided multiple urls for same resource
- 请问可以通过api接口的形式访问吗 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bilix.