allow redirects
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Roy Olav Purser 2024-05-25 19:36:05 +02:00
parent 9e164ff0f5
commit 346945c638
Signed by: roypur
GPG Key ID: 063DAA01D56E28CB

9
bot.py
View File

@ -53,11 +53,12 @@ class CustomClient(discord.Client):
timeout=aiohttp.ClientTimeout(total=5) timeout=aiohttp.ClientTimeout(total=5)
) as session: ) as session:
resp = await session.head( 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 = ( raw = str(
ctype := resp.headers.get("content-type") (ctype := resp.headers.get("content-type")) and "image" in ctype
) and "image" in ctype ).lower()
await message.reply( await message.reply(
content=f"https://stream.purser.it/{stripped}/?provider=seafile&raw={raw}" content=f"https://stream.purser.it/{stripped}/?provider=seafile&raw={raw}"