Pretend to be WhatsApp when fetching links

This commit is contained in:
Alex Gleason 2024-08-07 21:00:07 -05:00
parent ba241f0431
commit 5f1b87c3b6
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -13,7 +13,11 @@ async function unfurlCard(url: string, signal: AbortSignal): Promise<PreviewCard
debug(`Unfurling ${url}...`);
try {
const result = await unfurl(url, {
fetch: (url) => fetchWorker(url, { signal }),
fetch: (url) =>
fetchWorker(url, {
headers: { 'User-Agent': 'WhatsApp/2' },
signal,
}),
});
const { oEmbed, title, description, canonical_url, open_graph } = result;