Update: It looks like youtube-dl is getting maintained again, See the message on github. So this script is hopefully going to have something to download again soon :) My yt-dlp script didn't always seem to work right.

There is a SlackBuild available for youtube-dl at https://slackbuilds.org/repository/14.2/network/youtube-dl/ but since youtube-dl updates frequently the SlackBuild is usually out of date.

To try and solve that I made a little script to check the latest version from https://yt-dl.org and download it then use the SlackBuild script to build it by just passing the correct VERSION variable to it. This could be run automatically from cron but since it will need to be run as root you can do that at your own risk.

The following script expects you to have downloaded the SlackBuild linked above and extracted it into a youtube-dl directory inside the directory the youtube-dl-updater script is in.

update: the yt-dl.org website now requires an https connection, so had to change the URLs


# Remember where the SlackBuild script is
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
if [ ! -f $SBDIR/youtube-dl.SlackBuild ]; then
        echo "SlackBuild not found"
        exit 1

# find the latest version
LATEST=$(curl -s https://yt-dl.org | sed -n 's#.*\(downloads/latest/youtube-dl-.*.tar.gz\)">.*#\1#p')
VERSION=$(echo $LATEST | sed -n 's#.*youtube-dl-\(.*\).tar.gz#\1#p')

# download it to /tmp
TMPDIR=$(mktemp -d /tmp/youtube-dl-updater-XXXXXX)


# copy the SlackBuild there too

echo "Latest is $VERSION at $LATEST_URL"
echo "Working in $TMPDIR"

# Build the package
ARCH=$(uname -m)
VERSION=$VERSION sh ./youtube-dl.SlackBuild

# and install it
/sbin/upgradepkg --reinstall /tmp/youtube-dl-$VERSION-$ARCH-1_SBo.tgz

# cleanup
if [ -d $TMPDIR ]; then
        echo "Removing $TMPDIR"
        rm -r $TMPDIR

You can download the script here. This tarball also includes a copy of the SlackBuild script from slackbuilds.org at the date of posting.

Previous Post Next Post