Advertisement
mosaid

Untitled

May 30th, 2020
1,014
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.41 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. to="$1"
  4. text="$2"
  5.  
  6. function WGET (){
  7.     userAgent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) "
  8.     userAgent+="Gecko/20100101 Firefox/48.0"
  9.     wget -U "$userAgent" "$@"
  10. }
  11. data="$( WGET -qO - \
  12.    "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${to}&dt=t&q=${text}" \
  13.    | sed "s/,,,0]],,.*//g" \
  14.    | awk -F'"' 'NR==1{print $2}'
  15. )"
  16. echo "  $data  "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement