aboutsummaryrefslogtreecommitdiff
path: root/apod-bot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'apod-bot.sh')
-rwxr-xr-xapod-bot.sh8
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)"'