diff options
Diffstat (limited to 'scuttle')
-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 |