diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2021-02-12 09:31:20 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2021-02-12 09:31:20 -0300 |
commit | 2f12b3754e9d42cc77dc3e632d9bdbb8371b40a0 (patch) | |
tree | 8c1623cfec19f487f75dc80b8c49076bc9bec9cf | |
parent | 9c790189ae2163631ea09618f11f9908a722dd6c (diff) | |
download | scripts-2f12b3754e9d42cc77dc3e632d9bdbb8371b40a0.tar.gz scripts-2f12b3754e9d42cc77dc3e632d9bdbb8371b40a0.tar.bz2 |
Fix: scuttle improvements
-rwxr-xr-x | scuttle | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -31,7 +31,7 @@ TMP="${TMP:=/tmp}" # Syntax if [ -z "$TAGS" ]; then - echo "usage: $BASENAME <url> <tags> <description>" + echo "usage: $BASENAME <url> <tags> [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 "<title>" | 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 |