Created
January 16, 2025 10:04
Revisions
-
z0rs created this gist
Jan 16, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ ``` (async function () { const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); async function scrollToLoadMore() { console.log("Scrolling to load more replies..."); window.scrollTo(0, document.body.scrollHeight); // Scroll ke bawah await delay(2000); } async function clickMuteButton() { let accountsMuted = 0; const replies = document.querySelectorAll('[data-testid="tweet"]'); for (const reply of replies) { const blueCheck = reply.querySelector('svg[aria-label="Verified account"]'); const replyText = reply.querySelector('[data-testid="tweetText"]')?.textContent || ''; const isShortReply = replyText.split(' ').length <= 5; // Cek apakah reply pendek if (blueCheck || isShortReply) { const moreOptionsButton = reply.querySelector('[aria-label="More"]'); if (moreOptionsButton) { moreOptionsButton.click(); await delay(500); const muteButton = Array.from(document.querySelectorAll('[role="menuitem"]')) .find(item => item.textContent.includes('Mute')); if (muteButton) { muteButton.click(); console.log(`Muted an account${blueCheck ? ' (blue check)' : ''}${isShortReply ? ' (short reply)' : ''}!`); accountsMuted++; await delay(1000); } } } } return accountsMuted; } async function processRepliesUntilDone() { let totalMuted = 0; let retries = 0; while (retries < 10) { console.log(`Scanning... Attempt ${retries + 1}`); const accountsMuted = await clickMuteButton(); totalMuted += accountsMuted; if (accountsMuted === 0) { retries++; console.log("No new accounts found. Scrolling to load more replies..."); await scrollToLoadMore(); } else { retries = 0; } if (retries >= 10) { console.log("No more replies to process. Stopping..."); break; } } console.log(`Finished processing. Total accounts muted: ${totalMuted}`); } console.log("Starting script to mute all blue check accounts and short replies..."); await processRepliesUntilDone(); console.log("Script finished."); })(); ```