Skip to main content

How to Make a Simple Reddit to Twitter Bot (Python) Part 1

So why make a Reddit to Twitter bot? I don't know. I made it because it's a fun project that can be made as simple or as complex as you want. I also like to get all my soccer (football) news in one place, and r/soccer is usually the fastest aggregator of breaking news.

In this tutorial, we will write a python script that posts the top 10 hourly soccer posts on twitter. I am going to show you how to get your bot up and running quickly, so I will skip a lot of details.

Prerequisites: basic python knowledge

Getting Reddit API Access

1.  Go to https://www.reddit.com/prefs/apps/
2.  Click on create app.

                                     
3.  Name it whatever you like. Choose scripts as type and set local host (http://127.0.0.1) as your redirect url. 

4. Note down the personal use scripts code, and the secret code. Keep it in a secure place. 


5.  Install Praw -pip install praw on cmd
6. Go to Python37\Lib\site-packages\praw\praw.ini and add the codes that you noted down in step 4. create [bot1] if you cannot find it. user_agent = PyEng Bot 0.1



Getting Twitter API Access

1. Go to https://developer.twitter.com/en/apps

2. Click on create App, follow instructions and fill in all the fields. Use localhost for callback url.

3. Wait for 1-2 days until you get developer access and come back for part 2 of this series.






Comments