OwO-Network / DeepLX

Powerful Free DeepL API, No Token Required
https://ssa.sx/deeplx
MIT License
6.64k stars 533 forks source link

Proxy option #41

Closed killo3967 closed 1 year ago

killo3967 commented 1 year ago

Hi

Could you add a proxy option?

missuo commented 1 year ago

I will consider adding this feature if needed. @killo3967

killo3967 commented 1 year ago

Ok, so let me explain my idea. So far from Calibre (https://calibre-ebook.com/) using the translation plugin (https://github.com/bookfere/Ebook-Translator-Calibre-Plugin) and with the right configuration I can use your software.

{ "name": "DeepL X", "languages": { "source": { "English (British)": "EN-GB" }, "target": { "Español de España": "ES } }, "request": { "url": "http://127.0.0.1:1188/translate", "method": "POST", "headers": { "content-Type": "application/json". }, "data": { "source_lang":"", "target_lang":"", "text":"" } }, "response": "response['data']" }

The problem I have is the one I told you in the previous post. After several requests it gives an error. #40 (https://github.com/OwO-Network/DeepLX/issues/40)

That's why I want to pass your program through the tor network so that each request comes from a different source and with this I think I could bypass the DeepL protections. I have tried with ADVOR ( https://sourceforge.net/projects/advtor/) to capture the program but I get this error message.

DeepL X has been successfully launched! Listening on 0.0.0.0.0:1188 Made by sjlleo and missuo. 2023/04/26 18:44:41 main.go:203: Post "https://www2.deepl.com/jsonrpc": dial tcp 255.16.0.0.0:443: connectex: A socket operation was attempted on an unreachable network. [GIN] 2023/04/26 - 18:44:41 |←[97;42m 200 ←[0m| 69.7096ms | 192.168.1.50 |←[97;46m POST ←[0m "/translate" 2023/04/26 18:44:41 main.go:203: Post "https://www2.deepl.com/jsonrpc": dial tcp 255.16.0.0.0:443: connectex: A socket operation was attempted on an unreachable network. [GIN] 2023/04/26 - 18:44:41 |←[97;42m 200 ←[0m| 1.9329ms | 192.168.1.50 |←[97;46m POST ←[0m "/translate" 2023/04/26 18:44:58 main.go:203: Post "https://www2.deepl.com/jsonrpc": dial tcp 255.16.0.0.0:443: connectex: A socket operation was attempted on an unreachable network. [GIN] 2023/04/26 - 18:44:58 |←[97;42m 200 ←[0m| 1.905ms | 192.168.1.50 |←[97;46m POST ←[0m "/translate"

This is why this is the proxy request. Calibre sends it to your software that via proxy forwards it to the tor router (ADVOR).

missuo commented 1 year ago

I've rewritten a package for Python that you can call directly from within the Python code. You can check this link for details.

killo3967 commented 1 year ago

Sorry , but i don't understand what are you doing and my skills in pyhton are less than zero. What i need is that your api could have a proxy option.

hoonlight commented 1 year ago

Sorry , but i don't understand what are you doing and my skills in pyhton are less than zero. What i need is that your api could have a proxy option.

https://github.com/OwO-Network/PyDeepLX/pull/3/commits/e56a61a6f1f52205b2cd42bfa366af6821a637dd

This is a PR to add proxy option.