diff --git a/src/api/status.ts b/src/api/status.ts index 9c8150c..620bc23 100644 --- a/src/api/status.ts +++ b/src/api/status.ts @@ -104,6 +104,16 @@ const populateTweetProperties = async ( apiTweet.color = colorFromPalette(mediaList[0].ext_media_color.palette); } */ + console.log('note_tweet', JSON.stringify(tweet.note_tweet)); + console.log('note tweet text', tweet.note_tweet?.note_tweet_results?.result?.text) + console.log('mediaList.length <= 0', mediaList.length <= 0) + console.log('tweet.legacy.entities?.urls?.length <= 0', tweet.legacy.entities?.urls?.length <= 0) + const noteTweetText = tweet.note_tweet?.note_tweet_results?.result?.text; + /* For now, don't include note tweets */ + if (noteTweetText && mediaList.length <= 0 && tweet.legacy.entities?.urls?.length <= 0) { + console.log('We meet the conditions to use new note tweets'); + apiTweet.text = unescapeText(noteTweetText); + } /* Handle photos and mosaic if available */ if ((apiTweet.media?.photos?.length || 0) > 1) { @@ -211,10 +221,10 @@ export const statusAPI = async ( if (tweet.reason === 'Protected') { writeDataPoint(event, language, wasMediaBlockedNSFW, 'PRIVATE_TWEET', flags); return { code: 401, message: 'PRIVATE_TWEET' }; - } else if (tweet.reason === 'NsfwLoggedOut') { - // API failure as elongator should have handled this - writeDataPoint(event, language, wasMediaBlockedNSFW, 'API_FAIL', flags); - return { code: 500, message: 'API_FAIL' }; + // } else if (tweet.reason === 'NsfwLoggedOut') { + // // API failure as elongator should have handled this + // writeDataPoint(event, language, wasMediaBlockedNSFW, 'API_FAIL', flags); + // return { code: 500, message: 'API_FAIL' }; } else { // Api failure at parsing status writeDataPoint(event, language, wasMediaBlockedNSFW, 'API_FAIL', flags); diff --git a/src/embed/status.ts b/src/embed/status.ts index b8c460d..df6f17f 100644 --- a/src/embed/status.ts +++ b/src/embed/status.ts @@ -295,7 +295,7 @@ export const handleStatus = async ( /* Push basic headers relating to author, Tweet text, and site name */ headers.push( ``, - ``, + ``, `` ); diff --git a/src/types/twitterTypes.d.ts b/src/types/twitterTypes.d.ts index dffbcb7..49932da 100644 --- a/src/types/twitterTypes.d.ts +++ b/src/types/twitterTypes.d.ts @@ -366,6 +366,19 @@ type GraphQLTweet = { media: TweetMedia[] } } + note_tweet: { + is_expandable: boolean; + entity_set: { + hashtags: unknown[]; + urls: unknown[]; + user_mentions: unknown[]; + }, + note_tweet_results: { + result: { + text: string; + } + } + }; card: { rest_id: string; // "card://1674824189176590336", legacy: {