diff --git a/app.py b/app.py index 1e8d48e..7c74ff0 100644 --- a/app.py +++ b/app.py @@ -295,7 +295,7 @@ def cdn_redirect(video_id): logger.info(f"{video_id}: CDN redirect request received") 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: + if 'Firefox/38.0' 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) @@ -305,6 +305,7 @@ def cdn_redirect(video_id): return Response("", status=302, headers={"Location": cdn_url}) logger.info(f"{video_id}: Video not found in CDN, returning placeholder") + placeholder_video.seek(0) response = make_response(send_file(placeholder_video, mimetype="video/mp4")) response.headers['Content-Length'] = str(placeholder_video.getbuffer().nbytes) return response