Allow multiple sequential url replacements

This commit is contained in:
Marty Oehme 2023-01-08 21:03:06 +01:00
parent 643ff396fe
commit 230d42c193
Signed by: Marty
GPG key ID: 73BA40D5AFAF49C9

4
uoeia
View file

@ -76,11 +76,11 @@ dereference() {
# teddit to original redd.it hosted picture # teddit to original redd.it hosted picture
output="${1//teddit.net\/pics\/w:null_/i.redd.it/}" output="${1//teddit.net\/pics\/w:null_/i.redd.it/}"
# nitter to twitter # nitter to twitter
output="${1//nitter.net/twitter.com}" output="${output//nitter.net/twitter.com}"
# custom replacements: # custom replacements:
for rep in "${replacements[@]}"; do for rep in "${replacements[@]}"; do
output="${1//${rep%:::*}/${rep#*:::}}" output="${output//${rep%:::*}/${rep#*:::}}"
done done
echo "$output" echo "$output"
} }