Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

Stopped working #19

Closed
armoucar opened this issue Jul 30, 2015 · 16 comments
Closed

Stopped working #19

armoucar opened this issue Jul 30, 2015 · 16 comments

Comments

@armoucar
Copy link
Contributor

It is not working for me anymore. Does someone confirm the same? Thanks :)

@thomashempel
Copy link
Owner

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

@armoucar
Copy link
Contributor Author

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...

image

Thanks.

@thomashempel
Copy link
Owner

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:

fullscreen_30_07_15_20_18

@armoucar
Copy link
Contributor Author

Never mind, it has worked at home. Tomorrow I'll test on work's connection again. Sorry to bother

@alexreg
Copy link

alexreg commented Jul 31, 2015

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).

screenshot

While you're at it, might be nice to have a Spanish flag. :)

@armoucar
Copy link
Contributor Author

@alexreg it's working at my house but not at work. I suppose it is a network problem.

@alexreg
Copy link

alexreg commented Jul 31, 2015

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 #19 (comment).

@thomashempel
Copy link
Owner

@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

@alexreg
Copy link

alexreg commented Aug 1, 2015

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&amp;q=CGMSBF4DzLoYuLH0rQUiGQDxp4NLEZf8pCb5Ja-jxQq-eFMrmp0Usok">here</A>.
</BODY></HTML>

@alexreg
Copy link

alexreg commented Aug 2, 2015

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 #19 (comment).

@alexreg
Copy link

alexreg commented Aug 2, 2015

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 #19 (comment).

@thomashempel
Copy link
Owner

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

@thomashempel
Copy link
Owner

Seems to work for now

@alexreg
Copy link

alexreg commented Aug 5, 2015

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 #19 (comment).

@alexreg
Copy link

alexreg commented Aug 5, 2015

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 #19 (comment).

@thomashempel
Copy link
Owner

TBH, Normally I just search for royalty free images on Google that don't need any mentioning.

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

No branches or pull requests

3 participants