rss logo

Intro

Voici un script Bourne shell que j'utilise pour télécharger automatiquement les vidéos youtube et dailymotion des chaines que je regarde. Les outils utilisés sont youtube-dl et curl.

Code

#! /bin/bash # youtube-dl.sh version 1.0 # 2016.02.22 shebangthedolphins.net first version #--------------------------------------------------- # this script automaticly download videos from youtube and dailymotion #--------------------------------------------------- #youtube-dl update youtube-dl -U PROG="/usr/local/bin/youtube-dl" DATE=$(/bin/date --date='1 days ago' '+%Y%m%d') DATECHROMA=$(/bin/date --date='3 days ago' '+%Y%m%d') ##Dailymotion #karimdebbache $PROG --playlist-end 10 --dateafter $DATECHROMA -o '/data/%(uploader)s/%(upload_date)s_%(title)s-%(id)s.%(ext)s' http://www.dailymotion.com/user/karimdebbache/1 #france inter $PROG --playlist-end 20 --match-title "Le Zoom de La Rédaction" --dateafter $DATE -o '/data/franceinter/%(upload_date)s.%(title)s-%(id)s.%(ext)s' http://www.dailymotion.com/user/franceinter/1 $PROG --playlist-end 20 --match-title "Le.*Zoom.*" --dateafter $DATE -o '/data/franceinter/%(upload_date)s.%(title)s-%(id)s.%(ext)s' http://www.dailymotion.com/user/franceinter/1 ##Youtube #Axolot $PROG --playlist-end 5 --dateafter $DATE -o '/data/%(uploader)s/%(upload_date)s_%(title)s-%(id)s.%(ext)s' https://www.youtube.com/user/Axolotblog/videos #antoinedaniel $PROG --playlist-end 5 --dateafter $DATE -o '/data/antoinedaniel/%(uploader)s/%(upload_date)s_%(title)s-%(id)s.%(ext)s' https://www.youtube.com/channel/UCJRljQ8OcyfzHBYpS_bDbow/videos $PROG --playlist-end 5 --dateafter $DATE -o '/data/antoinedaniel/%(uploader)s/%(upload_date)s_%(title)s-%(id)s.%(ext)s' https://www.youtube.com/user/MrAntoineDaniel/videos #epenser $PROG --playlist-end 10 --dateafter $DATE -o '/data/%(uploader)s/%(upload_date)s.%(title)s-%(id)s.%(ext)s' https://www.youtube.com/user/epenser1/videos #Zap-Tele JOUR=$(/bin/date --date='1 days ago' '+%d' | sed 's/^0//') JOUR2=$(/bin/date '+%d' | sed 's/^0//') OIS=$(/bin/date '+%B' | sed -e 's/é/e/' -e 's/û/u/') OIS2=$(/bin/date '+%m') ANNEE=$(/bin/date '+%Y') #I don't know why but sometimes youtube-dl fails to download the videos, so I have to repeat the process for i in $(seq 10) do curl http://www.zap-tele.com/posts?category_id=2 | grep "h2.*post.*$JOUR.*$MOIS.*$ANNEE" && $PROG -o /data/zap-tele/$ANNEE$MOIS2$JOUR'.%(title)s-%(id)s.%(ext)s' http://www.zap-tele.com$(curl http://www.zap-tele.com/posts?category_id=2 | grep "h2.*post.*$JOUR.*$MOIS.*$ANNEE" | sed -e 's/.*="//' -e 's/">.*//') curl http://www.zap-tele.com/posts?category_id=2 | grep "h2.*post.*$JOUR2.*$MOIS.*$ANNEE" && $PROG -o /data/zap-tele/$ANNEE$MOIS2$JOUR2'.%(title)s-%(id)s.%(ext)s' http://www.zap-tele.com$(curl http://www.zap-tele.com/posts?category_id=2 | grep "h2.*post.*$JOUR2.*$MOIS.*$ANNEE" | sed -e 's/.*="//' -e 's/">.*//') sleep 1 done
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address