Get Twitter Comments list with this script

Copy the JavaScript code below. To use it, open the tweet you want to check in your desktop browser, then paste the code into the browser's console.

And hit the enter button.

  let replies=[],ads=[],shortReplies=[],duplicateReplies=[],originalPost=null,capturedRows=new Set,previousReplyCount=0,noNewRepliesScrollCount=0;const shift=3;function countWords(e){const t=e.match(/[\p{L}\p{M}]+(?:\s+|$)/gu);return t?t.length:0}function encrypt(e){return e.split("").map((e=>{const t=e.charCodeAt(0);if(e.match(/[a-zA-Z]/)){const r=e.toLowerCase()===e?97:65;return String.fromCharCode((t-r+3)%26+r)}return e.match(/[0-9]/)?String.fromCharCode((t-48+3)%10+48):t>=2304&&t<=2431?String.fromCharCode(t+3):e})).join("")}function encryptObject(e){const t={};for(const r in e)e.hasOwnProperty(r)&&(t[encrypt(r)]="string"==typeof e[r]?encrypt(e[r]):String(e[r]));return t}function findDuplicateReplies(){const e=new Map,t=new Set;replies.forEach((r=>{const{replyText:n,username:o}=r;e.has(n)?t.add(n):e.set(n,o)})),t.forEach((e=>{replies.filter((t=>t.replyText===e)).forEach((e=>duplicateReplies.push(e)))}))}function logRepliesWithNumberedIndex(e){return e.map(((e,t)=>`${t+1}. ${e.fullName}`)).join("\n")}function extractRepliesAndAds(){const e=document.querySelectorAll('div[data-testid="cellInnerDiv"]');for(let t of e){const e=t.querySelector("h2");if(e&&"Discover more"===e.innerText.trim())return console.log("Reached 'Discover more', stopping further processing."),!1;if(!capturedRows.has(t)){const e=t.querySelector('article[data-testid="tweet"]');if(e){const r=e.querySelector('div[data-testid="User-Name"]').childNodes,n=e.querySelector('div > div > div[dir="ltr"] > span');if(n&&"Ad"===n.innerText.trim()){const e=r[1].querySelector('a[role="link"] div[dir="ltr"] span'),n=r[0].querySelector('a[role="link"] div[dir="ltr"] span span'),o=t.querySelector('div[data-testid="tweetText"]'),l=o?o.innerText:"No text found",i=e?e.innerText:"Unknown Username",s=n?n.innerText:`${i}`;ads.push({username:i,fullName:s,adText:l})}else if(originalPost){const t=r[1].querySelector('a[role="link"] div[dir="ltr"] span'),n=r[0].querySelector('a[role="link"] div[dir="ltr"] span span'),o=e.querySelector('div[data-testid="tweetText"]'),l=r[1].querySelector('a[dir="ltr"] time');if(t&&o&&t.innerText!==originalPost.username){const e=t?t.innerText:"Unknown Username",r=n?n.innerText:`${e}`,i=o.innerText,s=countWords(i),a=l?l.dateTime:null,c=l?l.innerText:null;replies.push({username:e,fullName:r,replyText:i,wordCount:s,timeStamp:a,time:c})}}else{const t=r[1].querySelector('a[role="link"] div[dir="ltr"] span'),n=r[0].querySelector('a[role="link"] div[dir="ltr"] span span'),o=e.querySelector('div[data-testid="tweetText"]');t&&o&&(originalPost={username:t?t.innerText:"Unknown Username",fullName:n?n.innerText:`${username}`,replyText:o.innerText,wordCount:countWords(o.innerText)})}}capturedRows.add(t)}}return console.log(`Captured ${replies.length} replies and ${ads.length} ads so far.`),console.log(`Captured ${shortReplies.length} short replies `),!0}function autoScrollAndExtract(){let e=0;const t=setInterval((()=>{window.scrollBy(0,1e3);if(extractRepliesAndAds()){if(replies.length===previousReplyCount?noNewRepliesScrollCount+=1:noNewRepliesScrollCount=0,previousReplyCount=replies.length,noNewRepliesScrollCount>=2||++e>=100){clearInterval(t),console.log("Scrolling stopped. All replies and ads are captured."),findDuplicateReplies();const e=replies.map((e=>encryptObject(e)));console.log("Encrypted Replies:",e)}}else{clearInterval(t),console.log('Reached "Discover more" section. Stopping the scroll.'),findDuplicateReplies();const e=replies.map((e=>encryptObject(e)));console.log("Encrypted Replies:",e)}}),2e3)}extractRepliesAndAds(),autoScrollAndExtract();
                                 
                                

Browser Scroll Top with this script

Copy the JavaScript code below. To use it, open the tweet you want to "scroll top" in your desktop browser, then paste the code into the browser's console.

And hit the enter button.

 function scrollToTopSmoothly(o){const n=window.scrollY,t=performance.now();requestAnimationFrame((function l(e){const c=e-t,r=Math.min(c/o,1),i=r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2;window.scrollTo(0,n*(1-i)),r<1?requestAnimationFrame(l):console.log("Scrolling to the top complete.")}))}scrollToTopSmoothly(2e3);