We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make astro file with this content?
--- import '@/tweet.css'; import { expandTwitterShortenedUrlsRemoveTwitterAnchors } from '@/lib/cheerio' export interface Props { id: string; } const { id } = Astro.props; async function fetchTweet(id: string) { try { const oembedUrl = new URL('https://publish.twitter.com/oembed'); oembedUrl.searchParams.set('url', id); oembedUrl.searchParams.set('omit_script', 'true'); oembedUrl.searchParams.set('dnt', 'true'); return (await fetch(oembedUrl).then((res) => res.json())) as { url: string; author_name: string; author_url: string; html: string; }; } catch (e) { console.error( `[error] astro-embed ${e.status} - ${e.statusText}: Failed to fetch tweet ${id}` ); } } const tweet = await fetchTweet(id); const html = (await expandTwitterShortenedUrlsRemoveTwitterAnchors(tweet?.html.replace(/twitter.com/g, 'nitter.net'))).html() --- {tweet && <astro-embed-tweet set:html={html} />}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the Bug
Steps to Reproduce
make astro file with this content?
The text was updated successfully, but these errors were encountered: