138

GitHub - cuducos/twitter-cleanup: ? Clean-up stale accounts and bots from your T...

 5 years ago
source link: https://github.com/cuducos/twitter-cleanup
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Twitter Clean-up

?? Versão em português do Brasil

Tiny script to clean-up your Twitter account:

  • Removing users that have not been tweeting for a while
  • Soft-blocking bots (blocks and immediately unblocks the account, so it stops following you)

Requirements

Running

Inside a Python virtualenv:

  1. Copy .env.sample as .env and insert your credentials accordingly
  2. Install the dependencies with pip install -r requirements.txt
  3. Start the interactive console with python -i cleanup.py

Removing idle accounts

Call the method cleanup.unfollow_inactive_for(**kwargs).

It accepts any keyword argument compatible with Python's timedelta. It will prompt you before unfollowing anyone.

For example, to unfollow users inactive for the last 30 days:

>>> cleanup.unfollow_inactive_for(days=30)

Soft-blocking bots

Call the function soft_block_bots(threshold=None).

The threshold value is a float between 0 and 1. Every public account is analyzed using Botometer and all acounts with a higher probability than the threshold would be considered a bot. It will prompt you before soft-blocking anyone.

For example, to run with the default threshold (0.75):

>>> cleanup.soft_block_bots()

Or to run with a custom threshold:

>>> cleanup.soft_block_bots(threshold=0.68)

Contributing

Please, format your code with Black.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK