I use a bash script to translate words from other languages into Portuguese. It always worked very well, but for a few days it got extremely slow, to the point that I could not use it. Home some people informed me that the problem could be in the "wget". I've done some testing by replacing wget with Axel or aria2c and speed has returned to normal, but using those two commands I can not get the translation.
The original code is this one:
#!/usr/bin/env bash
text="$(xsel -o)"
translate="$(wget -U "Mozilla/5.0" -qO - "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=pt&dt=t&q=$(echo $text | sed "s/[\"'<>]//g")" | sed "s/,,,0]],,.*//g" | awk -F'"' '{print $2}')"
echo -e "Original text:" "$text"'\n' > /tmp/notitrans
echo "Translation:" "$translate" >> /tmp/notitrans
zenity --text-info --title="Translation" --filename=/tmp/notitrans
Line 3 of this code, replacing "wget" with "Axel" is:
translate="$(axel -n 4 "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=pt&dt=t&q=$(echo $text | sed "s/[\"'<>]//g")" | sed "s/,,,0]],,.*//g" | awk -F'"' '{print $2}')"
And replacing "wget" with "aria2c" is:
translate="$(aria2c "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=pt&dt=t&q=$(echo $text | sed "s/[\"'<>]//g")" | sed "s/,,,0]],,.*//g" | awk -F'"' '{print $2}')"
Possibly I'm not sure how to set the options for Axel and Aria2c. For me either does either, I need the code to work again. Would anyone guide me in this direction?