aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2018-04-29 18:40:19 +0530
committerArun Isaac2018-04-29 18:40:19 +0530
commit4bfe9173ed9416fe79b6147ff33ee5767f4cfdd0 (patch)
tree51873cee994d82951f6321345a11a98aaafc2536
parente0687eea08c860373f3b0202960825d0f57f8cfa (diff)
downloadnasa-apod-gnu-social-bot-master.tar.gz
nasa-apod-gnu-social-bot-master.tar.lz
nasa-apod-gnu-social-bot-master.zip
Prepend https scheme if absent in media URI.HEADmaster
* apod-bot.sh: Prepend https scheme if absent in media URI. Re-indent title extraction code.
-rwxr-xr-xapod-bot.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/apod-bot.sh b/apod-bot.sh
index 5527077..85f503d 100755
--- a/apod-bot.sh
+++ b/apod-bot.sh
@@ -31,13 +31,14 @@ send-request -o /dev/null $social_api_url/statuses/home_timeline.json
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/ *$//')
+ | sed -e 's/^ *//' -e 's/ *$//')
if [[ -z "$(echo "$apod_html" | pup 'iframe attr{src}')" ]]; then
media_link=$apod_base_url/$(echo "$apod_html" | pup -p 'img attr{src}')
else
media_link=$(echo "$apod_html" | pup 'iframe attr{src}' | sed 's/?.*//' \
| sed 's|player.vimeo.com/video|vimeo.com|' \
- | sed 's|embed/|watch?v=|')
+ | sed 's|embed/|watch?v=|' \
+ | sed 's|^//|https://|')
fi
date=$(echo "$apod_html" | pup ':contains("Discuss") attr{href}' | awk -F= '{print $2}')
page_link=$apod_base_url/ap$date.html