Created
October 28, 2020 08:53
-
-
Save Gyvastis/7b22a883c3f6443e9656b6e27a29c02f to your computer and use it in GitHub Desktop.
Revisions
-
Gyvastis created this gist
Oct 28, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ const translate = text => fetch("https://www.bing.com/ttranslatev3", { "headers": { "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36", "content-type": "application/x-www-form-urlencoded", }, "body": `&fromLang=nb&text=${encodeURIComponent(text)}&to=en`, "method": "POST", "mode": "cors" }) .then(response => response.json()) .then(json => json[0].translations[0].text); translate('vann').then(console.log)