Skip to content

Looks up posts from reddit and automatically posts them on Twitter.

License

Notifications You must be signed in to change notification settings

Madbrad200/reddit-twitter-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

reddit Twitter Bot (UPDATED)

A Python bot that looks up new posts from a subreddit and automatically posts them on Twitter.

With an understanding of Python, and some brief understanding of PRAW and tweepy, you should be able to edit it with ease. By default:

  • The script is ran every hour (3600 seconds), assuming it is still online.
  • It cannot be ran as-is - you need to edit in the subreddit you wish to follow, and the Twitter/Reddit ID's/secrets.
  • You'll need to create a txt file for caching results (name it posted_cache.txt - make sure you edit the code if you name it something different).
  • Default delay between tweets is 30 seconds.
  • By default, the script looks up the last 10 NEW posts. It the checks if it's tweeted them already or not - if not, it'll tweet them.

All this can be edited if you wish.

Disclaimer

I hold no liability for what you do with this script or what happens to you by using this script. Abusing this script can get you banned from Twitter, so make sure to read up on proper usage of the Twitter API.

Dependencies

You will need to install Python's tweepy and PRAW libraries first. I personally recommend using poetry do manage this, but you can install them via pip if you please.

You will also need to create an app account on Twitter: [instructions]

  1. Sign in with your Twitter account
  2. Create a new app account
  3. Modify the settings for that app account to allow read & write
  4. Generate a new OAuth token with those permissions
  5. Manually edit this script and put those tokens in the script . (note - by default your app will have Essential perms. With these perms, you must use the client class within tweepy (TWITTER API V2 REFERENCE))

And a Reddit account:

  1. Go to https://www.reddit.com/
  2. Click Sign Up (top right on desktop) and fill out the necessary items.
  3. Once logged in, you may wish to verify your email.
  4. Go to the apps page https://old.reddit.com/prefs/apps/
  5. Click Create another app... at the bottom. Fill out relevant details.
  6. Your app client_id is located under the app name, e.g "-x1_KIHUOOJmk". The secret is below this as well.

Usage

Once you edit the bot script to provide the necessary API keys and the subreddit you want to tweet from, you can run the bot on the command line:

python reddit_twitter_bot.py

Or if you use poetry: poetry run python reddit_twitter_bot.py

Look into the script itself for configuration options of the bot.

Have questions? Need help with the bot?

If you're having issues with or have questions about the bot, please file an issue in this repository so one of the project managers can get back to you. Please check the existing (and closed) issues to make sure your issue hasn't already been addressed.

About

Looks up posts from reddit and automatically posts them on Twitter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%