From 2f12b3754e9d42cc77dc3e632d9bdbb8371b40a0 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 12 Feb 2021 09:31:20 -0300 Subject: Fix: scuttle improvements --- scuttle | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scuttle b/scuttle index 9c2d9fa..e065b48 100755 --- a/scuttle +++ b/scuttle @@ -31,7 +31,7 @@ TMP="${TMP:=/tmp}" # Syntax if [ -z "$TAGS" ]; then - echo "usage: $BASENAME " + echo "usage: $BASENAME [description]" exit fi @@ -51,7 +51,7 @@ TAGS="`echo $TAGS | sed -e 's/%2C/,/g'`" # Description if [ -z "$DESC" ]; then # See http://stackoverflow.com/questions/3195851/ddg#3195895 - DESC="`torify curl -s $URL | grep -i "" | sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q' 2> /dev/null`" + DESC="`torify curl -L -s $URL | grep -i "<title>" | sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q' 2> /dev/null`" echo "Fetched description: $DESC" fi @@ -63,6 +63,9 @@ CONF="`mktemp -t scuttle.XXXXXXXXXX -p $TMP`" echo "url = $CALL" > $CONF echo "user = $SCUTTLE_USER:$SCUTTLE_PASS" >> $CONF +# Remove trailing slash which might lead to urlencode errors by curl (dunny why) +URL="`echo $URL | sed -e 's|/$||'`" + # Call curl # See https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command#2027690 #curl -s -K $CONF &> /dev/null -- cgit v1.2.3