Git Product home page Git Product logo

Comments (16)

Animenosekai avatar Animenosekai commented on May 27, 2024 3

@Marocco2

Hey and thank you for helping me!
What kind of request do I need to make? And how should I use the response from it?
Thank you in advance

This is the first call you should make to DeepL
https://gist.github.com/Marocco2/5268909dba2c450c214c240e90defb27

The response is a JSON with your IP and the id you've created, meaning it's ready to translate.

DeepL server can check which gateway is coming the request, meaning that deploying the py module in a server could be blocked even with proxies, VPN and TORs

Keep in mind that this code is outdated. Once has worked, but it's too spaghetti to be recovered. I made a quick glance to your code and you did a much better job keeping it organized. You should fix it in no time with proper edits

I added your implementation of DeepL's RPC API in bb433ca !

from translate.

Marocco2 avatar Marocco2 commented on May 27, 2024 2

Hey and thank you for helping me!

What kind of request do I need to make? And how should I use the response from it?

Thank you in advance

This is the first call you should make to DeepL
https://gist.github.com/Marocco2/5268909dba2c450c214c240e90defb27

The response is a JSON with your IP and the id you've created, meaning it's ready to translate.

DeepL server can check which gateway is coming the request, meaning that deploying the py module in a server could be blocked even with proxies, VPN and TORs

Keep in mind that this code is outdated. Once has worked, but it's too spaghetti to be recovered. I made a quick glance to your code and you did a much better job keeping it organized. You should fix it in no time with proper edits

from translate.

ZhymabekRoman avatar ZhymabekRoman commented on May 27, 2024 1

Are you sure you are correctly connected to the internet?

Yes

(maybe a firewall blocking http connections?)

I checked the firewall rules - nothing like that

Thanks for the help, I found the main problem culprit - it turned out to be the old version of urllib3

Solution: https://stackoverflow.com/questions/61076294/how-to-handle-requests-exceptions-invalidurl-failed-to-parse-in-python

from translate.

ZhymabekRoman avatar ZhymabekRoman commented on May 27, 2024 1

Also remember to update translatepy to v1.6

Thank you, I have already updated, although I installed it from the source code. I am preparing a PR for you so that Yandex Translator can start working correctly

from translate.

Animenosekai avatar Animenosekai commented on May 27, 2024

The problem with DeepL is that they seem to integrate some bot detection algorithm which I need to understand for it to work well.

The problem with pyppeteer is obviously the Chromium instance running with it which is way too heavy for something like translatepy (already experimented it with my other, old translation module pyGoogleTranslate)

For now, DeepL seems to work from my location but I guess that any kind of suspicious activity (even calling the API a few times will get me rate limited with the same message "Too many requests")

translatepy_deepl

Also, try to use the Translator class from translatepy.Translator as some things are optimised with it (tip: you can use or not a service over another with the use_service arguments)

Translator(use_google=True, use_yandex=True, use_bing=True, use_reverso=True, use_deepl=True, yandex_sid_refresh=False)

from translate.

Animenosekai avatar Animenosekai commented on May 27, 2024

I'll close this issue since it didn't get any response for 10 days

from translate.

Marocco2 avatar Marocco2 commented on May 27, 2024

@Animenosekai Maybe I can help.
First, you need to send a getClientState json to DeepL to accept your "ticket" called id
immagine
From now on, your id is gonna increase by one every time you want to reach DeepL. This is the first step to make your request more "genuine"

from translate.

Animenosekai avatar Animenosekai commented on May 27, 2024

Hey and thank you for helping me!

What kind of request do I need to make? And how should I use the response from it?

Thank you in advance

from translate.

ZhymabekRoman avatar ZhymabekRoman commented on May 27, 2024

Some serious problem seems like:
image

from translate.

Animenosekai avatar Animenosekai commented on May 27, 2024

Some serious problem seems like:

Are you sure you are correctly connected to the internet? (maybe a firewall blocking http connections?)
What makes me say this is that this behaviour occurs when translatepy skipped all of the translators (and I just fixed it to just return None when there is no result, which is normally the expected value)

Also weird exception because I don't get any problem parsing the same URL with the same function:
urllib3

But seeing this exception doesn't mean that it stopped there (hence the returned value) as translatepy should not throw any exception from the Translator class

from translate.

Animenosekai avatar Animenosekai commented on May 27, 2024

@ZhymabekRoman Yea thought so (it was very weird that urllib3 gave this exception while there were no mistake in the URL)

Also remember to update translatepy to v1.6 (pip install --upgrade translatepy) because I fixed some things (should just give you None now instead of a TranslationResult with None in it in your case)

from translate.

Animenosekai avatar Animenosekai commented on May 27, 2024

@ZhymabekRoman Thank you!
Also, look at #4 to have an understanding of what we already tried to do with Yandex Translate 〜

from translate.

Animenosekai avatar Animenosekai commented on May 27, 2024

I will now close this issue as everything has been fixed in translatepy v1.6.1

from translate.

yucongo avatar yucongo commented on May 27, 2024
from time import sleep
from translatepy.translators.deepl import DeepL

dl = DeepL()

for elm in ['test this and that'] * 10:
    print(dl.translate(elm, 'de'))
    sleep(1)

# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)

Thanks for the hardwork. Sadly it still does not seem to work. Admittedly it works sometimes. Oftentimes it does not.

from translate.

Animenosekai avatar Animenosekai commented on May 27, 2024
from time import sleep
from translatepy.translators.deepl import DeepL

dl = DeepL()

for elm in ['test this and that'] * 10:
    print(dl.translate(elm, 'de'))
    sleep(1)

# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)
# (None, None)

Thanks for the hardwork. Sadly it still does not seem to work. Admittedly it works sometimes. Oftentimes it does not.

Hmmmm I'll look into but won't be able to make too much changes since it might conflict with what @ZhymabekRoman is doing in the v2

Also, try using the Translator class from translatepy.Translator() because it provides fixes on the language name, the words, caches and fallbacks (if you just want to use DeepL, try disabling the other ones with use_bing=False, etc.)

from translate.

ZhymabekRoman avatar ZhymabekRoman commented on May 27, 2024

Admittedly it works sometimes. Oftentimes it does not.

Unfortunately seems this problem cannot be solved. I looked at all the implementations of the DeepL translator on the vastness of Github - no one works more or less stably. https://stackoverflow.com/questions/56114463/how-to-request-a-translation-from-deepl-at-the-moment

I analyzed the Windows version of the DeepL application and found out that it just opens the web address in a separate Chrome process - https://www.deepl.com/en/windows/translator?windows_app_version=2.3.0%2b6072bbdc (why then develop a separate application at all if it just opens a separate web page?). I opened this web page in a browser and tried to make a lot of translation requests, and it seems like I did not catch the error "Too many requests".

image

The only, as it seems to me, normal option is to use the official Deepl API Free. But it also has limitations-a maximum of 500,000 characters per month. I tried to register to get a free API key - it turns out that I need to link a bank card, but it does not support the countries of the post-Soviet states

from translate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.