This is a Twitter bot that posts lyrics intended to be used as Instagram captions. The application uses LyricsGenius, a Python client for the Genius API to gather lyrics and the replies to the user with a line. User's may query by artist, album, or song.
A user tweets "@onebarbot" and receives a caption back. See it in action here.
I'll leave these instructions here in case you want to reconfigure the bot to work for your favourite artist. Perhaps maybe I'll extend it so that a user is able to request their favourite artist.
- Run
pip install -U virtualenv
- Create a virtual environment by running
virtualenv env
in the root directory - Activate it by running
.\env\Scripts\activate
- Run
pip install requirements.txt
- If you add any modules, run
pip freeze > requirements.txt
- Create a Twitter account; choose a fun handle!
- Go to Twitter for Developers and register an app
- Once Twitter confirms that your app has been created, navigate to it and find the "details" section
- Create a file in
src/
calledcredentials.py
- Go to keys and tokens and copy-paste the values into
credentials.py
; you'll have to generate the access token and access token secret
# Twitter
twitter_consumer_key = ""
twitter_consumer_secret = ""
twitter_access_token = ""
twitter_access_token_secret = ""
# Genius
genius_client_id = ""
genius_client_secret = ""
genius_client_access_token = ""
PythonAnywhere [source]
- Register an account here
- Click on files in the navigation bar
- Upload the files from this directory
- Select tasks from the navigation bar
- Set the file path to
/home/<your username>/bot.py
and schedule the bot - ...and you're done!
TBD
TBD