Update revivetube.py

This commit is contained in:
TheErrorExe 2025-04-01 21:44:12 +02:00 committed by GitHub
parent 9008fc0da0
commit d849478d32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -86,14 +86,15 @@ async def get_thumbnail(video_id):
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(thumbnail_url) as response: async with session.get(thumbnail_url) as response:
if response.status == 200: if response.status == 200:
return await send_file( image_data = await response.read()
response.content, return Response(
mimetype=response.headers.get("Content-Type", "image/jpeg"), image_data,
as_attachment=False, mimetype=response.headers.get("Content-Type", "image/jpeg")
) )
return f"Failed to fetch thumbnail. Status: {response.status}", 500 return "Thumbnail not found", 404
except aiohttp.ClientError as e: except Exception as e:
return f"Error fetching thumbnail: {str(e)}", 500 print(f"Error fetching thumbnail: {str(e)}")
return "Internal server error", 500
async def get_video_comments(video_id, max_results=20): async def get_video_comments(video_id, max_results=20):
api_key = await get_api_key() api_key = await get_api_key()