From 7e5896e1e3d5afbae4b75da2e599050e41908ced Mon Sep 17 00:00:00 2001 From: silverwizard Date: Sun, 31 Jul 2022 08:18:08 -0400 Subject: [PATCH] Added support for looping and watching related videos --- ytloop.sh | 3 +++ ytrelated.sh | 4 ++++ ytscroll.sh | 2 ++ ytsearch.sh | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 ytloop.sh create mode 100755 ytrelated.sh create mode 100755 ytscroll.sh diff --git a/ytloop.sh b/ytloop.sh new file mode 100755 index 0000000..870e7e2 --- /dev/null +++ b/ytloop.sh @@ -0,0 +1,3 @@ +VID=$1 +vlc $VID +./ytscroll.sh `./ytrelated.sh $VID` diff --git a/ytrelated.sh b/ytrelated.sh new file mode 100755 index 0000000..7e488ed --- /dev/null +++ b/ytrelated.sh @@ -0,0 +1,4 @@ +for video in `curl $1|tr '"' '\n'|grep '^/watch?'|cut -d'\' -f1|sort -u` +do + ./ytmeta.sh https://www.youtube.com$video +done|./ytlist.sh diff --git a/ytscroll.sh b/ytscroll.sh new file mode 100755 index 0000000..03de32d --- /dev/null +++ b/ytscroll.sh @@ -0,0 +1,2 @@ +VID=`./ytsearch.sh $@` +vlc $VID && ./ytloop.sh $VID diff --git a/ytsearch.sh b/ytsearch.sh index 1d73214..d5677a2 100755 --- a/ytsearch.sh +++ b/ytsearch.sh @@ -1,2 +1,2 @@ -for vid in `curl https://www.youtube.com/results?search_query=$(echo $@|tr ' ' '+')|tr '"' '\n'|grep 'watch?'|cut -d '\' -f1|sort|uniq`; do ./ytmeta.sh youtube.com$vid ; done|./ytlist.sh ^C +for vid in `curl https://www.youtube.com/results?search_query=$(echo $@|tr ' ' '+')|tr '"' '\n'|grep '^/watch?'|cut -d '\' -f1|sort|uniq`; do ./ytmeta.sh youtube.com$vid ; done|./ytlist.sh