diff options
author | tv <tv@shackspace.de> | 2015-05-20 18:12:24 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-05-20 18:12:24 +0200 |
commit | 35ccac73d563ad30d2851b9aeed4cfef69ff74e3 (patch) | |
tree | 748009108323f5575ba7a62a49f9a5eed558ccd6 /timemachine/bin | |
parent | dc009cdc8a9296c21aa83a7eda670a5476bc008a (diff) | |
parent | 6600b20c6bc5446242a9d5fbe93873ffac9e0a45 (diff) |
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'timemachine/bin')
-rwxr-xr-x | timemachine/bin/youtube_boring | 26 | ||||
-rwxr-xr-x | timemachine/bin/youtube_random | 22 |
2 files changed, 48 insertions, 0 deletions
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 |