import { fetch } from "https://esm.town/v/std/fetch";
import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL?v=3";
export async function fetchTweet(url) {
const tweetId = url.match(/(\d{19})/)[1];
const tweetUrl =
`https://cdn.syndication.twimg.com/tweet-result?id=${tweetId}&lang=en`;
const res = await fetch(normalizeURL(tweetUrl), {
redirect: "follow",
});
const tweetData = await res.json();
return tweetData;
}