SRT-DeepL-Translator
SRT-DeepL-Translator copied to clipboard
Longer subtitles problem
I uninstalled old srt-deepl and reinstalled, then launched it as usual with python -m srt_deepl -g 1000 lines srt works fine, then I tested with 1700 lines and these errors appear:
Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/chi/.local/lib/python3.9/site-packages/srt_deepl/main.py", line 112, in translate( File "/home/chi/.local/lib/python3.9/site-packages/srt_deepl/main.py", line 127, in translate subs = translator.translate( File "/home/chi/.local/lib/python3.9/site-packages/srt_deepl/deepl.py", line 84, in translate raise Exception( Exception: Timeout for traslating portion.
It should work without trouble but maybe we can figure out what is wrong. That error happens cause we need to wait until srt portion is translated, maximun 1 min wait, so something deepl can take more, idk, dont think so.
First, check that there are not this character on the srt [...] (including [ and ]). I assume you already check it and there is none. (also i should solve this, it is kind of tedious check for this on each subtitle, but thats another issue).
Try using python -m srt_deepl -g -s (with -s flag to show the browser) and see if the translation in the right text area is completed or not. It should not contain [...].
If you want, send me the srt file i could try on my computer and check if i had the same trouble.
Probably i should change the way the program knows when the translation is done. At the moment it check if the same amount or phrases are in the both text areas and there is no [...] on the translation.
Let me know if you see something, if not, i'll think in another way to check this.
With -s, 'Access temporarily suspended' message appears. I attach srt here, just change extension, cause srts are not accepted here.
EN David Wilcock Explores Lost Pyramids Of An Advanced Ancient Global Civilization.txt
@andy144 couldnt replicate, it works out of the box on my computer. I dont know why you got access suspended, maybe the proxy was unavailable.
It translate it all in one run.
Ok, I tried with another computer, same internet connection, but this computer is much slower, and it worked. It took it 5 min for srt I sent you. Then I tried again with the fast computer, and stopped at line 1554 with that [...] error message, after 3 min. Could it be that it was too fast and deepl is catching something? :) I checked dependencies, they are same versions on both computers.
mmm, thats weird, anyway, keep track of #15, when i solve that this should be solved as well. Right now im working, so probably the weekend i'll work on it.
Subtitles.str
`---------------------------------------------------------------------------
TimeoutException Traceback (most recent call last)
/opt/anaconda3/envs/general/lib/python3.9/site-packages/srt_deepl/main.py in translate(filepath, lang_from, lang_to, wrap_limit, delete_old, driver) 82 83 if driver is None: ---> 84 proxies = get_proxies() 85 if len(proxies) == 0: 86 proxies = get_proxies(https=False)
/opt/anaconda3/envs/general/lib/python3.9/site-packages/srt_deepl/utils.py in get_proxies(https) 8 9 proxies = [] ---> 10 table_rows = Text(driver, "XPATH", "//tr[@role='row']", multiple=True).text 11 for proxy in table_rows: 12 proxy = proxy.split()
/opt/anaconda3/envs/general/lib/python3.9/site-packages/srt_deepl/elements.py in init(self, driver, locate_by, locate_value, multiple) 8 locator = (getattr(By, locate_by.upper(), "ID"), locate_value) 9 find_element = driver.find_elements if multiple else driver.find_element ---> 10 WebDriverWait(driver, 100).until(lambda driver: find_element(*locator)) 11 self.element = find_element(*locator) 12
/opt/anaconda3/envs/general/lib/python3.9/site-packages/selenium/webdriver/support/wait.py in until(self, method, message) 78 if time.time() > end_time: 79 break ---> 80 raise TimeoutException(message, screen, stacktrace) 81 82 def until_not(self, method, message=''):
TimeoutException: Message: `
In PR #22 there is a new way to get the proxy... Merging when test are complete.
I was using srt-deepl 0.8.9, last version without proxies, but after deepl updated their site two days ago, this version is also no longer working. Hope to fix the proxy problem on the newest version, or maybe make it work with tor only. Proxies come and go...
@andy144 Upgrade to 0.9.1 version, it works with the new deepl webpage.
Proxy are fixed in the PR #22 but waiting to merge... Also, see the examples folder to see how would you use it with tor.
With 0.9.1 this is what I get:
Traceback (most recent call last):
File "/home/chi/.pyenv/versions/3.9.0/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/chi/.pyenv/versions/3.9.0/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/chi/.pyenv/versions/3.9.0/lib/python3.9/site-packages/srt_deepl/main.py", line 112, in
adding -s argument is opening https://free-proxy-list.net/ page and that's it. Nothing happens.
I tried with tor but when I run tor_driver.py I get
[chi@PC examples]$ python -m tor_driver.py
Traceback (most recent call last):
File "/home/chi/.pyenv/versions/3.9.0/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/home/chi/.pyenv/versions/3.9.0/lib/python3.9/runpy.py", line 111, in _get_module_details
import(pkg_name)
File "/home/chi/Traduceri/SRT-DeepL-Translator-master/examples/tor_driver.py", line 1, in
And with the other file I get this:
python -m translate_using_tor_service.py
INFO:root:Begin translate process
INFO:root:Going to DeepL
Traceback (most recent call last):
File "/home/chi/.pyenv/versions/3.9.0/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/home/chi/.pyenv/versions/3.9.0/lib/python3.9/runpy.py", line 111, in _get_module_details
import(pkg_name)
File "/home/chi/Traduceri/SRT-DeepL-Translator-master/examples/translate_using_tor_service.py", line 18, in
Sorry for the long message...
Ok... in the first error.. yeah, it is the proxy... you could pass your own selenium driver if u want to avoid this issue.... (gonna fixed in the night tho).
The second, need to install "tbselenium" library to make it work
The third... I dont know the way you started tor service... look into https://github.com/sinedie/SRT-DeepL-Translator/issues/18#issuecomment-1111172304
Ok, it works now. I'm on archlinux and had to install torsocks and tbselenium and to start the tor service. Thanks!
No problem, this weekend proxy issue sould be solved and new version come out. Wait for it.