-
-
Save avodaqstephan/fb461460a8fb166c3c09b9975c0e3cf0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ set -o xtrace | |
+ PATH=/Users/stephan/.nvm/versions/node/v13.7.0/bin:/Users/stephan/Documents/google-cloud-sdk/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/ | |
+++ dirname deepl.sh | |
++ cd . | |
++ pwd | |
+ DIR=/Users/stephan/Downloads/deepl-alfred-workflow2-1.18 | |
+ LANGUAGE=EN | |
+ PARSER=jq | |
+ type jq | |
+ POSITIONAL=() | |
+ [[ 1 -gt 0 ]] | |
+ key=Haus. | |
+ case "$key" in | |
+ POSITIONAL+=("$1") | |
+ shift | |
+ [[ 0 -gt 0 ]] | |
+ set -- Haus. | |
+ '[' -z Haus. ']' | |
++ echo Haus. | |
++ iconv -f utf-8-mac -t utf-8 | |
++ tr -d '[:space:]' | |
+ query=Haus. | |
+ [[ Haus. != *. ]] | |
++ echo Haus. | |
++ sed 's/.$//' | |
+ query=Haus | |
++ echo Haus | |
++ sed 's/\"/\\\"/g' | |
+ query=Haus | |
++ echo Haus | |
++ sed 's/'\''/\\'\''/g' | |
+ query=Haus | |
+ data='{"jsonrpc":"2.0","method": "LMT_handle_jobs","params":{"jobs":[{"kind":"default","raw_en_sentence":"Haus","raw_en_context_before":[],"raw_en_context_after":[],"quality":"fast"}],"lang":{"user_preferred_langs":["EN","DE"],"source_lang_user_selected":"auto","target_lang":"EN"},"priority":-1,"timestamp":1557063997314},"id":79120002}' | |
+ HEADER=(--compressed -H 'Origin: https://www.deepl.com' -H 'Referer: https://www.deepl.com/translator' -H 'Accept: */*' -H 'Content-Type: text/plain' -H 'Accept-Language: en-us' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15') | |
+ curl -s 'https://www.deepl.com/PHP/backend/clientState.php?request_type=jsonrpc&il=EN' --compressed -H 'Origin: https://www.deepl.com' -H 'Referer: https://www.deepl.com/translator' -H 'Accept: */*' -H 'Content-Type: text/plain' -H 'Accept-Language: en-us' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15' --data-binary '{"jsonrpc":"2.0","method":"getClientState","params":{"v":"20180814"},"id":79120001}' | |
++ curl -s https://www2.deepl.com/jsonrpc --compressed -H 'Origin: https://www.deepl.com' -H 'Referer: https://www.deepl.com/translator' -H 'Accept: */*' -H 'Content-Type: text/plain' -H 'Accept-Language: en-us' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15' --data-binary '{"jsonrpc":"2.0","method": "LMT_handle_jobs","params":{"jobs":[{"kind":"default","raw_en_sentence":"Haus","raw_en_context_before":[],"raw_en_context_after":[],"quality":"fast"}],"lang":{"user_preferred_langs":["EN","DE"],"source_lang_user_selected":"auto","target_lang":"EN"},"priority":-1,"timestamp":1557063997314},"id":79120002}' | |
+ result= | |
+ [[ '' == *\"\e\r\r\o\r\"\:\{\"\c\o\d\e\"\:* ]] | |
+ echo '' | |
+ jq -r '{items: [.result.translations[0].beams[] | {uid: null, arg:.postprocessed_sentence, valid: "yes", autocomplete: "autocomplete",title: .postprocessed_sentence}]}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment