Jump to content


HPR - HPR1430: thebestofyoutube.com download script

  • Please log in to reply
No replies to this topic



    I make newbies cry!

  • Members
  • 2,782 posts

Posted 23 January 2014 - 07:00 PM

In episode "Thu 2013-12-19: hpr1404 Editing pre-recorded audio in Audacity" I walked you through editing a podcast, by the magic of editing this is been posted after the other show has aired. The plan here is to get people to share their useful hacks to show how elegent, or in my case ugly, code can be. As Knightwise says "Getting technology to work for you."™Feel free to share your own hacks with us.http://hackerpublicr...eps.php?id=1404http://hackerpublicr...txt#!/bin/bash# Downloads videos from youtube based on selection from http://thebestofyoutube.com# © Ken Fallon http://kenfallon.com# Released under the CC-0maxtodownload=10savepath="/mnt/media/Videos/tv/youtube/bestofyoutube"savedir="${savepath}/$(date -u +%Y-%m-%d_%H-%M-%SZ_%A)"mkdir -p ${savedir}logfile="${savepath}/downloaded.log"# Gather the listseq 1 ${maxtodownload} | while read videopage;do thisvideolist=$(wget --quiet "http://bestofyoutube.com/index.php?page=${videopage}" -O - | grep 'www.youtube.com/embed/' | sed 's#^.*www.youtube.com/embed/##' | awk -F '"|?' '{print "http://www.youtube.com/watch?v="$1}') for thisvideo in $(echo $thisvideolist); do if [ "$( grep "${thisvideo}" "${logfile}" | wc -l )" -eq 0 ]; then echo "Found the new video ${thisvideo}" echo ${thisvideo} >> ${logfile}_todo else echo "Already downloaded ${thisvideo}" fi donedone# Download the listif [ -e ${logfile}_todo ];then tac ${logfile}_todo | youtube-dl --batch-file - --ignore-errors --no-mtime --restrict-filenames --max-quality --format mp4 --write-auto-sub -o ${savedir}'/%(autonumber)s-%(title)s-%(id)s.%(ext)s' cat ${logfile}_todo >> ${logfile} rm ${logfile}_todofi

Go to this episode

BinRev is hosted by the great people at Lunarpages!