insta_reddit
- Download top K posts from a subreddit (chosen r/unethicallifeprotips for this).
- Generate an image out of those posts.
- Generate a caption for those posts.
- Upload them to an Instagram account.
Installation
Setting up credentials
- Get PRAW credentials from Reddit.
- Setup a service account to use Google Sheets as a DB.
- Download the service account JSON from the step above and add it to your repo. Use the screenshot below for reference.
At the end of all the setup, the credentials file should look like this:
Support modules
Install requirements by running:
pip install -r requirements.txt
Link to install the "arial.ttf" font if you need it.
You'll also need nltk
, used to generate captions.
Run the following (one-time effort) from a Python3 shell.
import nltk
nltk.download("punkt")
nltk.download('averaged_perceptron_tagger')
nltk.download('wordnet')
For SSL issues at this stage, run bash /Applications/Python 3.6/Install Certificates.command
How to run the entire thing:
cd insta_reddit/code
python download_from_reddit.py
python draw_text_on_image.py
python upload_to_instagram.py
Or run the modifiable Cron job (remember to change the venv path):
sh run_all_jobs.sh
Or add the above to your crontab to run at your set frequency:
crontab -e
Add this line your crontab: @daily /path/to/run_all_jobs.sh
Instagram:
End result onContributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Author
- Surya Shekhar Chakraborty
Much thanks to Avishek Rakshit for help with the graphic design, Puneet Jindal for brainstorming, and to you for coming here. :)
License
This project is licensed under the MIT License - see the LICENSE file for details