Closed alexreg closed 9 years ago
I'm not scraping the site, but I think Google changed the JSON structure. I'll have a look at this tonight.
Well, by default the google translation returns en_US, so technically that is correct. ;-) But I wanted to add more flags anyway. So I push that up on my list.
Looks like Google blocked access:
$ curl "https://translate.google.com/#auto/en/zwei+hunde"
<!DOCTYPE html><html lang=en><meta charset=utf-8><meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"><title>Error 403 (Forbidden)!!1</title><style>*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}</style><a href=//www.google.com/><span id=logo aria-label=Google></span></a><p><b>403.</b> <ins>That’s an error.</ins><p>Your client does not have permission to get URL <code>/</code> from this server. (Client IP address: 94.135.XX.XX)<br><br>
<ins>That’s all we know.</ins>
Looks like it. :-( I call another URL though. For your example I'd call
http://translate.google.com/translate_a/t?client=p&text=zwei-hunde&hl=en-EN&sl=auto&tl=en&multires=1&ssel=0&tsel=0&sc=1&ie=UTF-8&oe=UTF-8
that gives me
HTTP/1.1 302 Found
Location: http://ipv4.google.com/sorry/IndexRedirect?continue=http://translate.google.com/translate_a/t%3Fclient%3Dp%26text%3Dzwei-hunde%26hl%3Den-EN%26sl%3Dauto%26tl%3Den%26multires%3D1%26ssel%3D0%26tsel%3D0%26sc%3D1%26ie%3DUTF-8%26oe%3DUTF-8&q=CGMSBNQMIGEYi6qUqQUiGQDxp4NL4w3Mw2CSZ4vYmPmKEd-tN7CUmYI
Date: Wed, 08 Apr 2015 11:46:19 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Content-Type: text/html; charset=UTF-8
Server: HTTP server (unknown)
Content-Length: 492
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic,p=0.5
Seems like Google shut the door on this API. :-1:
Ah, that’s a shame. I suppose you could still do some screen-scraping… are you going to update it for that in time?
Cheers.
On 8 Apr 2015, at 12:47, Thomas Hempel notifications@github.com wrote:
Looks like it. :-( I call another URL though. For your example I'd call
HTTP/1.1 302 Found Location: http://ipv4.google.com/sorry/IndexRedirect?continue=http://translate.google.com/translate_a/t%3Fclient%3Dp%26text%3Dzwei-hunde%26hl%3Den-EN%26sl%3Dauto%26tl%3Den%26multires%3D1%26ssel%3D0%26tsel%3D0%26sc%3D1%26ie%3DUTF-8%26oe%3DUTF-8&q=CGMSBNQMIGEYi6qUqQUiGQDxp4NL4w3Mw2CSZ4vYmPmKEd-tN7CUmYI Date: Wed, 08 Apr 2015 11:46:19 GMT Pragma: no-cache Expires: Fri, 01 Jan 1990 00:00:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Content-Type: text/html; charset=UTF-8 Server: HTTP server (unknown) Content-Length: 492 X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN Alternate-Protocol: 80:quic,p=0.5 Seems like Google shut the door on this API.
— Reply to this email directly or view it on GitHub https://github.com/thomashempel/AlfredGoogleTranslateWorkflow/issues/14#issuecomment-90889548.
Please checkout the newest version 2.2.3. It should be fixed there. At least it works for me again.
Works for me. Thanks! It is my most often used workflow :)
Mine too ;-)
Excellent, seems fixed now, thank you.
Could you just change the irrelevant US flag to an England one please? That would make a lot more sense. I'm confused every time I see the US flag...
@thomashempel Is that okay, re the icon issue? Thanks.
I think Google Translate updated their page format, so if you're doing scraping, that may be the reason.
Also, could we have an English flag for English please? There's no reason that the USA flag should be used, let's be fair. :)