Merge branch 'master' into emacs-reconfigure
This commit is contained in:
commit
541562bed6
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue