Skip to content

Scrape your twitter account for promoted content and block the source. You Pay - I Block!

License

Notifications You must be signed in to change notification settings

kautzz/twitter-problock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

twitter-problock

Scrape your twitter account for promoted content and block the source.

You Pay - I Block!

Note, Read This:

Scraping and automating things on twitter are not allowed according to their TOS. There is a good chance that your account gets banned! Seriously, only use this tool if you're okay with loosing your account!

I'm not responsible for your account getting shut down! You have been warned!!!

Background:

Twitter has been ramping up the amount of promoted tweets in my timeline recently. I don't like ads, most of the time they are not relevant. I hate when people pay money to try to get my attention - I started blocking them, manually.

Original Tweet

This has been fun for a while and oddly comforting whenever I hit that block button. After a while I got addicted, now I need more blocking, mooooaaaaarrrrr! No, I'm not a cheap guy - I would happily pay for twitter pro without ads... if there ever was such a thing.

What This Tool Is Doing:

  • use selenium to drive a browser ✓
  • log in to twitter account ✓
  • scrape timeline ✓
  • find any tweet marked with "promoted" ✓
  • block the account that promoted the tweet by clicking more > block @user > confirm ✓

Output Sample:

[☩] Loading Target: https://twitter.com/login
[☑] Logged In As User: XXX

-------------------------------
[⚠] Promoted Tweet Found!
[⊘] Blocking User: YYY
[☭] Blocked 1/10 Promoters
===============================
[⚠] Promoted Tweet Found!
[⊘] Blocking User: ZZZ
[☭] Blocked 2/10 Promoters
===============================
.
.
.

Does It Actually Work?:

It does. Twitter seems to deliver less promoted content on web-browsers than in the native app so finding promoted tweets and blocking their source with this tool takes quite a while but it steadily grew my list of blocked accounts. As the list got longer and longer I now have to scroll quite a while on my phone to find any promoted tweets :)

Setup (WIP)

  • install Firefox & geckodriver
  • set up python and dependencies (you can use anaconda and the environment file included)
  • add your twitter handle and password to the secrets file
  • let her rip
python -m twitter_problock

For more output:

python -m twitter_problock -v

Approaches That Did Not Work:

  • using the twitter API to retrieve the timeline as the response does not contain promoted tweets

  • use the twitter API to add promoting accounts to the block list - you have to apply for an API key, even if I get one... other ppl using problock might not be so lucky. API keys could also be revoked...

  • not using selenium but mechanicalsoup or something else

<h1>JavaScript is not available.</h1>
<p>We’ve detected that JavaScript is disabled in this browser. Please enable JavaScript or switch to a supported browser to continue using twitter.com. You can see a list of supported browsers in our Help Center.</p>

About

Scrape your twitter account for promoted content and block the source. You Pay - I Block!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages