diff options
author | Arun Isaac | 2017-09-02 22:22:17 +0530 |
---|---|---|
committer | Arun Isaac | 2017-09-02 23:13:02 +0530 |
commit | 6f92bf82e50fd608f4ec0eaa95f9936b9b202412 (patch) | |
tree | 32859ffeaec18870258ca2b545dea94ba2370fe2 | |
parent | a373039e0608f58150f15cb5f0c35c8771ffcaa0 (diff) | |
download | nasa-apod-gnu-social-bot-6f92bf82e50fd608f4ec0eaa95f9936b9b202412.tar.gz nasa-apod-gnu-social-bot-6f92bf82e50fd608f4ec0eaa95f9936b9b202412.tar.lz nasa-apod-gnu-social-bot-6f92bf82e50fd608f4ec0eaa95f9936b9b202412.zip |
Silence curl.
* apod-bot.sh: Add -s and -S flags to curl to suppress output unless
there is an error.
-rwxr-xr-x | apod-bot.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apod-bot.sh b/apod-bot.sh index b79f261..4e7085a 100755 --- a/apod-bot.sh +++ b/apod-bot.sh @@ -20,7 +20,7 @@ BOT_PASSWORD=secret-password-here APOD_BASE_URL=https://apod.nasa.gov/apod # Download HTML page, and scrape required information -APOD_HTML=$(curl $APOD_BASE_URL/astropix.html) +APOD_HTML=$(curl -sS $APOD_BASE_URL/astropix.html) TITLE=$(echo "$APOD_HTML" | pup 'center:nth-child(2) > b:nth-child(1) text{}' \ | sed -e 's/^ *//' -e 's/ *$//') @@ -40,8 +40,8 @@ PAGE_LINK=$APOD_BASE_URL/ap$DATE.html NOTICE="$TITLE $PAGE_LINK $MEDIA_LINK" # Ensure we are not publishing a duplicate notice -PREVIOUS_NOTICE=$(curl -u "$BOT_USERNAME:$BOT_PASSWORD" $SOCIAL_API_URL/statuses/home_timeline.json \ - | jq -r '.[0] | .text') +PREVIOUS_NOTICE=$(curl -sSu "$BOT_USERNAME:$BOT_PASSWORD" $SOCIAL_API_URL/statuses/home_timeline.json \ + | jq -r '.[0] | .text') if [[ "$NOTICE" = "$PREVIOUS_NOTICE" ]] then echo "Notice \"$NOTICE\" already published. Aborting..." >&2 @@ -53,6 +53,6 @@ wget --spider $MEDIA_LINK wget --spider $PAGE_LINK # Publish notice -curl -u "$BOT_USERNAME:$BOT_PASSWORD" --data-urlencode "status=$NOTICE" \ +curl -sSu "$BOT_USERNAME:$BOT_PASSWORD" --data-urlencode "status=$NOTICE" \ $SOCIAL_API_URL/statuses/update.json \ | jq -r '"Published notice \"\(.text)\" on \(.created_at)"' |