decode entity references from tweets

apparently *some* tweets have those ☹
This commit is contained in:
dakkar 2024-02-03 12:05:08 +00:00
parent a981bca7a3
commit 1bb5021c54
1 changed files with 2 additions and 1 deletions

View File

@ -584,7 +584,8 @@ export class ImportNotesProcessorService {
try { try {
const date = new Date(tweet.created_at); const date = new Date(tweet.created_at);
const textReplaceURLs = tweet.entities.urls && tweet.entities.urls.length > 0 ? await replaceTwitterUrls(tweet.full_text, tweet.entities.urls) : tweet.full_text; const decodedText = tweet.full_text.replaceAll('&gt;','>').replaceAll('&lt;','<').replaceAll('&amp;','&');
const textReplaceURLs = tweet.entities.urls && tweet.entities.urls.length > 0 ? await replaceTwitterUrls(decodedText, tweet.entities.urls) : decodedText;
const text = tweet.entities.user_mentions && tweet.entities.user_mentions.length > 0 ? await replaceTwitterMentions(textReplaceURLs, tweet.entities.user_mentions) : textReplaceURLs; const text = tweet.entities.user_mentions && tweet.entities.user_mentions.length > 0 ? await replaceTwitterMentions(textReplaceURLs, tweet.entities.user_mentions) : textReplaceURLs;
const files: MiDriveFile[] = []; const files: MiDriveFile[] = [];