diff --git a/src/scraper.ts b/src/scraper.ts index 29c9030..da15628 100644 --- a/src/scraper.ts +++ b/src/scraper.ts @@ -454,12 +454,14 @@ export class Scraper { text: string, replyToTweetId?: string, mediaData?: { data: Buffer; mediaType: string }[], + hideLinkPreview?: boolean, ) { return await createCreateTweetRequest( text, this.auth, replyToTweetId, mediaData, + hideLinkPreview, ); } diff --git a/src/tweets.ts b/src/tweets.ts index 13b3fda..a4d4962 100644 --- a/src/tweets.ts +++ b/src/tweets.ts @@ -444,6 +444,7 @@ export async function createCreateTweetRequest( auth: TwitterAuth, tweetId?: string, mediaData?: { data: Buffer; mediaType: string }[], + hideLinkPreview: boolean = false, ) { const onboardingTaskUrl = 'https://api.twitter.com/1.1/onboarding/task.json'; @@ -474,6 +475,10 @@ export async function createCreateTweetRequest( semantic_annotation_ids: [], }; + if (hideLinkPreview) { + variables["card_uri"] = "tombstone://card" + } + if (mediaData && mediaData.length > 0) { const mediaIds = await Promise.all( mediaData.map(({ data, mediaType }) =>