I have found a scenario in which trying to use the endpoint for downloading a video using bestvideo+bestaudio
fails.
[awjBLm41xJI]: requested with format bestvideo+bestaudio and subs None, configuring...
[awjBLm41xJI]: sending stream
[awjBLm41xJI]: stream will be merged (bestvideo+bestaudio)
[awjBLm41xJI]: end of data (no error reported)
cleanup[awjBLm41xJI]: killing downloader process (PID: 62)
INFO: 172.19.0.2:55686 - "GET /dl/awjBLm41xJI?f=bestvideo%2Bbestaudio HTTP/1.0" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 377, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 212, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 656, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 259, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 61, in app
response = await func(request)
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 226, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 159, in run_endpoint_function
return await dependant.call(**values)
File "/home/user/app/./server.py", line 23, in api_dl
first_chunk = await stream.__anext__() # peek first chunk
StopAsyncIteration
I have found that this seems to happen for some audio and video combinations when using the web UI as well. For example, here is a screenshot showing the configuration I attempted to use for this video through the web UI.