I want to subscribe to a youtube channel and automatically download new videos to my linux machine.

I know I could do this e.g. with miro, but I will not watch the videos using Miro, want to choose the quality and would like to run it as a cronjob.

It should be able to:

  • know which feed entries are new and not download old entries
  • resume (or at least redownload) failed/incomplete downloads from older sessions

Are there any complete solutions for this?

If not it would be enough for me (maybe even preferable) to just have a command line rss reader that remembers which entries have already been there and writes the new video urls (e.g. http://www.youtube.com/watch?v=FodYFMaI4vQ&feature=youtube_gdata from http://gdata.youtube.com/feeds/api/users/tedxtalks/uploads) into a file. I could then accomplish the rest using a bash script and youtube-dl.

What would be programs usable for this purpose?

1 Answer 1


I finally did it using this bash script:



if [ ! -f "$@" ] || [ 3 -ne $(wc -l "$@" | grep -o '^[0-9]*') ]; then
        echo "This script writes a list of new video ids into an output file."
        echo "Argument must be a file containing three lines:"
        echo "      line 1: Feed url"
        echo "      line 2: Output file "
        echo "      line 3: Newest id from last program call. Leave empty for first run."

        exit 1

mapfile -t < "$conffile"

echo "Processing $id:"

allids=$(wget -q -O- "$url" | sed 's,href,\nhref,g' | sed -n -e "s,^.*href='http://www.youtube.com/watch?v=\([A-Za-z0-9_-]*\).*$,\1,p")

for id in $allids; do
    if [ "$lastid" == "$id" ]; then echo "No new items left." >&2; break; fi
    echo "$id"
    echo "Adding $id" >&2
done | tac >> "$outfile"

newlastid=$(echo $allids | grep -o "^[A-Za-z0-9_-]*")

echo  "$url"       > "$conffile"
echo  "$outfile"   >> "$conffile"
echo  "$newlastid" >> "$conffile"

It reads feed url, output file and newest known video from a configuration file and then extracts the video ids from the feed. These ids are then compared with the latest known id (newest feed item first). Items newer than this will be added to the output files (now oldest item first).

Here is an example configuration file youtube_tedx.conf:


Which would be used by calling ./get_new_youtube.sh youtube_tedx.conf.

The output file (list.all) can then be processed for example by using youtube-dl with a command like youtube-dl -tca list.all && rm list.all.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .