Switched from tr -cd print to iconv to prevent crash characters.

This commit is contained in:
Storm Dragon 2020-08-14 23:30:27 -04:00
parent e1bb820a41
commit d5ee33b24b
2 changed files with 2 additions and 2 deletions

View File

@ -8,5 +8,5 @@ quote="${quote//&lt;/ <}"
quote="${quote//&gt;/> }"
quote="${quote%%<p class*}"
quote="$(echo "$quote" | w3m -dump -T text/html)"
msg "$2" "$(echo "$quote" | tr -cd '[:print:]')"
msg "$2" "$(echo "$quote" | iconv -f utf-8 -t ascii)"
set +f

View File

@ -1,6 +1,6 @@
[ -f functions.sh ] && source functions.sh
fml="$(curl -Ls --connect-timeout 5 https://fmylife.com/random | grep -m1 -A1 '<a class="article-link" href="/article/.*>' | tail -1 | w3m -dump -T text/html | tr '[:space:]' ' ' | tr -cd '[:print:]')"
fml="$(curl -Ls --connect-timeout 5 https://fmylife.com/random | grep -m1 -A1 '<a class="article-link" href="/article/.*>' | tail -1 | w3m -dump -T text/html | tr '[:space:]' ' ' | iconv -f utf-8 -t ascii)"
if [[ ${#fml} -gt 10 ]]; then
msg "$2" "${fml}"