From d3d9f4ae2fa6f785a4293f02d21f7220f2ce8299 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Mon, 24 Oct 2022 19:53:14 +1100 Subject: Fix tweets with only video breaking embeds --- src/api/util/utility/EmbedHandlers.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/api') diff --git a/src/api/util/utility/EmbedHandlers.ts b/src/api/util/utility/EmbedHandlers.ts index 831cab9a..700f5b55 100644 --- a/src/api/util/utility/EmbedHandlers.ts +++ b/src/api/util/utility/EmbedHandlers.ts @@ -165,22 +165,22 @@ export const EmbedHandlers: { [key: string]: (url: URL) => Promise { return EmbedHandlers["www.twitter.com"](url); }, "www.twitter.com": async (url: URL) => { const token = Config.get().external.twitter; - if (!token) return null; // todo move to config + if (!token) return null; if (!url.href.includes("/status/")) return null; // TODO; const id = url.pathname.split("/")[3]; // super bad lol if (!parseInt(id)) return null; - const endpointUrl = `https://api.twitter.com/2/tweets/${id}` - + `?expansions=author_id,attachments.media_keys` - + `&media.fields=url,width,height` - + `&tweet.fields=created_at,public_metrics` - + `&user.fields=profile_image_url`; + const endpointUrl = `https://api.twitter.com/2/tweets/${id}` + + `?expansions=author_id,attachments.media_keys` + + `&media.fields=url,width,height` + + `&tweet.fields=created_at,public_metrics` + + `&user.fields=profile_image_url`; const response = await fetch(endpointUrl, { @@ -225,7 +225,7 @@ export const EmbedHandlers: { [key: string]: (url: URL) => Promise 0) { embed.image = { width: media[0].width, height: media[0].height, -- cgit 1.4.1