diff options
author | Arun Isaac | 2018-04-29 18:40:19 +0530 |
---|---|---|
committer | Arun Isaac | 2018-04-29 18:40:19 +0530 |
commit | 4bfe9173ed9416fe79b6147ff33ee5767f4cfdd0 (patch) | |
tree | 51873cee994d82951f6321345a11a98aaafc2536 | |
parent | e0687eea08c860373f3b0202960825d0f57f8cfa (diff) | |
download | nasa-apod-gnu-social-bot-master.tar.gz nasa-apod-gnu-social-bot-master.tar.lz nasa-apod-gnu-social-bot-master.zip |
* apod-bot.sh: Prepend https scheme if absent in media URI. Re-indent
title extraction code.
-rwxr-xr-x | apod-bot.sh | 5 |
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 |