Replace tidy tr based cleanup and change matching
This commit is contained in:
@@ -12,7 +12,7 @@ if ! grep -qF 'bandcamp.com/album' <<<"$url"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
track_durations=$(curl "$url" 2>/dev/null | tidy 2>/dev/null | sed -n -E 's/^.*"time secondaryText">(.*)<\/span.*$/\1/p')
|
||||
track_durations=$(curl "$url" 2>/dev/null | tr -d '\n' | tr -s ' ' | grep -oE 'time secondaryText"> [0-9]+:[0-9]+' | cut -d' ' -f3)
|
||||
total_seconds=$( { printf '('; cut -d: -f1 <<<"$track_durations" | paste -d+ -s | tr -d '\n'; printf ') * 60 +'; cut -d: -f2 <<<"$track_durations" | paste -d+ -s; } | bc )
|
||||
|
||||
date -u -d @${total_seconds} +%T
|
||||
|
||||
Reference in New Issue
Block a user