Reputation: 1
a few years ago i found this website that lets you see random screenshots people took, and i wanna make that a command in my discord bot and it works but the images dont show up in discord.
heres what i have so far
if message.content.startswith(prefix + "rss"):
rss = ''.join(random.choices(string.ascii_lowercase+string.digits, k=6))
embed = discord.Embed(title="Random ScreenShot:", color=0x109319)
embed.set_image(url="https://prnt.sc/"+rss)
await message.channel.send(embed=embed)
Upvotes: 0
Views: 246
Reputation: 89
prnt.sc format is (iirc) 2 letters, 4 numbers.
The image you view on the page is hardcoded in the page in b64, so the URL to image you're trying to embed is not an image. If you're wanting a URL to the image, I was able to find it in the <head>
section in the og:image
meta tag
To get a URL to the image, make a get request to prnt.sc/xx0000, split and pop <meta property="og:image" content="
, then split at ">
and take element [0]
I have probably overcomplicated this.
A simpler solution would be to paste the prnt.sc link in chat and let discord grab the meta tags and handle the embeds on its end.
Upvotes: 1