How to block unwanted political posts suggested on Twitter — Make Twitter great again!
As a Canadian, I really find the American voting farce as annoying as it can get. It is almost as if the whole world is supposed to know about their political scams and the lack of presidential choices. Before this post turns into a rant, here is a recipe that was developed by Krakin’t in order to avoid the bad audiences. Furthermore, this doesn’t concern just the politics. It also concerns any content you wish to avoid.
You will notice how content and audience you may want to avoid clusters within popular posts, and how Twitter does not really hide content you have asked not to see. Simply put, sometimes it feels like they are rubbing it into your face.
So, here is a quick solution.
- Use Chrome
- Download Bot Sentinel add on for chrome (optional)
- Download Twitter One Click Block add on for chrome
- Navigate to a post you wish to block
- Right click anywhere and choose “Inspect”
- Click on a “Console” tab (see screenshot below)
7. Copy-paste this source code (correct the quotations beforehand):
var a=0;
document.querySelectorAll(‘[aria-label=”Block”]’).forEach(function(account) {
if(a>0){account.click();}
a++;
});
8. Press “Enter”
9. Scroll around, and repeat steps 7 and 8 as many times as you need.
Suddenly, like done by magic, you will see Twitter posting relevant content!
OK so here is an explanation on what this whole thing does. It is a bit raw, but it works! First, you use Sentinel Bot to rank the posts (this is optional). Second, you use the One Click Block to enable the script to be nice and clean. Third, you use the script to simply block everyone on the page!
The script skips the first account, which is the account that made a post, and then blocks all the replies to a post.
We may develop a script that blocks just the Sentinel Bot marked accounts, that automatically scrolls and so on… however, that would be a separate project, and we simply don’t have time for it.
Enjoy the clean Twitter !
Edit: Yeah, alright… here is the code for the selective block/unblock… please tweak it when/if necessary:
//SELECTIVE UNBLOCKING
let autoUnblock = setInterval(function() {
window.scrollBy(0, window.innerHeight);
var elList = document.querySelectorAll(‘.css-1dbjc4n .r-my5ep6’);
var a=0;
elList.forEach(function(el) {
if (el.innerHTML.indexOf(“Normal”) !== -1
|| el.innerHTML.indexOf(“Unknown”) !== -1 ){
el.querySelectorAll(‘[aria-label=”Blocked”]’).forEach(function(account) {
a++; account.click();
});
}
});
}, 3000);// TO STOP: clearInterval(autoUnblock)
//SELECTIVE BLOCKING
let autoBlock = setInterval(function() {
window.scrollBy(0, window.innerHeight);
var elList = document.querySelectorAll(‘.css-1dbjc4n .r-my5ep6’);
var a=0;
elList.forEach(function(el) {
if (el.innerHTML.indexOf(“Normal”) == -1
&& el.innerHTML.indexOf(“Unknown”) == -1 ){
el.querySelectorAll(‘[aria-label=”Block”]’).forEach(function(account) {
a++; account.click();
});
}
});
}, 3000);
// TO STOP: clearInterval(autoUnblock)