Skip to content
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

Failed to search TKK #52

Open
renatofdds opened this issue Jun 15, 2016 · 70 comments
Open

Failed to search TKK #52

renatofdds opened this issue Jun 15, 2016 · 70 comments
Labels

Comments

@renatofdds
Copy link

Any translation attempt is failing with the error:
google-translate--search-tkk: Failed to search TKK

@atykhonov
Copy link
Owner

Hi @renatofdds,

which version do you use? M-x google-translate-version RET.

@ardangelo
Copy link

I'm also having this problem. Using most recent version 0.11.11

@renatofdds
Copy link
Author

renatofdds commented Jun 30, 2016

I'm also on 0.11.11

@jack836
Copy link

jack836 commented Sep 9, 2016

Facing the same issue on 0.11.11. Any help is highly appreciated,
BTW, I am behind a http proxy.

@atykhonov
Copy link
Owner

atykhonov commented Sep 9, 2016

Hi all!

I have no idea what exactly could be the root cause of the issue. But with your help I believe the reason could be discovered and the issue fixed.

I've just pushed the code (0.11.12 version) which should help us to debug the issues which relate to retrieving of TKK.

With these changes, please, execute M-: (setq google-translate--tkk-debug t) RET (or M-x eval-expression RET (setq google-translate--tkk-debug t) RET). Then try to translate a word/sentence as usually you do. As the result, two buffers should appear. First one usual one (*Google Translate*) with the translation, and the second one (*Google Translate Debug*) with the debug info, i.e. HTML which is used for retrieving of TKK. Then please paste the contents of *Google Translate Debug* buffer here.

@atykhonov
Copy link
Owner

If you'll see that someone already posted the similar output as you get, please feel free to post it again, or just notify that you get the same output. I just believe that additional information would be helpful.

Actually any help is highly appreciated!

Thank you in advance!

@jack836
Copy link

jack836 commented Sep 12, 2016

Thank you for the efforts and further steps. I will report the test results soon.

@jack836
Copy link

jack836 commented Sep 13, 2016

After upgrading to 0.11.12 and setting the debug to true as you suggested I did a google-translate-smooth-translate.

I don't see two windows open and I receive the same error. This is what happens

Translate : "The text to be translated appears here correctly (Japanese)" RET
Translate from : Japanese RET
Translate to : English RET
connecting to proxy.xxx.xxx.xx
Failed to Search TKK

But version 0.11.10 works perfectly at my home computer (11.11 and 11.12 not tested yet). The above test was from my office computer and the only difference is that, the office computer is behind a http proxy. So I strongly doubt it has something to do with proxy.

Further testing for connection through proxy

  1. 'wget' from terminal connects successfully to http and https
    2.'eww' from emacs connects to http but fails to establish a connection to https
  2. 'package-list-packages' from emacs downloads successfully from http sources (melpa and org) but fails to download from https source (marmalade)

Since google translate has to establish a connection to https://translate.google.com, i strongly suspect it has something to do with my proxy setting. Sorry if I wasted your time.

But I would sincerely appreciate if you can point out some ways I can make it to work in my work-computer behind proxy. I also hope many people need google translate in their office computer which is normally behind a proxy.

Thank you for your time and efforts

@rfkm
Copy link

rfkm commented Dec 9, 2016

Interesting. My case is opposite. While it works on my office computer, doesn't work on my home computer. Both uses same emacs settings including google-translate's versions(0.11.13).

EDITED:

  • works on my home office computer
  • doesn't work on my office home computer

@jack836
Copy link

jack836 commented Dec 9, 2016

SOLVED
The issue was Emacs-25.0 was using the "GET method" to connect to HTTPS sites, which my company's firewall (proxy) didn't like. The solution is to make Emacs use the "CONNECT method" to request connection to HTTPS sites (which the proxy allows). The following page correctly directed me towards the solution.

http://emacs.1067599.n8.nabble.com/bug-11788-url-http-does-not-properly-handle-https-over-proxy-td46070.html

Either modify that one particular .el file and rebuild you emacs OR update to 'emacs-snapshot' version-26. I took the easier step and updated to Emacs-26.0.50.2. Now google-translate works like a charm within emacs.
Thank you all for the pointers and support

@rfkm
Copy link

rfkm commented Dec 9, 2016

@jack836 Good news. Thank you for sharing.
BTW, I've edited my comment since it was wrong. My home network doesn't use a proxy AFAIK, but it seems worthwhile to try that. Again, thanks!

@ikedaisuke
Copy link

ikedaisuke commented Sep 10, 2017

When I updated Emacs 25.1 to Emacs 25.2, I found the issue.

The issue is solved on my PC when google-translate package turns to request through HTTPS but not HTTP by setting google-translate-base-url and google-translate--tkk-url as follows

  (when (and (= emacs-major-version 25) (<= emacs-minor-version 2))
    (setq google-translate-base-url
          "https://translate.google.com/translate_a/single"
          google-translate--tkk-url
          "https://translate.google.com/"))

I am uncertain about the issue at Emacs 25.1
@jack836 mentions above that the problem is solved at Emacs 26
#52 (comment)

Wish it will be helpful.

Info:

Emacs version "25.2.1" which is built with GnuTLS library
(google-translate-version) says "Google Translate (version): 0.11.14"
google-translate package is installed via MELPA version 20170713.119; not MELPA stable

@crystle9
Copy link

I met the same problem. After configuring a socks5 proxy for emacs, the problem got addressed. Maybe it's concerning to the ISP, who blocks the network traffic to google services. However, I found something weired. With network proxy set globally in gnome 3, the google services can be visited by firefox browser, but they are not available in eww web browser in emacs. The socks5 proxy settings in gnome 3 seems to be ignored.

example socks5 proxy for emacs:

(setq url-gateway-method 'socks)
(setq socks-server '("Default server" "127.0.0.1" 1080 5))

@sshaw
Copy link

sshaw commented Sep 20, 2018

This just started happening to me after months without a problem. But, it went away after a few minutes. I am not using a proxy.

UPDATE: Now using a different computer that also worked without a problem. It's now failing with the same message.
💻🔨

@rantonse
Copy link

Same problem here. It has been working for months without a problem, but now i get google-translate--search-tkk: Failed to search TKK all the time. I tried to set google-translate--tkk-debug to true, but no second buffer with debug info appears.

@touxstone
Copy link

touxstone commented Sep 21, 2018

Same problem here. It has been working for months without a problem, but now i get google-translate--search-tkk: Failed to search TKK all the time. I tried to set google-translate--tkk-debug to true, but no second buffer with debug info appears.

same issue here /'' (;;Emacs version 25.3; google-translate version 0.11.14)

@aanoaa
Copy link

aanoaa commented Sep 21, 2018

same here

GNU Emacs 26.1
Google Translate (version): 0.11.14

@rantonse
Copy link

The problem seems to be that the google-translate--tkk-regex definition in google-translate-tk.el,

"TKK=eval('((function(){var\\s-+a\\\\x3d\\(-?[0-9]+\\);var\\s-+b\\\\x3d\\(-?[0-9]+\\);return\\s-+\\([0-9]+\\)"

does not match the appropriate string in the retrieved HTML document, which in my case was

TKK='427110.1469889687'.

I'm also running Emacs 26.1 and version 0.11.14.

@atykhonov
Copy link
Owner

same here, I'm investigating and looking for a solution

@atykhonov
Copy link
Owner

atykhonov commented Sep 22, 2018

does not match the appropriate string in the retrieved HTML document

yes, previously HTML had something like the following:

TKK=eval('((function(){var a\x3d3470396290;var b\x3d183821724;return 426874+\x27.\x27+(a+b)})())');

now we have this representation: TKK='427116.3269864724';.

@SunDawning
Copy link

@atykhonov @rantonse

I found a quick fix. Try it:

(when (and (string-match "0.11.14"
                         (google-translate-version))
           (>= (time-to-seconds)
               (time-to-seconds
                (encode-time 0 0 0 23 9 2018))))
  (defun google-translate--get-b-d1 ()
    ;; TKK='427110.1469889687'
    (list 427110 1469889687)))

You can use TKK='427110.1469889687', TKK='427116.3269864724' or other value.

@0--key
Copy link

0--key commented Sep 24, 2018

Same problem here. It has been working for months without a problem, but now i get google-translate--search-tkk: Failed to search TKK all the time. I tried to set google-translate--tkk-debug to true, but no second buffer with debug info appears.

Emacs 25.1.1;
Google Translate (version): 0.11.14

A stubborn error in the Messages buffer:

 google-translate--search-tkk: Failed to search TKK

even if I change:

    (setq google-translate-base-url                                                                                            
          "https://translate.google.com/translate_a/single"                                                                    
          google-translate--tkk-url                                                                                            
          "https://translate.google.com/") 

@jajpater
Copy link

Same here.

@edurante
Copy link

I had the same problems two days ago.
My emacs version is 26.1

@SunDawning
your fix work for me.
Thanks you

(use-package google-translate
:ensure t
:config
(when (and (string-match "0.11.14"
(google-translate-version))
             (>= (time-to-seconds)
		 (time-to-seconds
                  (encode-time 0 0 0 23 9 2018))))
    (defun google-translate--get-b-d1 ()
      ;; TKK='427110.1469889687'
      (list 427110 1469889687))))

@ybiquitous
Copy link

@edurante Thanks for your workaround!

I also use use-package, and the below patch works for me. 😃

-:config
+:init

@ybiquitous
Copy link

I'm very sorry! The above patch in #52 (comment) is my misunderstanding. 🙇
(:config is correct, NOT :init)

Also, I need this workaround using bind-keys* instead of :bind:

(use-package google-translate
  :config
  ;; ...
  ;; Workaround in https://github.com/atykhonov/google-translate/issues/52#issuecomment-424302439
  ;; ...

  ;; BEGIN: Workaround which I need
  (bind-keys*
    ("C-c t" . google-translate-at-point)
    ("C-c T" . google-translate-at-point-reverse))
  ;; :bind (("C-c t" . google-translate-at-point)
  ;;        ("C-c T" . google-translate-at-point-reverse))
  ;; END
  )

@atykhonov
Copy link
Owner

@SunDawning it works very well! Thanks a lot! I'm preparing a patch based on the workaround.

@atykhonov
Copy link
Owner

But is it ok that the last version (0.11.17) does not work out of the box?

@dvzubarev it works out of the box for me (without any issue).

@atykhonov
Copy link
Owner

I supposed this is kind of an issue that we experienced before when for part of the users google-translate works well but for part of them it doesn't work well. So the issues are reported here when something doesn't work. And I can wait until it will not work for me as well (as it happened before) and then I can fix it. But it still works for me. I'll try to figure out what can be the root cause of the issue.

In the meantime, I've just merged #91 that provides several backends (emacs as the default, curl and wget). You can try to configure google-translate (v0.11.18) with curl (or wget) as a last resort in order to cope with the issues reported here (see README.md for more details). Please let me know how it does work for you. Kudos to @t-suwa !

ybiquitous added a commit to ybiquitous/.emacs.d that referenced this issue Jun 23, 2019
* Set the new variable `google-translate-backend-method`.
* Remove unnecessary workaround.

See also:

* atykhonov/google-translate#52 (comment)
* atykhonov/google-translate#91
@Inzaniam
Copy link

Hola a todos, hablare en español porque mi ingles es increíblemente pésimo y tal ves se me entienda menos de ese modo.

tuve exactamente el mismo problema de ustedes pero con el Textractor, y llame a la compañía de internet para intentar cambiar mi ip, ya que no se cambiaba de manera tradicional a pesar de supuestamente ser una ip dinámica, y al ayudarme la chica del call center me dijo que había un bloqueo en mi router, que me lo quito, pero que evite usar ese tipo de programas porque ellos no ofrecen ese tipo de servicio, no entendi muy bien a lo que se refería, ya que se muy poco de programación, pero aun asi me quedo claro que el problema era un bloqueo en el router.

no se si esto es lo que genera todo, o solo es mi caso particular en todo casi si a alguien le sucede este problema especialmente con el uso de textractor, y tiene servicio con claro, llamen a servicio al cliente, puede ser el mismo bloqueo que yo tenia.

@pbienst
Copy link

pbienst commented Aug 2, 2019

I tried with 0.11.18, but it works neither with curl nor the emacs backend:

Fri Aug  2 10:27:16 2019
("http://translate.google.com/" curl (:args ("-s" "-L" "-A")))
-- begin --

-- end --
Fri Aug  2 10:29:08 2019
("http://translate.google.com/" emacs)
-- begin --

-- end --

yuravg added a commit to yuravg/.emacs.d that referenced this issue Jan 12, 2020
yuravg added a commit to yuravg/.emacs.d that referenced this issue Jan 21, 2020
yuravg added a commit to yuravg/.emacs.d that referenced this issue Feb 7, 2020
yuravg added a commit to yuravg/.emacs.d that referenced this issue Feb 11, 2020
@stardiviner stardiviner added the bug label Jun 9, 2020
@KaushalKesharpu
Copy link

KaushalKesharpu commented Nov 6, 2020

(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
works for me and stops the error

google-translate--search-tkk: Search failed: ",tkk:'"

This works for me with google-translate-backend-method set to 'curl. You also need to use require google-translate (if you are using use-package) before redefining the function. Hence my setup is

(require 'google-translate)
(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
(setq google-translate-backend-method 'curl)

@rileyrg
Copy link

rileyrg commented Nov 16, 2020

This reply fixed it for me :

(use-package google-translate
  :ensure t
  :custom
  (google-translate-backend-method 'curl)
  :config
   (defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130)))

@pbienst
Copy link

pbienst commented Nov 16, 2020

This should be useful to help implement a true fixed version:

https://github.com/Boudewijn26/gTTS-token/blob/master/docs/november-2020-translate-changes.md

yuravg added a commit to yuravg/.emacs.d that referenced this issue Dec 3, 2020
Fixed error: google-translate--search-tkk: Search failed: ",tkk:'"
atykhonov/google-translate#52 (comment)
yuravg added a commit to yuravg/.emacs.d that referenced this issue Dec 4, 2020
Fixed error: google-translate--search-tkk: Search failed: ",tkk:'"
https://github.com/
atykhonov/google-translate/issues/52#issuecomment-727920888
@stardiviner stardiviner pinned this issue Dec 19, 2020
driverCzn added a commit to driverCzn/dotFiles that referenced this issue Mar 22, 2021
@dodona2
Copy link

dodona2 commented Apr 28, 2021

(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
(setq google-translate-backend-method 'curl)

works for me. Thanks!

@eval-exec
Copy link

(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
(setq google-translate-backend-method 'curl)

works for me. Thanks!

this also work for my version: 0.12.0

@dodona2
Copy link

dodona2 commented May 29, 2021

(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
(setq google-translate-backend-method 'curl)
works for me. Thanks!

this also work for my version: 0.12.0

I wonder why the maintainers don't include the 2 lines into google-translate sources?

dalanicolai added a commit to dalanicolai/spacemacs that referenced this issue Jul 30, 2021
This bug exists already since I started using Spacemacs about 1.5 year ago.
Because it was already reported upstreaim in
[this issue](atykhonov/google-translate#52), I
implemented this fix only locally.

However it becomes time now to implement this fix globally, to fix the
google-translate functionality by default.
duianto pushed a commit to syl20bnr/spacemacs that referenced this issue Jul 31, 2021
This bug exists already since I started using Spacemacs about 1.5 year ago.
Because it was already reported upstreaim in
[this issue](atykhonov/google-translate#52), I
implemented this fix only locally.

However it becomes time now to implement this fix globally, to fix the
google-translate functionality by default.
@henningninneh
Copy link

(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130)) (setq google-translate-backend-method 'curl)

works for me. Thanks!

For me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests