diff options
-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 |