summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-05-20 17:27:20 +0200
committerlassulus <lass@aidsballs.de>2015-05-20 17:27:52 +0200
commit6600b20c6bc5446242a9d5fbe93873ffac9e0a45 (patch)
tree7adc13351e7e9fadb607c08738ae3628c8cd3507
parent3cd71ef8189dc9226dfa01a91617d81ad4d429d6 (diff)
add timemachine
-rw-r--r--timemachine/README2
-rwxr-xr-xtimemachine/bin/youtube_boring26
-rwxr-xr-xtimemachine/bin/youtube_random22
3 files changed, 50 insertions, 0 deletions
diff --git a/timemachine/README b/timemachine/README
new file mode 100644
index 00000000..186fc28d
--- /dev/null
+++ b/timemachine/README
@@ -0,0 +1,2 @@
+timemachine is a bunch of scripts which can be used to travel forward through time.
+Currently it just consists of a bunch of random youtube url generators.
diff --git a/timemachine/bin/youtube_boring b/timemachine/bin/youtube_boring
new file mode 100755
index 00000000..6d799a10
--- /dev/null
+++ b/timemachine/bin/youtube_boring
@@ -0,0 +1,26 @@
+#!/bin/sh
+set -euf
+
+main() {
+ if [ ! $# -eq 0 ]; then
+ usage
+ fi
+
+ get_petite_video
+}
+
+get_petite_video() {
+ video=''
+ until [ ! $video = '' ]; do
+ video=$(curl -sS -L http://www.petittube.com/ | sed -n 's|.*http://www.youtube\.com\/v\/\([^?]*\).*|http://youtube.com/watch?v=\1|p')
+ done
+ echo $video
+}
+
+usage() {
+ echo 'returns the url to a boring youtube video'
+ echo 'scrapes http://www.petittube.com/'
+ echo 'example: mpv $(youtube_unseen)'
+}
+
+main
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