deep-translator
deep-translator copied to clipboard
Create pons_api.py
Alternative method using the new api.pons.com endpoint in json, I implemented this because the previous method stopped working correctly:
curl 'https://api.pons.com/text-translation-web/v4/translate?locale=en' \
-H 'authority: api.pons.com' \
-H 'accept: */*' \
-H 'accept-language: en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'origin: https://en.pons.com' \
-H 'pragma: no-cache' \
-H 'referer: https://en.pons.com/' \
-H 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-site' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \
--data-raw $'{"impressionId":"48bff56e-aa3f-4463-adb7-8282500be5a4","targetLanguage":"pt","text":"Sweet Victoria Deep","sourceLanguage":"en"}' \
--compressed
Hi, Thanks for the PR. Can you add some examples that show how this one solves the issue? Maybe add a screenshot to show both results (using the current version and then your version) Also can you add a test?