Mi
is a high performance messenger bot which will help you grab stuff from the web.
Searching videos on youtube is the very first feature of this bot. Sending keywords to the bot will fetch the related search result from youtube. Then, you can download the mp3 audio format of the videos that has been found. More is yet to come. Stay tuned ...
The downloading feature relies on youtube-dl. You will need to install it on your server. In addition to that you will need to install ffmpeg for the mp3 conversion.
$ sudo apt-get install ffmpeg
The following steps has been tested on Debian 9 so you will have to adapt the commands and configs according to your server distribution.
-
Clone the repository on your server
-
You need a SSL certificate. You can get one for free using Let's encrypt
-
Once you got your certificate, create a
.env
file inside the project directory. This file should contain the following informationsENVIRONMENT=local CERT_PATH=<path_to_your_certificate>/fullchain.pem CERT_KEY_PATH=<path_to_your_certificate_key>/privkey.pem VERIFY_TOKEN=<your_verify_token>
-
Next step is to run the web service. Inside the project directory, run the build command (this will give you a binary file named
server
)$ go build server.go
-
I recommend using supervisor to run the server as system service. You can of course use systemd if you want.
-
Install supervisor with
$ sudo apt-get install supervisor
-
Create the following configuration file
/etc/supservisor/conf.d/mi.conf
with the following content[program:mi] directory=/home/<user-name>/go/src/mi command=/home/<user-name>/go/src/mi/server autostart=true autorestart=true stderr_logfile=/var/log/mi.err.log stdout_logfile=/var/log/mi.out.log
-
Run the following commands
$ supervisorctl reread $ supervisorctl update
For more information about supervisor configuration, go there
-