/ uberspace

how to download videos to your computer from any device

update july 6, 2015: no need for noodlesoft's hazel anymore--to set it up using folder actions, look here: os x: automatically move files using folder actions.

hey, here's a great video. you have to see it!

but what if i can’t or don't want to watch it right now? i can send the link to my own email address; or i can save it to my reading list; or i can copy the link to my notes app. oh boy, what a hassle.

here is what i do now

from any device i currently use, i just send the link to a special email address. once i am in from of my mac, the video popups up on my desktop.

and here is how

if you want to do the same, you need:

in this how to article, i assume, all the listed requirements are in place.


register at uberspace (or your favorite provider) and log in via ssh.


please read the article about homebrew in the uberspace-wiki and install it:

$ git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew
$ echo "PATH=\"$HOME/.linuxbrew/bin:$PATH\"" >> ~/.bashrc
$ echo "MANPATH=\"$HOME/.linuxbrew/share/man:$MANPATH\"" >> ~/.bashrc
$ echo "INFOPATH=\"$HOME/.linuxbrew/share/info:$INFOPATH\"" >> ~/.bashrc
$ source ~/.bashrc


install youtube-dl:

$ brew install youtube-dl

bittorrent sync

install and set up bittorrent sync on uberspace and download the app to your computer.

please create a folder for transferring the downloaded video files. mine is ´recorder´, saved inside my uberspace in this path:


link the folder to a local folder on your mac. (my local path is ~/Public/BTSync/recorder)

please untick the checkbox store deleted files in folder archive (on both the server and your local app):

screenshot: btsync web gui, folder preferences

screenshot: btsync desktop app, folder preferences


before reading on, read this: os x: automatically move files using folder actions

get hazel; after successful installation, open it’s .prefpane in system preferences. create a new rule to move all, but .bts files to your desktop.

screenshot: hazel, folders

please note: files currently transferred using btsync have the extension .bts.

screenshot: hazel, edit rule

email address for incoming video urls

understand what's written about vmailmgr here, then setup vmailmgr:

$ vsetup 
vsetup: created users directory.
vsetup: wrote '.qmail-default' file.

and create a new user/email account:

$ vadduser youtube-dl
Enter the user's new password: 
vadduser: user 'youtube-dl' successfully added

script running on your server

create folder for the script (if it doesn't exist)

$ mkdir ~/bin

now, connect all the parts to a full featured workflow by creating the script:

$ touch ~/recorder.sh
$ chmod +x ~/bin/recorder.sh
$ nano ~/bin/recorder.sh

copy & paste this:


### Change for your needs:

# MAILADDRESS - E-Mail address, youtube-dl will use to send mails

# MAILDIR - Folder which contains incoming Mails

# OUTDIR - Folder to put downloaded video in

# TOMAILADDRESS - E-Mail address, this script will send a confirmation to

# YOUTUBEDLPATH - Path to youtube-dl

### No Editing below this line

# URL Encode Function
rawurlencode() {
  local string="${1}"
  local strlen=${#string}
  local encoded=""

  for (( pos=0 ; pos<strlen ; pos++ )); do
	 case "$c" in
		[-_.~a-zA-Z0-9] ) o="${c}" ;;
		* )
           printf -v o '%%%02x' "'$c"
  echo "${encoded}"

# Get E-Mails

# Iterate through mails
	# Check if mail is being processed
	if [ -f $FILE ]; then
		# File exists

		# do nothing
		sleep 0
		# File does not exist

		# set "in progress"
		touch "${MAILDIR}${MAIL}.inprogress"

		# Get Variables
		while read LINE
			case $LINE in
				# Get E-Mail of Sender

				# Get Subject (contains URL)
		done < $MAILDIR$MAIL

		# Use youtube-dl to download video file and save output (to extract file name)
		OUTPUT="$(${YOUTUBEDLPATH} -o "$OUTDIR%(title)s.%(ext)s" $URL)"

		# Send E-Mail

		# Subject
		SUBJECT="New Video from $SENDER"

		# Message
		MESSAGE="<html><body><p>You received a new video:<br /><a href=\"$URL\">$URL</a></p><p>$SENDER</p></body></html>"

		# Sending E-Mail
			echo "From: ${MAILADDRESS}";
			echo "To: ${TOMAILADDRESS}";
			echo "Subject: ${SUBJECT}";
			echo "Content-Type: text/html";
			echo "MIME-Version: 1.0";
			echo "";
			echo "${MESSAGE}";
		) | /usr/sbin/sendmail -t

		# Remove E-Mail from Inbox
		rm ${MAILDIR}${MAIL}
		rm "${MAILDIR}${MAIL}.inprogress"

save the file and close nano with these shortcuts:

  • [ctrl] + [o]
  • enter
  • [ctrl] + [x]

create a cronjob

finally, set up a cronjob to check for new videos:

$ crontab -e

add these two lines:

# download videos using youtube-dl
*/4 * * * * ~/bin/youtube-dl.sh

save & close the editor. you should see this line:

crontab: installing new crontab


now create a new email, put the video's url as subject and send it to your youtube-dl's email address (youtube-dl@yourdomain.tld) . after no more than four minutes, the script should be triggered, and another few seconds/minutes later (depending on video size and your internet connection), you should see a new video file popping up on your computer.

main picture by bossfight, CC0 1.0 license