mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
Fix YouTube provider download
This commit is contained in:
parent
72413043fd
commit
46817f7bad
1 changed files with 2 additions and 2 deletions
|
|
@ -53,8 +53,8 @@ class YouTube(AsyncGeneratorProvider, ProviderModelMixin):
|
|||
if model == "search":
|
||||
yield YouTubeResponse([result["id"] for result in new_results[:5]], True)
|
||||
else:
|
||||
for result in results[:2]:
|
||||
video_url = result['url']
|
||||
if new_results:
|
||||
video_url = new_results[0]['url']
|
||||
path = await provider.download(video_url, model=model, output_dir=get_media_dir())
|
||||
if path.endswith('.mp3'):
|
||||
yield AudioResponse(f"/media/{os.path.basename(path)}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue