added redirect handling

This commit is contained in:
Emma Tebibyte 2022-09-05 21:33:31 -04:00
parent fecb5e103e
commit 1f912360e7
2 changed files with 6 additions and 1 deletions

View File

@ -51,7 +51,9 @@ done
if [ "$MIME" = "" ] || [ "$MIME" = "$1" ] || [ "$MIME" = "$INPUT" ]
then
echo "Determining MIME type of $INPUT:"
MIME=$(curl -I -s "$INPUT" | sed -ne 's/^[cC]ontent-[tT]ype: //p' | sed -e 's/;.\+//g' | tr -d '\r')
# Determines HTTP code, might use for something else?
# CODE=$(curl -fLIs "$INPUT" | sed -ne 's/ [[:space:]]*$//p' | sed -ne 's|^HTTP/.\+ ||p')
MIME=$(curl -fLIs "$INPUT" | sed -ne 's/^[cC]ontent-[tT]ype: //p' | sed -e 's/;.\+//p' | tail -n1 | tr -d '\r')
echo $MIME
fi

View File

@ -0,0 +1,3 @@
# EXT-TYPE=replace
replace youtube.com or youtu.be with piped.mint.lgbt