From 28427688ebd1939512a9afc1ef179dfc885073d0 Mon Sep 17 00:00:00 2001 From: dimden Date: Tue, 12 Sep 2023 02:48:40 +0300 Subject: [PATCH] fix quote tweets not loading after some point --- scripts/apis.js | 11 ++++++++++- scripts/tweetviewer.js | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/apis.js b/scripts/apis.js index 0626e4d1..68be3acb 100644 --- a/scripts/apis.js +++ b/scripts/apis.js @@ -3444,9 +3444,18 @@ const API = { return parseTweet(tweetData); }).filter(t => t); + let newCursor = entries.find(e => e.entryId.startsWith('cursor-bottom-')); + if(!newCursor) { + let replacerEntry = data.data.search_by_raw_query.search_timeline.timeline.instructions.find(i => i.entry_id_to_replace && i.entry_id_to_replace.startsWith('cursor-bottom-')); + if(replacerEntry) { + newCursor = replacerEntry.entry.content.value; + } + } else { + newCursor = newCursor.content.value; + } let out = { list, - cursor: entries.find(e => e.entryId.startsWith('cursor-bottom-')).content.value + cursor: newCursor }; debugLog('tweet.getQuotes', 'end', id, out); resolve(out); diff --git a/scripts/tweetviewer.js b/scripts/tweetviewer.js index abea257e..7a942f91 100644 --- a/scripts/tweetviewer.js +++ b/scripts/tweetviewer.js @@ -400,6 +400,7 @@ class TweetViewer { } catch(e) { console.error(e); tvl.hidden = true; + this.container.getElementsByClassName('retweets_with_comments-more')[0].innerText = LOC.load_more.message; return this.retweetCommentsCursor = undefined; } let retweetDiv = document.getElementsByClassName('retweets_with_comments')[0]; @@ -431,6 +432,7 @@ class TweetViewer { } else { this.container.getElementsByClassName('retweets_with_comments-more')[0].hidden = false; } + this.container.getElementsByClassName('retweets_with_comments-more')[0].innerText = LOC.load_more.message; for(let i in tweetRetweeters) { await this.appendTweet(tweetRetweeters[i], retweetDiv); @@ -2523,7 +2525,8 @@ class TweetViewer { let id = location.pathname.match(/status\/(\d{1,32})/)[1]; this.updateRetweets(id, this.retweetCursor); }); - document.getElementsByClassName('retweets_with_comments-more')[0].addEventListener('click', async () => { + document.getElementsByClassName('retweets_with_comments-more')[0].addEventListener('click', async e => { + e.target.innerText = LOC.loading_tweets.message; if(!this.retweetCommentsCursor) return; let id = location.pathname.match(/status\/(\d{1,32})/)[1]; this.updateRetweetsWithComments(id, this.retweetCommentsCursor);