Created
September 24, 2015 17:34
-
-
Save MaximKhlobystov/c14fd8845324d446791c to your computer and use it in GitHub Desktop.
needle + Yandex.Translate API example.
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
var needle = require("needle"); | |
var url = "https://translate.yandex.net/api/v1.5/tr.json/translate?key=" + key + "&lang=" + lang + "&text=" + words[0]; | |
for(var i = 1; i < words.length; i++) { | |
url += ("%3F&text=" + words[i]); | |
} | |
needle.get(url, function(e, r) { | |
// handling the response here | |
} | |
// key - your API key, lang - target language, words - array of words to translate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment