This is a simple slackbot that creates an interface to run youtube-dl in Slack like it was a command line program. My co-workers don't have admin access to install and use youtube-dl on their computers, so I created this as a work-around.
To get this up-and-running you need to do the following things.
- Clone the repository to your local computer.
- Using the Heroku CLI tools, create a new app in the directory of the repository and note the url of where it's hosted.
- Use your Slack account to create a new outgoing webhook using the URL from before (adding "/request" to the end). The default trigger phrase is 'grabbot download' but you can set this to whatever you want.
- Also create a new bot user and note the API token for that user.
- Update line 12 of grabbot.py with the key from your new webhook.
- Update line 6 of utils.py with the bot user token.
- Commit those changes and push the resulting files to Heroku.
- Activate the redis-to-go add-on for the Heroku app you created.
- That's it more-or-less
Afterwards, anyone should be able to say grabbot download <url>
in a public channel and the bot will download any URL supported by Youtube-DL and upload it to the Slack channel where the request was made.
Keep in mind that as youtube-dl is updated, so too will this bot need to be. If you're using Heroku like me, all that means is changing the version number in requirements.txt
Additionally, using a Heroku buildpack that supports for ffmpeg will make your life easier, but it is not required.