Fix for Discord user agent for files
This commit is contained in:
parent
2ade81b3be
commit
9905d91479
5
app.py
5
app.py
@ -293,8 +293,9 @@ def cdn_redirect(video_id):
|
||||
Only responds to requests from Discord bots.
|
||||
"""
|
||||
logger.info(f"{video_id}: CDN redirect request received")
|
||||
request_user_agent = request.headers.get('User-Agent', '').lower()
|
||||
if 'discordbot' not in request_user_agent:
|
||||
request_user_agent = request.headers.get('User-Agent', '')
|
||||
# Discord uses a more realistic user agent for file requests
|
||||
if 'Firefox/38.0' not in request_user_agent and 'Macintosh' not in request_user_agent:
|
||||
logger.info(f"{video_id}: Video CDN redirect ignored due to user agent ({request_user_agent})")
|
||||
return Response("Video not found", status=404)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user