tSearch on youtube and return the first links and titles - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 9bd552b94e380e424ea03608a66799895877e8cf
(DIR) parent e84a45be3e6a6b1516fda31ef60d0e68bc87f887
(HTM) Author: z3bra <willy@mailoo.org>
Date: Thu, 22 May 2014 16:14:19 +0200
Search on youtube and return the first links and titles
Diffstat:
A ys | 11 +++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/ys b/ys
t@@ -0,0 +1,11 @@
+#!/bin/sh
+
+query=$(echo $@ | tr ' ' '+')
+url="http://www.youtube.com/results?search_query=${query}"
+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