scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit e15923a2d4ccf656070c9b6e7307bb58e388f271
parent 9bd552b94e380e424ea03608a66799895877e8cf
Author: z3bra <willy@mailoo.org>
Date:   Thu May 22 16:17:27 +0200

improved the youtube search script

Diffstat:
ys | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/ys b/ys @@ -1,11 +1,11 @@ #!/bin/sh +# +# z3bra - (c) wtfpl 2014 +# perform a search on youtube and return the best result (title + link) +num=3 query=$(echo $@ | tr ' ' '+') url="http://www.youtube.com/results?search_query=${query}" -regex='s,^.*title="\([^"]*\)".*href="\(/watch[^"]*\)".*$,\1  http://youtube.com\2,p' +regex='s,^.*title="\([^"]*\)".*href="\(/watch[^"]*\)".*$,\1 - http://youtube.com\2,p' - -curl -s "$url" | sed -n "$regex" | sed 3q | while IFS='' read t l; do - - echo "$t - $l" -done +curl -s "$url" | sed -n "$regex" | sed ${num}q