summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornikolaus <nikolaus@fishbox.fritz.box>2022-08-15 09:29:37 +0200
committernikolaus <nikolaus@fishbox.fritz.box>2022-08-15 09:29:37 +0200
commitf7486b15f953d11e2c9b820de5a31e25aa117307 (patch)
tree1dbed64c1c9f9ec2309864a3b7a911209c22c010
First script
-rwxr-xr-xwebgut58
1 files changed, 58 insertions, 0 deletions
diff --git a/webgut b/webgut
new file mode 100755
index 0000000..05a0c9d
--- /dev/null
+++ b/webgut
@@ -0,0 +1,58 @@
+#!/bin/sh
+if [ -z "$1" ]
+then
+echo "Search Video (v/V) or Web (w/W)?" &&
+read ans;
+
+if [ "$ans" = "v" ]
+then
+rm -rf ~/.cache/webgut/thumbnails/*
+#export list="~/.cache/webgut/list"
+#export thumlist="~/.cache/webgut/thumlist"
+rm ~/.cache/webgut/list & touch ~/.cache/webgut/list &
+#chmod 775 ~/.cache/webgut/* &
+echo "What do you want to search?" &&
+read resp &&
+rm .cache/webgut/resp && echo $resp >> ~/.cache/webgut/resp &&
+query=$(cat ~/.cache/webgut/resp | gsed 's/ /+/g') &&
+ curl https://y.com.sb/api/v1/search?q="$query" \
+ | gsed 's/,"/\n"/g' \
+ | gsed 's/^\s//g' \
+ | gsed 's/^[A-Za-z].*$//g' \
+ | grep -e "title" -e "/maxres.jpg" -e "videoId" \
+ | gsed ':a; N; s/\n/ /; ta' \
+ | gsed 's/\s"title/\n"title/g' \
+ | gsed 's/"[A-Za-z]*":"//g' \
+ | gsed 's/"/***/g' \
+ | gsed 's/ /_/g' \
+ | gsed 's/\*\*_/\*\*/g' \
+ >>~/.cache/webgut/list
+
+#rm ~/.cache/webgut/thumlist & touch ~/.cache/webgut/thumlist &
+# cat ~/.cache/webgut/list | grep 'https://.*/default.jpg' \
+# | gsed -e 's/"url":"//g' \
+# | gsed -e 's/"$//g' >> ~/.cache/webgut/thumlist
+
+
+
+for line in $(cat ~/.cache/webgut/list)
+do
+ name=$(echo $line | gawk -F '***' '{print($1)}')
+# link=$(echo $line | gawk -F '***' '{print($2)}')
+ thumbnail=$(echo $line | gawk -F '***' '{print($3)}')
+# echo $name
+# echo $link
+# echo $thumbnail
+ curl --create-dirs --output ~/.cache/webgut/thumbnails/$name.jpg $thumbnail &
+ done &&
+ sleep 10
+nsxiv -t ~/.cache/webgut/thumbnails/*
+else
+ w3m gruble.de
+fi
+else
+ videoId=$(cat ~/.cache/webgut/list | grep $1 | gawk -F '***' '{print($2)}')
+ videoUrl=https://yewtu.be/watch/?v=$videoId
+ printf "$1***$videoUrl \n" >> ~/.cache/view_hist &
+ mpv $videoUrl
+ fi