Samir Madhavan

Samir Madhavan

Generally curious.

Product & Tech Leader · Fintech · AI Engineer · Data Storyteller

← All posts

Project 1 - Twitter/X bot Remover

Its been long that I've been active on Twitter which is now called X. One thing that annoys me is that there are lot of followers that are bots and its very evident that they are bots by just looking at their user id.

I asked Claude on how I could remove them.

One of the options that it gave was manual which obviously won't work when you have 2000+ followers in the list.

It gave few websites that are official partner of X for which you have to pay.

There few chrome extensions which used to work once upon a time but as the front end code of X changes, that extension broke.

The X APIs are also paid.

Now either I could make a new Chrome extension myself or use something like Playwright to automatically navigate the website and take action on my behalf.

I went ahead with the Playwright approach.

The code opens upon a browser and hands over control to the user to perform the login. Once login is complete, the code takes over and navigates to the follower list. I've created regexes for suspicious username patterns which the code utilises to remove the follower.

The code can be run in permission mode where it will ask you before it removes the follower and it can also be run with full privileges without taking permission for removal.

The codebase can be found here.