summaryrefslogtreecommitdiffstats
path: root/timemachine/bin/youtube_boring
blob: 6d799a1079a02c57b7f2c111012e02e21fd5dc8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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