From 346945c63830822af99cc23714e9d05a1e058b88 Mon Sep 17 00:00:00 2001 From: Roy Olav Purser Date: Sat, 25 May 2024 19:36:05 +0200 Subject: [PATCH] allow redirects --- bot.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index d665f3c..b2f4b4d 100644 --- a/bot.py +++ b/bot.py @@ -53,11 +53,12 @@ class CustomClient(discord.Client): timeout=aiohttp.ClientTimeout(total=5) ) as session: resp = await session.head( - "https://stream.purser.it/{stripped}/?provider=seafile&raw=true" + "https://stream.purser.it/{stripped}/?provider=seafile&raw=true", + allow_redirects=True, ) - raw = ( - ctype := resp.headers.get("content-type") - ) and "image" in ctype + raw = str( + (ctype := resp.headers.get("content-type")) and "image" in ctype + ).lower() await message.reply( content=f"https://stream.purser.it/{stripped}/?provider=seafile&raw={raw}"