Skip to content

A python tool to sync Twitter lists between two accounts.

License

Notifications You must be signed in to change notification settings

simonbohnen/twitter-list-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter List Syncer

A python tool to sync Twitter lists between two accounts.

Usage

Get Twitter API keys

You need to create an app on the Twitter developer page for each of the two accounts. To do that, both accounts have to be Twitter developer accounts.

After creating the two apps, you can generate access tokens and secrets for both (see here). Please give them read & write permissions, direct message permissions are only required if you want to send a summary dm between the two accounts after syncing has finished.

You can paste the consumer keys & secrets and the access token keys & secrets into a file called env (see env.sample for the format).

Run in terminal

Install the required python-twitter package using $ pip3 install -r requirements.txt.

You can now load the environment variables using $ source env and then run the script with $ python3 main.py. If you add the -v flag, output will be verbose. The --dm flag sends a summary dm from the first account to the second after syncing.

Exclude lists from syncing

If you want to exclude a list, just add the word "exclude" in the description of that list.

Automation

I've deployed this script to an AWS Lambda function which runs once every day using a CloudWatch scheduled rule. To achieve that, I used this GitHub action.

I uploaded the environment variables using the aws-cli with the following command:

$ aws lambda update-function-configuration \
  --function-name FUNCTION_NAME_HERE \
  --environment Variables="{`cat env_aws | xargs | sed 's/ /,/g'`}"

The format is similar to the env file, see env_aws.sample.

About

A python tool to sync Twitter lists between two accounts.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages