Telegram Bot based on youtube-dl devised to download media contents from the web.
The whole story behind this project.
virtualenv
orconda
python3.8
git
samba
- Telegram Bot Token
Install youtube-dl
(on Arch/Arch Arm):
sudo pacman -S youtube-dl
Clone the project:
git clone https://github.com/pigna90/home-downloader-bot.git
Set up the virtual environment:
cd ./home-downloader-bot
python -m venv venv && source venv/bin/activate && pip install -r requirements.txt
Crete a configuration json file:
cd ./home-downloader-bot
touch config.json
Populate it by following this structure:
{
"valid_users": [
"username_1",
"username_2"
],
"bot_token": "secret_bot_token",
"out_dir": "/path/to/sambda/shared/directory/",
"owner_chat_id": "owner_chat_id",
"valid_websites": ["https://www.youtube"]
}
Run the Bot:
cd ./home-downloader-bot
chmod +x run_home_downloader.sh
./run_home_downloader.sh
- Start a new conversation with the Bot
- Send the link of the video to download
- The video will be downloaded into the shared folder
Here is how to deploy the code to a remote machine (e.g. Raspberry Pi) trough SSH:
rpi_host=""
rpi_project_dir=""
cd ./home-downloader-bot
scp home_downloader.py ${rpi_host}:${rpi_project_dir}home_downloader.py
scp modules.py ${rpi_host}:${rpi_project_dir}modules.py
scp requirements.txt ${rpi_host}:${rpi_project_dir}requirements.txt
scp config.json ${rpi_host}:${rpi_project_dir}config.json
scp run_rpi.sh ${rpi_host}:${rpi_project_dir}run_home_downloader.sh
ssh ${rpi_host} chmod +x ${rpi_project_dir}run_home_downloader.sh