Answer the question
In order to leave comments, you need to log in
Is it possible to parse translation results from Google translator?
There was a task (instantly) to receive translation of any word at induction of the cursor of the mouse. I decided to look towards Google-translator. Using the official API of this translator costs money, and there will be a lot of words every day, because. there will be many users.
The bottom line is that on hover, the JavaScript code accesses the PHP script, passing it parameters such as the original language, the language of the result, and the word itself. The PHP script itself makes a GET request at the URL below to Google Translate. In response, it receives html content, which then parses and returns only the translation to the JavaScript code (one word, for example).
On reflection, I decided why not parse the results of the translation, for example, in PHP? The Google Translate address bar looks like this:
https://translate.google.ru/#<язык_оригинала>/<язык_перевода>/<слово>
Answer the question
In order to leave comments, you need to log in
https://cloud.google.com/translate/docs/
https://chrome.google.com/webstore/detail/google-d...
Stupidly, Google will not parse itself
The fact that the page is accessed not by the user, but script, sites have long been determined by dozens of parameters, in which the SP does not always have a lot of weight.
1) Yandex
2) parse the code of applications / add-ons for browsers with functionality
https://chrome.google.com/webstore/detail/myvocabu...
someone has already done it, repeat or use it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question