Merge branch 'master' into emacs-reconfigure

This commit is contained in:
Andreas Zweili 2024-05-15 21:37:05 +02:00
commit 541562bed6
1 changed files with 11 additions and 10 deletions

View File

@ -20,23 +20,24 @@ writeShellApplication {
recode
];
text = ''
# shellcheck disable=SC2001
url=$1
# get the title of the page
title=$(curl -s $url | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si' | recode html..)
title=$(curl -s "$url" | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si' | recode html..)
# remove non-ascii characters
title=$(echo $title | LANG=C sed 's/[^[:blank:][:print:]]//g')
title=$(echo "$title" | LANG=C sed 's/[^[:blank:][:print:]]//g')
# remove special characters
title=$(echo $title | sed 's/[^a-zA-Z0-9]/_/g')
title=$(echo "$title" | sed 's/[^a-zA-Z0-9]/_/g')
# replace multiple underlines with a single one
title=$(echo $title | sed 's/_\+/_/g')
title=$(echo "$title" | sed 's/_\+/_/g')
curl \
--data-urlencode "param=" \
--data-urlencode "context=download" \
--data-urlencode "format=epub" \
--data-urlencode "url=$url" \
--location https://pushtokindle.fivefilters.org/send2-html.php \
--output "$HOME/Downloads/$title.epub"
--data-urlencode "param=" \
--data-urlencode "context=download" \
--data-urlencode "format=epub" \
--data-urlencode "url=$url" \
--location https://pushtokindle.fivefilters.org/send2-html.php \
--output "$HOME/Downloads/$title.epub"
nautilus "$HOME"/Downloads
$DEFAULT_BROWSER "https://www.amazon.com/sendtokindle"