Closed armoucar closed 9 years ago
I can't confirm this. It's still working for me.
Can you give a few more details. What languages are you trying to translate and how?
Greets, Thomas
I was using version 2.2.x so I updated to 2.3 just in case. Still not getting results. If there's something I could do to test it deeper or debug it...
Thanks.
Hm, that is strange. Can you please try "gt" instead of "translate". That shouldn't make a difference b ut you never know. Maybe that is some sort of interference with other workflows. Do you have the most recent version of Alfred installed?
This is how it looks on my machine btw:
Never mind, it has worked at home. Tomorrow I'll test on work's connection again. Sorry to bother
I confirm this; it's no longer working for the past day or two. Google have seemingly changed their API in some countries (I'm in Britain).
While you're at it, might be nice to have a Spanish flag. :)
@alexreg it's working at my house but not at work. I suppose it is a network problem.
Well it’s definitely not a network problem here… always worked at my home, but not the past 2 days. It could well be regional – Google often roll out new web pages / APIs in a very patchy way.
@thomashempel, do you need me to do a packet sniffing session… or something simpler, to help diagnose?
On 31 Jul 2015, at 16:46, Arthur Moura Carvalho notifications@github.com wrote:
@alexreg https://github.com/alexreg it's working at my house but not at work. I suppose it is a network problem.
— Reply to this email directly or view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/19#issuecomment-126729387.
@alexreg Well, first off, it might be helpful to know where you come from. So I can try to find out what the problem might be. For me everything is still working without any problems.
What I could imagine is, that somehow the rate limit of the API is exceeded because of some proxies on the way from your client to Google. But that is really just a guess.
What you could try is, open the workflow and inside open the "googleTranslate.php". Go to line 68 and behind the
$out = curl_exec($ch);
add
file_put_contents('/tmp/alfred.out', $url . "\n" . $out);
Than try to translate something and post the file "/tmp/alfred.out" here. That should tell us what the API says.
Best wishes, Thomas
Aha, that certainly illuminates the problem. It seems the response is a "page moved" one. I guess you need to pass the -L option to curl (or equivalent in code)? And perhaps modify the URL too?
The contents of alfred.out
is as follows.
http://translate.google.com/translate_a/t?client=it&text=hello&hl=en-EN&sl=en&tl=es&multires=1&ssel=0&tsel=0&sc=1&ie=UTF-8&oe=UTF-8
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://ipv4.google.com/sorry/IndexRedirect?continue=http://translate.google.com/translate_a/t%3Fclient%3Dit%26text%3Dhello%26hl%3Den-EN%26sl%3Den%26tl%3Des%26multires%3D1%26ssel%3D0%26tsel%3D0%26sc%3D1%26ie%3DUTF-8%26oe%3DUTF-8&q=CGMSBF4DzLoYuLH0rQUiGQDxp4NLEZf8pCb5Ja-jxQq-eFMrmp0Usok">here</A>.
</BODY></HTML>
So, I added CURLOPT_FOLLOWLOCATION => true
to the defaults array, and now I see it’s redirecting to a captcha-confirmation.
https://gist.github.com/86b4563f803681141427 https://gist.github.com/86b4563f803681141427
Maybe I’m just using the utility too much? In any case, that’s awkward… is there some way around this? Perhaps adding in a user-agent header or something?
On 1 Aug 2015, at 19:37, Thomas Hempel notifications@github.com wrote:
@alexreg https://github.com/alexreg Well, first off, it might be helpful to know where you come from. So I can try to find out what the problem might be. For me everything is still working without any problems.
What I could imagine is, that somehow the rate limit of the API is exceeded because of some proxies on the way from your client to Google. But that is really just a guess.
What you could try is, open the workflow and inside open the "googleTranslate.php". Go to line 68 and behind the
$out = curl_exec($ch); add
file_put_contents('/tmp/alfred.out', $url . "\n" . $out); Than try to translate something and post the file "/tmp/alfred.out" here. That should tell us what the API says.
Best wishes, Thomas
— Reply to this email directly or view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/19#issuecomment-126944071.
Excellent: so adding the line CURLOPT_USERAGENT => ‘AlfredGoogleTranslateWorkflow’
to the defaults array does the trick – it’s working again.
Perhaps you could make a new release with this fix?
Per above, would be nice to get a Spanish flag added too (and a few others, if it’s not too much to ask).
Cheers!
On 1 Aug 2015, at 19:37, Thomas Hempel notifications@github.com wrote:
@alexreg https://github.com/alexreg Well, first off, it might be helpful to know where you come from. So I can try to find out what the problem might be. For me everything is still working without any problems.
What I could imagine is, that somehow the rate limit of the API is exceeded because of some proxies on the way from your client to Google. But that is really just a guess.
What you could try is, open the workflow and inside open the "googleTranslate.php". Go to line 68 and behind the
$out = curl_exec($ch); add
file_put_contents('/tmp/alfred.out', $url . "\n" . $out); Than try to translate something and post the file "/tmp/alfred.out" here. That should tell us what the API says.
Best wishes, Thomas
— Reply to this email directly or view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/19#issuecomment-126944071.
Alright, a new version 2.3.1 with the fixes is online. It also includes a spanish flag icon! ;-)
Please let me know if it is working now, so I can close this issue.
Thanks and best wishes, Thomas
Seems to work for now
Yes, all is good. Thank you Thomas!
On 5 Aug 2015, at 15:32, Thomas Hempel notifications@github.com wrote:
Seems to work for now
— Reply to this email directly or view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/19#issuecomment-128016843.
Where do you get your flags from by the way? Maybe I will add some in the future, and submit a pull request so you can add them easily…
On 5 Aug 2015, at 15:32, Thomas Hempel notifications@github.com wrote:
Seems to work for now
— Reply to this email directly or view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/19#issuecomment-128016843.
TBH, Normally I just search for royalty free images on Google that don't need any mentioning.
It is not working for me anymore. Does someone confirm the same? Thanks :)