Slightly improve readability of sed commands in plumber

This commit is contained in:
Mid Favila 2021-06-30 02:19:25 -03:00
parent 81c7cefc9e
commit 02179655f4
1 changed files with 5 additions and 5 deletions

10
plumber
View File

@ -4,7 +4,7 @@ rand_inst() # Choose a random invidious instance to distribute load.
# Good digital citizenship is important, you know.
{
case $(($(dd bs=2 count=1 if=/dev/random of=/dev/stdout | od - | \
sed -ne 's/ */ /gp' | cut -d ' ' -f2) % 3)) in
sed -ne 's& *& &gp' | cut -d ' ' -f2) % 3)) in
0) printf "vid.puffyan.us" ;;
1) printf "ytprivate.com" ;;
2) printf "yewtu.be" ;;
@ -15,11 +15,11 @@ if [ "$(printf "%s" "${1}"|cut -b 1,2,3,4)" = "http" ]
then
case "${1}" in
*youtu*) exec Links "$(printf "%s" "${1}"|sed -ne \
"s/\(http.*:\/\/\).*\(\/.*\)/\1$(rand_inst)\2/p")" & ;;
"s&\(http.*://\).*\(/.*\)&\1$(rand_inst)\2&p")" & ;;
*reddit*) exec Links "$(printf "%s" "${1}"|sed -ne \
"s/\(http.*:\/\/\).*\(\/.*\/\)/\1libredd.it\2/p")" & ;;
https://4chan.org*) exec Links "$(printf "%s" "${1}"|sed -ne \
"s/4chan/4channel/p")" ;;
"s&\(http.*://\).*\(/.*/\)&\1libredd.it\2&p")" & ;;
*4chan.org*) exec Links "$(printf "%s" "${1}"|sed -ne \
"s&4chan&4channel&p")" & ;;
*) exec Links "${1}" & ;;
esac