Install Python pip:
sudo apt -y install python3-pip
Install youtube downloader:
sudo pip3 install --upgrade youtube-dl
Install ffmpeg codec so the downloader can merge video and audio track in one file:
sudo apt -y install ffmpeg
Prepare new user:
sudo su
groupadd youtube
useradd -s /bin/bash -g youtube -d /home/youtube youtube
# replace all groups
usermod youtube -G youtube,sudo
# passwordless access for sudo command
cd /etc/sudoers.d
echo "youtube ALL=(ALL) NOPASSWD: ALL"> 011_youtube-nopasswd
mkdir /home/youtube
chown youtube. /home/youtube
chmod -R g+s /home/youtube
Install downloader commands:
apt -y install jq
curl -s "https://catonrug.blogspot.com/feeds/posts/default/5255522565948307079?alt=json" | jq -r '.entry|.content|."$t"' | base64 --decode | sudo tee /usr/bin/renew-youtube-channel
curl -s "https://catonrug.blogspot.com/feeds/posts/default/905125781365764435?alt=json" | jq -r '.entry|.content|."$t"' | base64 --decode | sudo tee /usr/bin/renew-all-channels
sudo chmod +x /usr/bin/{renew-youtube-channel,renew-all-channels}
Install profile to not download bigger quality than 1080p:
su - youtube
cd
mkdir -p .config/youtube-dl
echo "-f '299+bestaudio[ext=m4a]/137+bestaudio[ext=m4a]/37/136+bestaudio[ext=m4a]/22/135+bestaudio[ext=m4a]/18/134+bestaudio[ext=m4a]/133+bestaudio[ext=m4a]'" > ~/.config/youtube-dl/config
# install git key here
git clone ssh://git@github.com/catonrug/youtube.git
open cronjob and create scheduled task:
41 * * * * youtube cd ~/youtube && renew-all-channels
Or:
cd /etc
No comments:
Post a Comment