api/reddit: add a filename to returned gifs

This commit is contained in:
wukko 2024-08-31 14:27:46 +06:00
parent 10717c69f6
commit 892b875e3f
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -73,9 +73,12 @@ export default async function(obj) {
data = data[0]?.data?.children[0]?.data;
const id = `${String(obj.sub).toLowerCase()}_${obj.id}`;
if (data?.url?.endsWith('.gif')) return {
typeId: "redirect",
urls: data.url
urls: data.url,
filename: `reddit_${id}.gif`,
}
if (!data.secure_media?.reddit_video)
@ -109,8 +112,6 @@ export default async function(obj) {
}).catch(() => {})
}
let id = `${String(obj.sub).toLowerCase()}_${obj.id}`;
if (!audio) return {
typeId: "redirect",
urls: video