From 6600b20c6bc5446242a9d5fbe93873ffac9e0a45 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 20 May 2015 17:27:20 +0200 Subject: add timemachine --- timemachine/bin/youtube_random | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 timemachine/bin/youtube_random (limited to 'timemachine/bin/youtube_random') diff --git a/timemachine/bin/youtube_random b/timemachine/bin/youtube_random new file mode 100755 index 00000000..30ee87f8 --- /dev/null +++ b/timemachine/bin/youtube_random @@ -0,0 +1,22 @@ +#!/bin/sh +set -euf + +main() { + if [ ! $# -eq 0 ]; then + usage + fi + + get_random_video +} + +get_random_video() { + curl -Ss http://randomyoutube.net/watch | sed -n 's|.*\(http://www\.youtube.com/watch?v=.\{11\}\).*|\1|p' +} + +usage() { + echo 'returns a random youtube video.' + echo 'scrapes http://randomyoutube.net/' + echo 'example: mpv $(youtube_random)' +} + +main -- cgit v1.2.3