Skip to content

Commit

Permalink
fix quote tweets not loading after some point
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Sep 11, 2023
1 parent 0301418 commit 2842768
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion scripts/apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion scripts/tweetviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2842768

Please sign in to comment.