-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MicrosoftTranslate.text_to_speech is not working #81
Comments
Token fetch endpoint seems to shutdown and Microsoft Translate stops working. Need to drop Microsoft Translate class. |
I think the author of d4n3436/GTranslate wrote a token generation function: |
The author only uses TTS API endpoint of Bing Translate web interface. In old days I was investigating that web version of Bing Translate has a special API endpoint that generates an API token to use Microsoft Translate API. And it's intended for TTS. Microsoft Translate is like Bing Translate, but paid. So I used this backdoor to use the whole Microsoft Translate service for free by using the API token generated by the Bing TTS endpoint. Now this endpoint is unavailable. |
Is it possible to restore access to the Bing Translate class? Now accessing this class throws an DEPRECATED exception. |
Hello, as I mentioned before in my comment, I reverse-engineered the signature generation of the Microsoft Translator Android app, so it's now possible to use the Microsoft Translate APIs without any tokens, except for the TTS endpoint. The code is in MicrosoftTranslator.cs. |
Can we port your implementation to Python 3 and use it in translatepy? |
Sure, you can. |
So I started to port the new Microsoft Translate implementation based on the d4n3436 version, but unfortunately I couldn't get it to work successfully. It's bad news. Good news - I implemented another endpoint by reverse engineering Microsoft SwiftKey. See #88 |
from translatepy.translators.microsoft import MicrosoftTranslate
t = MicrosoftTranslate()
result = t.text_to_speech("Hello", 65, "male", "eng")
Traceback (most recent call last):
File "D:\Project\Python\translate\123.py", line 3, in
t = MicrosoftTranslate()
File "D:\Project\Python\translate\translatepy\translators\microsoft.py", line 88, in init
self.session_manager = MicrosoftSessionManager(request)
File "D:\Project\Python\translate\translatepy\translators\microsoft.py", line 39, in init
self._parse_authorization_data()
File "D:\Project\Python\translate\translatepy\translators\microsoft.py", line 46, in parse_authorization_data
token_response = self.bing_session.send(url123, data={})
File "D:\Project\Python\translate\translatepy\translators\bing.py", line 106, in send
response = request.json()
File "D:\Project\Python\translate\translatepy\utils\request.py", line 80, in json
return loads(self.text, **kwargs)
File "C:\Users\Виктор\AppData\Local\Programs\Python\Python310\lib\json_init.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\Виктор\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Виктор\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Process finished with exit code 1
The text was updated successfully, but these errors were encountered: