Answer the question
In order to leave comments, you need to log in
Get key/id (SID) from translator page?
How to automate this? No matter how much I tried to look at the code, I did not understand how it is generated.
It is always different and works 7 days.
I know about the API. But in the browser it's free and the quality is better.
1. Go to the page translate.yandex.ru in a browser on your computer;
2. Write to the translator, for example, "hello" or "Hello";
3. Open the developer tools, for example, by pressing F12 on the keyboard or through the menu;
4. On the Network / Network / XHR / HTTP Requests tab, find a POST request with the following URL:
https://
translate.yandex.net/api/v1/tr.json/
translate?id=<b>c9883c4d.5da9f696.8329d0a3-1-0</b>
&srv=tr-text&lang=en-ru&reason=auto
Answer the question
In order to leave comments, you need to log in
everything is quite simple
there, parse the site translate.yandex.ru for the occurrence of SID , it will have a value consisting of three elements separated by dots, and so, each element just needs to be turned over, for example:
we have SID
49e65bdb.7fe1ede5.c76a5739
we get ID
bdb56e94.5ede1ef7.9375a67c
it is generated by a hash function
when the limits or frequency of requests are exceeded or when Selenium is not masked - there will be a captcha or an error (I don’t remember what status)
but pulling it out of the loaded page is a trivial task, for Selenium for sure
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question