From 2e483e474422d2f847e201854d9707a1ae123cda Mon Sep 17 00:00:00 2001 From: vulet Date: Sun, 6 Sep 2020 23:10:41 +0800 Subject: [PATCH] fix(nitter): unavailable tweet error --- commands/nitter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/nitter.js b/commands/nitter.js index 8fd17e0..2bbaa07 100644 --- a/commands/nitter.js +++ b/commands/nitter.js @@ -26,7 +26,7 @@ const nitter = async (instance, url) => { path: quote.querySelector('a.quote-link').href, text: quote.querySelector('.quote-text').innerHTML, } : null, - isReply: isReply && replies.length > 0 ? { + isReply: isReply && replies.length > 0 ? replies[replies.length - 1].classList.contains('unavailable') ? 'unavailable' : { path: replies[replies.length - 1].querySelector('a.tweet-link').href, text: replies[replies.length - 1].querySelector('.tweet-content').innerHTML, } : null, @@ -46,7 +46,7 @@ const card = (tweet, base, path) => `❤️ ${tweet.stats.favorites} ` + `
${tweet.text.replace('\n', '
')}
` + (tweet.hasAttachments ? '
This tweet has attached media.
' : '') + -(tweet.isReply ? `
Replied Tweet
${tweet.isReply.text.replace('\n', '
')}
` : '') + +(tweet.isReply ? tweet.isReply === 'unavailable' ? '
Replied Tweet is unavailable
' : `
Replied Tweet
${tweet.isReply.text.replace('\n', '
')}
` : '') + (tweet.quote ? `
Quoted Tweet
${tweet.quote.text.replace('\n', '
')}
` : ''); const run = async (matrixClient, { roomId }, userInput, registrar) => { const config = registrar.config.nitter;