mirror of
https://github.com/ReviveMii/revivetube
synced 2025-04-29 12:39:25 -04:00
Update revivetube.py
This commit is contained in:
parent
9008fc0da0
commit
d849478d32
1 changed files with 8 additions and 7 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Reference in a new issue