From e8f6b459ed5897dacfd0152989737794d6807cd7 Mon Sep 17 00:00:00 2001 From: silverwizard Date: Sun, 17 Jul 2022 23:37:42 -0400 Subject: [PATCH] Initial commit to YouTuber adding the first few tools --- ytchantolist.sh | 4 ++++ ytlist.sh | 11 +++++++++++ ytmeta.sh | 17 +++++++++++++++++ ytsearch.sh | 2 ++ yttorss.sh | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100755 ytchantolist.sh create mode 100755 ytlist.sh create mode 100755 ytmeta.sh create mode 100755 ytsearch.sh create mode 100755 yttorss.sh diff --git a/ytchantolist.sh b/ytchantolist.sh new file mode 100755 index 0000000..dd00e3d --- /dev/null +++ b/ytchantolist.sh @@ -0,0 +1,4 @@ +for file in $(curl `./yttorss.sh -c $1`| grep media:content | cut -d'"' -f 2| cut -d'?' -f1) +do + ./ytmeta.sh $file +done|./ytlist.sh diff --git a/ytlist.sh b/ytlist.sh new file mode 100755 index 0000000..b58fd12 --- /dev/null +++ b/ytlist.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +NUM=0 +IFS=';' +zenity --list --imagelist --hide-column=3 --print-column=3 --column=Thumb --column=Title --column=Link `while read img title link +do + NUM=$((NUM+1)) + wget --quiet -O $NUM.jpg $img + printf $NUM.jpg\;"$title"\;"$link"\; +done;wait` +rm *.jpg diff --git a/ytmeta.sh b/ytmeta.sh new file mode 100755 index 0000000..b9385fc --- /dev/null +++ b/ytmeta.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ "${1#*$'watch?v='}" != "$1" ] +then + VIDID=`echo $1|awk -F '=' '{print $NF}'` +else + VIDID=`echo $1|awk -F '/' '{print $NF}'` +fi + + +printf https://img.youtube.com/vi/$VIDID/0.jpg\; + +printf "`curl -s https://www.youtube.com/watch?v=$VIDID|tr "\<" "\n"|grep -e "og:title"|cut -d'"' -f4|tr -d '[:punct:]'`" + +printf \; + +echo https://www.youtube.com/watch?v=$VIDID\; diff --git a/ytsearch.sh b/ytsearch.sh new file mode 100755 index 0000000..1d73214 --- /dev/null +++ b/ytsearch.sh @@ -0,0 +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 + diff --git a/yttorss.sh b/yttorss.sh new file mode 100755 index 0000000..c67d518 --- /dev/null +++ b/yttorss.sh @@ -0,0 +1,35 @@ +#!/bin/sh +usage() { + echo "youtuber + -c [channel name] + -u [channel url]" + echo "you may only specify channel name or url, and must specify one" +} + +if [ $#@ != 2 ] +then + usage() + exit 127 +fi + +while getopts "u:c:" opt; do + case "$opt" in + u) + URL=$2 + shift + ;; + c) + URL=https://www.youtube.com/$2 + shift + ;; + *) + usage() + exit 127 + ;; + esac +done +shift $((OPTIND-1)) + +RSS=`curl -s $URL |tr ':' '\n'|grep -A 2 rssUrl|tail -1 |cut -d'"' -f1|cut -d'/' -f3,4,5` + +echo $RSS