From 030141887b3181ccd0b7e1c276e8982fabe78097 Mon Sep 17 00:00:00 2001 From: dimden Date: Tue, 12 Sep 2023 02:37:12 +0300 Subject: [PATCH] fix tweet length counting --- scripts/apis.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/apis.js b/scripts/apis.js index 8ae4fb6a..0626e4d1 100644 --- a/scripts/apis.js +++ b/scripts/apis.js @@ -2494,7 +2494,8 @@ const API = { variables.attachment_url = tweet.attachment_url; } debugLog('tweet.postV2', 'init', {tweet, variables}); - fetch(`https://twitter.com/i/api/graphql/${text.length > 280 ? 'pokID4auGUSzBxijrqpIlw/CreateNoteTweet' : 'tTsjMKyhajZvK4q76mpIBg/CreateTweet'}`, { + let parsedTweet = twttr.txt.parseTweet(text); + fetch(`https://twitter.com/i/api/graphql/${parsedTweet.weightedLength > 280 ? 'pokID4auGUSzBxijrqpIlw/CreateNoteTweet' : 'tTsjMKyhajZvK4q76mpIBg/CreateTweet'}`, { method: 'POST', headers: { "authorization": OLDTWITTER_CONFIG.public_token,