Commits

lan Nomar committed 536a95e

added broken net/youtube-browse

Comments (0)

Files changed (1)

net/youtube-browse.brc

+#!/bin/brc
+
+# support
+# more sites! everything quvi supports!
+# doesnt work at times... why? ( bad grep? )
+
+fn DEBUG { echo $* }
+
+fn youtube { DEBUG $^link/^$^search^$^*
+		# Next page
+		# http://www.youtube.com/results?search_query=a&page=2
+  link		= 'http://www.youtube.com'
+  search	= 'results?search_query='
+
+  *=$* { *=`{ urlencode $^* } }
+
+  for ( * in `` ( $ifs(3) ) { w3m -dump_source $^link/^$^search^$^* | grep 'video-long-title' } ) {
+
+	ifs="	{ * = `{ echo $* }	} 
+	ifs=()	{	title = `{ urldecode $10 | sed -e 's/\&/\&/g' -e 's/"/"/g' }	}
+	
+	ifs=('=' ';' '&') { watch = `{ echo -n $4 }	; watch=$watch(2)	}
+	
+	select = ( $select $watch )
+	
+	echo -n $#select^'	'^$title
+}  }
+
+
+#	~ $#* 0 || youtube $*
+#	while ( ! ~ $* *^[A-z]^* ) {
+		youtube $*
+		echo -n 'Select link:	'; *=`{ask}
+#	}
+#	~ $#* 0 && exit 0
+	
+	file = `{ cclive $link^'/watch?v='^$select($*) --exec 'echo %f' }
+	dlpid = $apid
+	mplayer $^file