Renewing Embedded Discord Links
I'm currently trying to archive all my own posts, which includes downloading all their embedded files and attachments. I fetch all the channel messages and from what I've done it seems like direct attachments do work; but embeds like a copy/pasted
cdn.discordapp.com/attachments/.../.../file.jpg file will not renew.
More specifically a link like https://media.discordapp.net/attachments/987627219973210124/1127972112628453449/snapchat.gif which is from the gif selector does show up in my client, but not to my bot because it lacks the signature queries.
Is there a way to get them to renew so they can be downloaded?13 Replies
the gif in question when pasted in a message:
https://media.discordapp.net/attachments/987627219973210124/1127972112628453449/snapchat.gif
the original link is just:
https://media.discordapp.net/attachments/987627219973210124/1127972112628453449/snapchat.gif
discord populates my client with the signatures:
https://media.discordapp.net/attachments/987627219973210124/1127972112628453449/snapchat.gif?ex=68e871a4&is=68e72024&hm=3f9c088c21ba928467feff5f92d977655617a296f09e7b1d3bbb51f0e1f655b6&Refetch the message
Consider storing your pictures elsewhere. This is intentional design by Discord
you might need to clarify, they are already fetched are they not? it's because it's a content link that it won't give me the signature that renews it
and yes yes the point is to grab them to archive them on my own database
edited in a clarifier the messages are fetched from the channel, so i already have their objects and whatnot
Is the link not in the content?
yea the link is in the content, so i'm trying to get it from
message.embeds as opposed to message.attachmentsWhat path did you use to extract the image from the embed?
embed.url and embed.data.url which seem to be the same
here's the code, it fails at !res.ok because content doesn't exist:
Is it not in the embed.image.url?
I don’t remember how url embeds are structured
embed.image.url returns an empty string all the time, even for images that work. embed.url seems to only have the link. maybe it'd be populated if it was bot embeds or something
still looking for a solution, i'm thinking it isn't possible. i attempted to attach the URL as an attachment in a new temp message to get it refreshed but that doesn't work.
it seems like you can only get the CDN to renew it if it's a direct attachment, not a link (even though the actual client does renew it)https://github.com/Sapphire-Discord-Bot/images Sapphire has come up with a solution like this, you could check it out
gotcha, so i'm just gonna drop it as "not possible" since the links are from other servers. i'll have to save the message links and download them manually from my client