POST http://translate.google.com/translate_a/t resulted in a `503 Service Unavailable` response #62

Closed
joeforjoomla opened this Issue Aug 30, 2016 · 73 comments

Comments

Projects
None yet
@joeforjoomla

joeforjoomla commented Aug 30, 2016

Library stopped working. Checking the response of the request to http://translate.google.com/translate_a/t it looks like a 503 Service Unavailable

Server error response [url] http://ipv4.google.com/sorry/IndexRedirect?continue=http%3A%2F%2Ftranslate.google.com%2Ftranslate_a%2Ft&q=CGMSBFcVvDgY76SYvgUiGQDxp4NLWjSyK9Kcfu_3QluMCB6pWX64XWE [status code] 503 [reason phrase] Service Unavailable

@skyismine

This comment has been minimized.

Show comment
Hide comment
@skyismine

skyismine Aug 31, 2016

I have the same error.

I have the same error.

@lxedison

This comment has been minimized.

Show comment
Hide comment
@lxedison

lxedison Aug 31, 2016

yesterday, i did a press test , i forked 10000+ process to request server at the same time, and today i found 503 Service Unavailable, wish it has no relationship. T_T

yesterday, i did a press test , i forked 10000+ process to request server at the same time, and today i found 503 Service Unavailable, wish it has no relationship. T_T

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

I don't think indeed. Today 503 Service Unavailable but this test by @helen5106 is still working http://www.liuxiatool.com/t.php

The library by @Stichoza is broken although.. hope they can have a look soon....

I don't think indeed. Today 503 Service Unavailable but this test by @helen5106 is still working http://www.liuxiatool.com/t.php

The library by @Stichoza is broken although.. hope they can have a look soon....

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

The library fails with the following exception:

Fatal error: Uncaught exception 'ErrorException' with message 'Server error response [url] http://ipv4.google.com/sorry/IndexRedirect?continue=http%3A%2F%2Ftranslate.google.com%2Ftranslate_a%2Ft&q=CGMSBFcVvDgY06CavgUiGQDxp4NLrwjog7r3dK2p6xQdFbOXFyCu9lU [status code] 503 [reason phrase] Service Unavailable' in E:\vhosts\HTML5\stichoza\vendor\stichoza\google-translate-php\src\Stichoza\GoogleTranslate\TranslateClient.php:215 Stack trace: #0 E:\vhosts\HTML5\stichoza\vendor\stichoza\google-translate-php\src\Stichoza\GoogleTranslate\TranslateClient.php(247): Stichoza\GoogleTranslate\TranslateClient->getResponse('Hello World!') #1 E:\vhosts\HTML5\stichoza\vendor\stichoza\google-translate-php\src\Stichoza\GoogleTranslate\TranslateClient.php(143): Stichoza\GoogleTranslate\TranslateClient->instanceTranslate('Hello World!') #2 E:\vhosts\HTML5\stichoza\index.php(8): Stichoza\GoogleTranslate\TranslateClient->__call('translate', Array) #3 E:\vhosts\HTML5\stichoza\index.php(8): Stichoza\GoogleTranslate\TranslateClient->translate('Hello in E:\vhosts\HTML5\stichoza\vendor\stichoza\google-translate-php\src\Stichoza\GoogleTranslate\TranslateClient.php on line 215

The library fails with the following exception:

Fatal error: Uncaught exception 'ErrorException' with message 'Server error response [url] http://ipv4.google.com/sorry/IndexRedirect?continue=http%3A%2F%2Ftranslate.google.com%2Ftranslate_a%2Ft&q=CGMSBFcVvDgY06CavgUiGQDxp4NLrwjog7r3dK2p6xQdFbOXFyCu9lU [status code] 503 [reason phrase] Service Unavailable' in E:\vhosts\HTML5\stichoza\vendor\stichoza\google-translate-php\src\Stichoza\GoogleTranslate\TranslateClient.php:215 Stack trace: #0 E:\vhosts\HTML5\stichoza\vendor\stichoza\google-translate-php\src\Stichoza\GoogleTranslate\TranslateClient.php(247): Stichoza\GoogleTranslate\TranslateClient->getResponse('Hello World!') #1 E:\vhosts\HTML5\stichoza\vendor\stichoza\google-translate-php\src\Stichoza\GoogleTranslate\TranslateClient.php(143): Stichoza\GoogleTranslate\TranslateClient->instanceTranslate('Hello World!') #2 E:\vhosts\HTML5\stichoza\index.php(8): Stichoza\GoogleTranslate\TranslateClient->__call('translate', Array) #3 E:\vhosts\HTML5\stichoza\index.php(8): Stichoza\GoogleTranslate\TranslateClient->translate('Hello in E:\vhosts\HTML5\stichoza\vendor\stichoza\google-translate-php\src\Stichoza\GoogleTranslate\TranslateClient.php on line 215

@skyismine

This comment has been minimized.

Show comment
Hide comment
@skyismine

skyismine Aug 31, 2016

http://www.liuxiatool.com/t.php use GET request, google-translate-php use POST request.

http://www.liuxiatool.com/t.php use GET request, google-translate-php use POST request.

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

I tried changing from

$response = $this->httpClient->post( $this->urlBase, array (
'body' => $queryArray,
'headers' => array (
'User-Agent' => $ua,
'Referer' => 'https://translate.google.com'
)
) );.

to

$response = $this->httpClient->get ( $this->urlBase, array (
'body' => $queryArray,
'headers' => array (
'User-Agent' => $ua,
'Referer' => 'https://translate.google.com'
)
) );

but still not working

I tried changing from

$response = $this->httpClient->post( $this->urlBase, array (
'body' => $queryArray,
'headers' => array (
'User-Agent' => $ua,
'Referer' => 'https://translate.google.com'
)
) );.

to

$response = $this->httpClient->get ( $this->urlBase, array (
'body' => $queryArray,
'headers' => array (
'User-Agent' => $ua,
'Referer' => 'https://translate.google.com'
)
) );

but still not working

@skyismine

This comment has been minimized.

Show comment
Hide comment
@skyismine

skyismine Aug 31, 2016

I have no idea, waiting for @Stichoza

I have no idea, waiting for @Stichoza

@lxedison

This comment has been minimized.

Show comment
Hide comment
@lxedison

lxedison Aug 31, 2016

online waiting

online waiting

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

I tested a bit more... it seems something having to do with the Guzzle lib maybe... waiting for @Stichoza and @helen5106

I tested a bit more... it seems something having to do with the Guzzle lib maybe... waiting for @Stichoza and @helen5106

@prappo

This comment has been minimized.

Show comment
Hide comment
@prappo

prappo Aug 31, 2016

I got the same problem , I built a project on it now nothing working .

prappo commented Aug 31, 2016

I got the same problem , I built a project on it now nothing working .

@Stichoza

This comment has been minimized.

Show comment
Hide comment
@Stichoza

Stichoza Aug 31, 2016

Owner

Hey guys, sorry to see this package failing. Will have a look, any help appreciated

Owner

Stichoza commented Aug 31, 2016

Hey guys, sorry to see this package failing. Will have a look, any help appreciated

Stichoza added a commit that referenced this issue Aug 31, 2016

Hotfix #62
Makes all tests green, except array translation
@Stichoza

This comment has been minimized.

Show comment
Hide comment
@Stichoza

Stichoza Aug 31, 2016

Owner

Pushed a new tag v3.2.9 which fixes all problems except array translation.

Owner

Stichoza commented Aug 31, 2016

Pushed a new tag v3.2.9 which fixes all problems except array translation.

@prappo

This comment has been minimized.

Show comment
Hide comment
@prappo

prappo Aug 31, 2016

Still not working . just returning 'en' . @Stichoza

prappo commented Aug 31, 2016

Still not working . just returning 'en' . @Stichoza

@treblaf

This comment has been minimized.

Show comment
Hide comment
@treblaf

treblaf Aug 31, 2016

Contributor

It working if you change 'dt' parameter from 'null' to 't' in query. I don't know why.
//'dt' => null,
'dt' => 't',

Contributor

treblaf commented Aug 31, 2016

It working if you change 'dt' parameter from 'null' to 't' in query. I don't know why.
//'dt' => null,
'dt' => 't',

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

not working at my end... just returning 'en' with 'dt' => null
გ�მ�რჯ�ბ� მს�ფლი� and with 'dt' => 't'

not working at my end... just returning 'en' with 'dt' => null
გ�მ�რჯ�ბ� მს�ფლი� and with 'dt' => 't'

@treblaf

This comment has been minimized.

Show comment
Hide comment
@treblaf

treblaf Aug 31, 2016

Contributor

@joeforjoomla can you give me the source text?

Contributor

treblaf commented Aug 31, 2016

@joeforjoomla can you give me the source text?

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

Sorry @treblaf my mistake, i confirm you that it's working with 'dt' => 't'

Sorry @treblaf my mistake, i confirm you that it's working with 'dt' => 't'

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

Basically 3 changes are required:

endpoint from http://translate.google.com/translate_a/t to http://translate.google.com/translate_a/single

client from 'client' => 'webapp' to 'client' => 't'

param 'dt' => 't'

Basically 3 changes are required:

endpoint from http://translate.google.com/translate_a/t to http://translate.google.com/translate_a/single

client from 'client' => 'webapp' to 'client' => 't'

param 'dt' => 't'

@Stichoza

This comment has been minimized.

Show comment
Hide comment
@Stichoza

Stichoza Aug 31, 2016

Owner

@joeforjoomla I did two of those. Didn't changed the last one. Feel free to send a PR as it's your fix

Owner

Stichoza commented Aug 31, 2016

@joeforjoomla I did two of those. Didn't changed the last one. Feel free to send a PR as it's your fix

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

I can do this, i think you should firstly create a new branch tag.

I can do this, i think you should firstly create a new branch tag.

@Stichoza

This comment has been minimized.

Show comment
Hide comment
@Stichoza

Stichoza Aug 31, 2016

Owner

#63 is merged now and a new tag published. Can you guys confirm it's working?

Owner

Stichoza commented Aug 31, 2016

#63 is merged now and a new tag published. Can you guys confirm it's working?

@iginikolaev

This comment has been minimized.

Show comment
Hide comment
@iginikolaev

iginikolaev Aug 31, 2016

Works, as for me. Thanks.

Works, as for me. Thanks.

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Aug 31, 2016

I confirm, as of now it's working for me, no issues

I confirm, as of now it's working for me, no issues

@untoreh

This comment has been minimized.

Show comment
Hide comment
@untoreh

untoreh Aug 31, 2016

Contributor

#64 added some compatibility for arrays...but can't translate strings of multiple languages (which if I remember correctly was only possible with auto anyway?)

Contributor

untoreh commented Aug 31, 2016

#64 added some compatibility for arrays...but can't translate strings of multiple languages (which if I remember correctly was only possible with auto anyway?)

@danielriosantos

This comment has been minimized.

Show comment
Hide comment
@danielriosantos

danielriosantos Sep 1, 2016

Hi, not working again... error 503 even after #64 ... Google might have change something...

Hi, not working again... error 503 even after #64 ... Google might have change something...

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Sep 1, 2016

It's still working for me without #64 fix and not using arrays

It's still working for me without #64 fix and not using arrays

@robov

This comment has been minimized.

Show comment
Hide comment
@robov

robov Sep 1, 2016

Working again... AMAZING !!!... THANKS !!!!

robov commented Sep 1, 2016

Working again... AMAZING !!!... THANKS !!!!

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 Sep 1, 2016

Hi, i think it's still not working. Even without #64 fix.

Hi, i think it's still not working. Even without #64 fix.

@avg0043

This comment has been minimized.

Show comment
Hide comment
@avg0043

avg0043 Sep 1, 2016

Hi, 3.2.11 version gives me 503 error..

avg0043 commented Sep 1, 2016

Hi, 3.2.11 version gives me 503 error..

@untoreh

This comment has been minimized.

Show comment
Hide comment
@untoreh

untoreh Sep 1, 2016

Contributor

#64 is only for arrays which is just some string parsing...the request has no changes, it has been said before that when google changes it takes some time for all the servers to catch up, so you need to make sure you are accessing the right server. There is also a tokenless endpoint that you can try:
https://translate.googleapis.com/translate_a/single?client=gtx&sl=it&tl=en&dt=t&q=casa

Contributor

untoreh commented Sep 1, 2016

#64 is only for arrays which is just some string parsing...the request has no changes, it has been said before that when google changes it takes some time for all the servers to catch up, so you need to make sure you are accessing the right server. There is also a tokenless endpoint that you can try:
https://translate.googleapis.com/translate_a/single?client=gtx&sl=it&tl=en&dt=t&q=casa

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 Sep 2, 2016

It's strange. I got two sites with this google translator script. One is working perfect other not. Now i get error 500. I tried also tokenless handpoint. How long is it take for all the google servers to catch up? Can be more than 24 hours?

trenccan777 commented Sep 2, 2016

It's strange. I got two sites with this google translator script. One is working perfect other not. Now i get error 500. I tried also tokenless handpoint. How long is it take for all the google servers to catch up? Can be more than 24 hours?

@Doxramos

This comment has been minimized.

Show comment
Hide comment
@Doxramos

Doxramos Sep 3, 2016

2016-09-02

Currently. Checked on all URLs posted above.

Doxramos commented Sep 3, 2016

2016-09-02

Currently. Checked on all URLs posted above.

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 Sep 3, 2016

Any solution to this problem? Thanks

Any solution to this problem? Thanks

@amprodes

This comment has been minimized.

Show comment
Hide comment
@amprodes

amprodes Sep 4, 2016

it's not working because google block the request ip? if we use proxy will help? because i installed the library and did like 3 request and everything was ok until like the four request i got "503 Service Unavailable"

amprodes commented Sep 4, 2016

it's not working because google block the request ip? if we use proxy will help? because i installed the library and did like 3 request and everything was ok until like the four request i got "503 Service Unavailable"

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Sep 4, 2016

It looks weird that you guys can't get it working. After the changes explained above i got it working fine again both on the live server and localhost

It looks weird that you guys can't get it working. After the changes explained above i got it working fine again both on the live server and localhost

@amprodes

This comment has been minimized.

Show comment
Hide comment
@amprodes

amprodes Sep 4, 2016

the problem is that google is banning bot behavior ... i use an array to translate simultaneous text lines and after multiples request google ban my ip! ... there is a work around this?

amprodes commented Sep 4, 2016

the problem is that google is banning bot behavior ... i use an array to translate simultaneous text lines and after multiples request google ban my ip! ... there is a work around this?

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Sep 6, 2016

Is there a way to determine if the ban is coming when using array to translate or even for normal single text?

Is there a way to determine if the ban is coming when using array to translate or even for normal single text?

@anilix

This comment has been minimized.

Show comment
Hide comment
@anilix

anilix Sep 6, 2016

I've got exactly the same problem as @trenccan777 and @amprodes. It looks like google ban my server IP after several requests and all I get is 503 error:

Fatal error: Uncaught exception 'ErrorException' with message 'Server error:POST http://translate.google.com/translate_a/single` resulted in a 503 Service Unavailable response`

anilix commented Sep 6, 2016

I've got exactly the same problem as @trenccan777 and @amprodes. It looks like google ban my server IP after several requests and all I get is 503 error:

Fatal error: Uncaught exception 'ErrorException' with message 'Server error:POST http://translate.google.com/translate_a/single` resulted in a 503 Service Unavailable response`

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk Sep 6, 2016

Ban after several requests (single text). Then after some time unban. Help :)

fero-sk commented Sep 6, 2016

Ban after several requests (single text). Then after some time unban. Help :)

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Sep 6, 2016

So it looks that the problem is still not solved! Google still bans the IP
@Stichoza please participate with us to fix the library

So it looks that the problem is still not solved! Google still bans the IP
@Stichoza please participate with us to fix the library

@amprodes

This comment has been minimized.

Show comment
Hide comment
@amprodes

amprodes Sep 6, 2016

Well the problem is if you try to translate line by line... what i did was take my array and conver to string separated by || ... like this;

// this is my array with non translated lines of text
$textosA = array($lines_to_translate);

//this is my array turning to a string with each line separated by ||
$transBlock = implode('||',$textosA);

//then we send just one request to google.translate
$translated = $tr->translate($transBlock);

//and then we turn into an array again with our line texts already translated! .... bitches!!!
$traduccion = explode('||',$translated);

But if you need to make more than one request per process i recommend you to use sleep(); with random seconds starting from 45sec to 60sec of wait ... they also have proxy that you guys can use with gimmeproxy.com ... http://gimmeproxy.com/api/getProxy the api is really easy to use!

amprodes commented Sep 6, 2016

Well the problem is if you try to translate line by line... what i did was take my array and conver to string separated by || ... like this;

// this is my array with non translated lines of text
$textosA = array($lines_to_translate);

//this is my array turning to a string with each line separated by ||
$transBlock = implode('||',$textosA);

//then we send just one request to google.translate
$translated = $tr->translate($transBlock);

//and then we turn into an array again with our line texts already translated! .... bitches!!!
$traduccion = explode('||',$translated);

But if you need to make more than one request per process i recommend you to use sleep(); with random seconds starting from 45sec to 60sec of wait ... they also have proxy that you guys can use with gimmeproxy.com ... http://gimmeproxy.com/api/getProxy the api is really easy to use!

@treblaf

This comment has been minimized.

Show comment
Hide comment
@treblaf

treblaf Sep 7, 2016

Contributor

Looks like the problem is in our request. We send all parameters and text in POST query, but web version of Google Translate send parameters in URL and ONLY text in POST (q=TEXT). So I changed the request in TranslateClient.php:

$queryArray = array_merge($this->urlParams, [
    //'text' => $data,
    'sl'   => $this->sourceLanguage,
    'tl'   => $this->targetLanguage,
    'tk'   => $this->tokenProvider->generateToken($this->sourceLanguage, $this->targetLanguage, $tokenData),
]);

$queryUrl = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', http_build_query($queryArray));

$queryBodyArray = [
    'q' => $data,
];

$queryBodyEncoded = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', http_build_query($queryBodyArray));

try {
    $response = $this->httpClient->post($this->urlBase, [
        'query' => $queryUrl,
        'body' => $queryBodyEncoded
        ] + $this->httpOptions);
} catch (GuzzleRequestException $e) {
    throw new ErrorException($e->getMessage());
}

It's works for me now. Can you all test it too?
Sorry for my english and code style.

Contributor

treblaf commented Sep 7, 2016

Looks like the problem is in our request. We send all parameters and text in POST query, but web version of Google Translate send parameters in URL and ONLY text in POST (q=TEXT). So I changed the request in TranslateClient.php:

$queryArray = array_merge($this->urlParams, [
    //'text' => $data,
    'sl'   => $this->sourceLanguage,
    'tl'   => $this->targetLanguage,
    'tk'   => $this->tokenProvider->generateToken($this->sourceLanguage, $this->targetLanguage, $tokenData),
]);

$queryUrl = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', http_build_query($queryArray));

$queryBodyArray = [
    'q' => $data,
];

$queryBodyEncoded = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', http_build_query($queryBodyArray));

try {
    $response = $this->httpClient->post($this->urlBase, [
        'query' => $queryUrl,
        'body' => $queryBodyEncoded
        ] + $this->httpOptions);
} catch (GuzzleRequestException $e) {
    throw new ErrorException($e->getMessage());
}

It's works for me now. Can you all test it too?
Sorry for my english and code style.

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 Sep 7, 2016

After trying your code I immediately get error 500. Maybe i made mistake by updating the code because from your post is hard to identify the changes.

After trying your code I immediately get error 500. Maybe i made mistake by updating the code because from your post is hard to identify the changes.

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk Sep 7, 2016

@treblaf - it looks working, thanks... waiting for IP ban :)

fero-sk commented Sep 7, 2016

@treblaf - it looks working, thanks... waiting for IP ban :)

@treblaf

This comment has been minimized.

Show comment
Hide comment
@treblaf

treblaf Sep 7, 2016

Contributor

@trenccan777 there are the diffs (you can download TranslateClient.php from my repository for test):
treblaf@00597e9

@fero-sk It's working for two hours, but I'm waiting for ban too)

Contributor

treblaf commented Sep 7, 2016

@trenccan777 there are the diffs (you can download TranslateClient.php from my repository for test):
treblaf@00597e9

@fero-sk It's working for two hours, but I'm waiting for ban too)

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 Sep 7, 2016

It looks like its working. Yesterday I get ban after 5 minutes. So i will give you feedback. Thanks

It looks like its working. Yesterday I get ban after 5 minutes. So i will give you feedback. Thanks

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Sep 7, 2016

Thanks guys, please test test test and if the problem is really fixed sending only the text in POST we have to open a PR for the library

Thanks guys, please test test test and if the problem is really fixed sending only the text in POST we have to open a PR for the library

@treblaf

This comment has been minimized.

Show comment
Hide comment
@treblaf

treblaf Sep 7, 2016

Contributor

I opened PR. Maybe @Stichoza or somebody can correct my code, because my code style is not very good.

Contributor

treblaf commented Sep 7, 2016

I opened PR. Maybe @Stichoza or somebody can correct my code, because my code style is not very good.

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Sep 7, 2016

Ok, but most important thing is understanding if this fixes the ban issue. If so, @Stichoza will be happy to update the library

Ok, but most important thing is understanding if this fixes the ban issue. If so, @Stichoza will be happy to update the library

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 Sep 7, 2016

Guys, I can confirm that the script is working without any problem. I have tested it on multiple sites.

Guys, I can confirm that the script is working without any problem. I have tested it on multiple sites.

@joeforjoomla

This comment has been minimized.

Show comment
Hide comment
@joeforjoomla

joeforjoomla Sep 7, 2016

That's a great news. Please open a PR for @Stichoza to refactor the code and include it in the library

That's a great news. Please open a PR for @Stichoza to refactor the code and include it in the library

@jschnurr jschnurr referenced this issue in sloria/TextBlob Sep 8, 2016

Closed

Fix #137 Language detection not working #139

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk Sep 11, 2016

@treblaf it's working fine

fero-sk commented Sep 11, 2016

@treblaf it's working fine

@amprodes

This comment has been minimized.

Show comment
Hide comment
@amprodes

amprodes Sep 11, 2016

I try and now it's working

El dom., 11 sept. 2016 11:48 a. m., fero-sk notifications@github.com
escribió:

@treblaf https://github.com/treblaf it's working fine


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#62 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPjjspR6i08jVI1sFMiscgrfdIPFoU-ks5qpDDngaJpZM4JxEh3
.

I try and now it's working

El dom., 11 sept. 2016 11:48 a. m., fero-sk notifications@github.com
escribió:

@treblaf https://github.com/treblaf it's working fine


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#62 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPjjspR6i08jVI1sFMiscgrfdIPFoU-ks5qpDDngaJpZM4JxEh3
.

@gskema

This comment has been minimized.

Show comment
Hide comment
@gskema

gskema Sep 13, 2016

Contributor

Upgrading to 3.2.11 fixed the 503 error for us. Note: we only send single string translation requests.

Contributor

gskema commented Sep 13, 2016

Upgrading to 3.2.11 fixed the 503 error for us. Note: we only send single string translation requests.

@frzsombor

This comment has been minimized.

Show comment
Hide comment
@frzsombor

frzsombor Sep 19, 2016

Contributor

After a few hours of usage, unfortunately, I get the 503 Service Unavailable error again. However, it might be something like an IP ban, because I send a request about every 2 seconds to the Google translate server. The page content is "Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot. [etc...]"

Update (2017.04.12.)
I can confirm that the package is WORKING. Only a large number of requests from a single IP causes Google to respond with "503 Service Unavailable". But proxies are cheap, and currently, with a couple of them, I'm error free more than 6 months. Hope this will not change soon.

Contributor

frzsombor commented Sep 19, 2016

After a few hours of usage, unfortunately, I get the 503 Service Unavailable error again. However, it might be something like an IP ban, because I send a request about every 2 seconds to the Google translate server. The page content is "Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot. [etc...]"

Update (2017.04.12.)
I can confirm that the package is WORKING. Only a large number of requests from a single IP causes Google to respond with "503 Service Unavailable". But proxies are cheap, and currently, with a couple of them, I'm error free more than 6 months. Hope this will not change soon.

@blackxored blackxored referenced this issue in thomashempel/AlfredGoogleTranslateWorkflow Nov 16, 2016

Open

translate on Alfred 3 #32

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 May 21, 2018

Hi guys, it looks like this problem is happening again after some time. I have few websites with google api and one of them is getting 503 error. It is the most visited one. After few days from the error I tried to run this script again and it worked for a few minutes and then again 503. As I can see I'm not the only one who is having this issue. matheuss/google-translate-api#67 .

trenccan777 commented May 21, 2018

Hi guys, it looks like this problem is happening again after some time. I have few websites with google api and one of them is getting 503 error. It is the most visited one. After few days from the error I tried to run this script again and it worked for a few minutes and then again 503. As I can see I'm not the only one who is having this issue. matheuss/google-translate-api#67 .

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk May 21, 2018

Yes. 5 days ago Google started to block IP addresses... :(

fero-sk commented May 21, 2018

Yes. 5 days ago Google started to block IP addresses... :(

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk May 24, 2018

@Stichoza + @treblaf - could you please help us? we're getting 503 error after short time... then after cca. 24 hours it work's again (several minutes)

fero-sk commented May 24, 2018

@Stichoza + @treblaf - could you please help us? we're getting 503 error after short time... then after cca. 24 hours it work's again (several minutes)

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk May 25, 2018

Problem is with GoogleTokenGenerator.php - there's something changed...

fero-sk commented May 25, 2018

Problem is with GoogleTokenGenerator.php - there's something changed...

@frzsombor

This comment has been minimized.

Show comment
Hide comment
@frzsombor

frzsombor May 25, 2018

Contributor

@fero-sk: I don't think anything changed in the token generation. I've tried special characters, numbers, long text, short text, everything, and all the generated tokens are valid, and

this library STILL WORKS for me every time.

However, as I'm still using this library DAILY for almost 2 years, I noticed that Google became stricter a few days ago, just when @trenccan777 wrote his comment. They must have lowered the "number of allowed requests / minute / IP" because I also started getting 503 errors when I used an IP address for too long.

The solution: still the same as I wrote above: buy and use proxies (just like me), change them frequently, more frequently than we had to in the past. If you don't want to pay for them, and you are using this package on your own computer, try changing your IP by restarting the router, etc. Also, IP bans will be removed automatically after some time (sorry, don't know exactly), so you don't have to buy new proxies over and over again.

Contributor

frzsombor commented May 25, 2018

@fero-sk: I don't think anything changed in the token generation. I've tried special characters, numbers, long text, short text, everything, and all the generated tokens are valid, and

this library STILL WORKS for me every time.

However, as I'm still using this library DAILY for almost 2 years, I noticed that Google became stricter a few days ago, just when @trenccan777 wrote his comment. They must have lowered the "number of allowed requests / minute / IP" because I also started getting 503 errors when I used an IP address for too long.

The solution: still the same as I wrote above: buy and use proxies (just like me), change them frequently, more frequently than we had to in the past. If you don't want to pay for them, and you are using this package on your own computer, try changing your IP by restarting the router, etc. Also, IP bans will be removed automatically after some time (sorry, don't know exactly), so you don't have to buy new proxies over and over again.

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk May 25, 2018

I don't think it's all about IP blocking. In browser translate.google.com - works, but Stichoza/google-translate-php - doesn't. Maybe some query parameters. If I'll find, I'll let you know.
Edit: @frzsombor I used a cookie "NID" in a request a it works now...

fero-sk commented May 25, 2018

I don't think it's all about IP blocking. In browser translate.google.com - works, but Stichoza/google-translate-php - doesn't. Maybe some query parameters. If I'll find, I'll let you know.
Edit: @frzsombor I used a cookie "NID" in a request a it works now...

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 May 26, 2018

@fero-sk is your website still running after using the cookie? If yes, could you please provide me a location where did you put it in the code. A few days ago, I tried to change the IP of the website and it worked only hour maybe and than 503 again.

@fero-sk is your website still running after using the cookie? If yes, could you please provide me a location where did you put it in the code. A few days ago, I tried to change the IP of the website and it worked only hour maybe and than 503 again.

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk May 26, 2018

@trenccan777 yes... still running... (not now, I have to change the Cookie)

$guzzle_conf = array(
"headers" => array(
"Cookie" => 'NID=XXX', // XXX - your NID Cookie
),
);
$translator = new Stichoza\GoogleTranslate\TranslateClient("en", "de", $guzzle_conf);

But, as @frzsombor wrote, I got blocked also (trying to lower number of requests).

fero-sk commented May 26, 2018

@trenccan777 yes... still running... (not now, I have to change the Cookie)

$guzzle_conf = array(
"headers" => array(
"Cookie" => 'NID=XXX', // XXX - your NID Cookie
),
);
$translator = new Stichoza\GoogleTranslate\TranslateClient("en", "de", $guzzle_conf);

But, as @frzsombor wrote, I got blocked also (trying to lower number of requests).

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 May 26, 2018

Thanks, but I dont know if Im understand. You need to change the cookie regularly to keep the translation working?

trenccan777 commented May 26, 2018

Thanks, but I dont know if Im understand. You need to change the cookie regularly to keep the translation working?

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk May 26, 2018

fero-sk commented May 26, 2018

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 May 26, 2018

@fero-sk and where I can find this part of code in this package. In which file? Because I don't know where to implement this cookie "hack". Thanks.

@fero-sk and where I can find this part of code in this package. In which file? Because I don't know where to implement this cookie "hack". Thanks.

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk May 26, 2018

@trenccan777 when you're creating a translator (in your code, not in this package):

$guzzle_conf = array("headers" => array("Cookie" => 'NID=XXX'));
$tr = new TranslateClient('en', 'ka', $guzzle_conf);

fero-sk commented May 26, 2018

@trenccan777 when you're creating a translator (in your code, not in this package):

$guzzle_conf = array("headers" => array("Cookie" => 'NID=XXX'));
$tr = new TranslateClient('en', 'ka', $guzzle_conf);

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 May 27, 2018

@fero-sk Is your translation still working? I have tried your NID Hack and after an hour received ban. What numbers are representing the XXX in the NID. It can be any integer? Thanks

@fero-sk Is your translation still working? I have tried your NID Hack and after an hour received ban. What numbers are representing the XXX in the NID. It can be any integer? Thanks

@fero-sk

This comment has been minimized.

Show comment
Hide comment
@fero-sk

fero-sk May 27, 2018

@trenccan777 XXX is the Cookie (NID) you get from translate.google.com (https://en.wikipedia.org/wiki/HTTP_cookie)

fero-sk commented May 27, 2018

@trenccan777 XXX is the Cookie (NID) you get from translate.google.com (https://en.wikipedia.org/wiki/HTTP_cookie)

@trenccan777

This comment has been minimized.

Show comment
Hide comment
@trenccan777

trenccan777 May 28, 2018

Hi guys, I'm trying to make a request via proxy. I follow the guide on the main page. A'm I doing it right? Because it is not working.

`$from = substr($_GET['from'],0,2);
$to = substr($_GET['to'],0,2);
$tr = new TranslateClient();
$tr->setSource($from);
$tr->setTarget($to);
$tr->setHttpOption(['proxy' => 'socks5://195.88.208.115:3129']);

$translatedText = $tr->translate(strip_tags($_GET['text']));

echo $translatedText;`

UPDATE

I tried this code on the website where I don't have BAN and it looks like it is translating via proxy. This means that if you already BANNED, the proxy doesn't help. But what can proxy do is lowering a number of requests so you can avoid to be Banned from Google. This is only my theory. I didn't tested it yet. I would appreciate if someone could confirm this. Thanks

trenccan777 commented May 28, 2018

Hi guys, I'm trying to make a request via proxy. I follow the guide on the main page. A'm I doing it right? Because it is not working.

`$from = substr($_GET['from'],0,2);
$to = substr($_GET['to'],0,2);
$tr = new TranslateClient();
$tr->setSource($from);
$tr->setTarget($to);
$tr->setHttpOption(['proxy' => 'socks5://195.88.208.115:3129']);

$translatedText = $tr->translate(strip_tags($_GET['text']));

echo $translatedText;`

UPDATE

I tried this code on the website where I don't have BAN and it looks like it is translating via proxy. This means that if you already BANNED, the proxy doesn't help. But what can proxy do is lowering a number of requests so you can avoid to be Banned from Google. This is only my theory. I didn't tested it yet. I would appreciate if someone could confirm this. Thanks

@frzsombor

This comment has been minimized.

Show comment
Hide comment
@frzsombor

frzsombor Jun 7, 2018

Contributor

Ok guys, I think I really found the problem and the solution for you.

The docs about configuring Guzzle on the main page is outdated, those config options are for Guzzle 5.3 (docs), but according to composer.json the project is now using Guzzle 6. And since Guzzle 6 you shouldn't use the defaults key in the options, but specify options directly (docs), so instead of that, configure guzzle like this:

$tr = new TranslateClient(null, 'en', [
    'timeout' => 10,
    'proxy' => [
        'http'  => 'tcp://localhost:8125',
        'https' => 'tcp://localhost:9124'
    ],
    'headers' => [
        'User-Agent' => 'Foo/5.0 Lorem Ipsum Browser'
    ]
]);

I'm using it like this for a really long time (and never used ->setHttpOption), because back then, I figured this out myself reading Guzzle's docs, and I also wanted to create and issue (created one just now) and a pull request on this, but didn't have the time and forgot about it. So I think the problem was this simple: you thought you are using proxies but you haven't. This is why you thought that "if you already BANNED, the proxy doesn't help" because Google banned your real IP and Guzzle ignored your proxy settings, so you were still using your own. Google only bans IPs (there is nothing else they see from your request), so if "you are banned" it means your IP is banned, nothing else.

@trenccan777 : socks5 proxies are a bit tricky with Guzzle, please check #1484 in Guzzle's issues. Maybe you were passing the proxy option correctly to guzzle by using ->setHttpOption, but you run into problems because of socks5.

About "NID cookies": According to Google it is just a cookie for storing user preferences, and I don't think they ever issued bans based on this cookie which are simply "settings". Don't want to go into details why or how it may worked for you, but believe me, I'm pretty sure if you get your proxy settings right, you can forget about setting any cookies.


@Stichoza Also I think after fixing #96, it would be a good idea to share some informations about this on the main page, telling other developers that "503 Service Unavailable" is not definitely a problem with this package, but most likely it means their IP address is banned, and they should limit the requests or use proxies (correctly). And then, maybe this issue can be closed. :)

Contributor

frzsombor commented Jun 7, 2018

Ok guys, I think I really found the problem and the solution for you.

The docs about configuring Guzzle on the main page is outdated, those config options are for Guzzle 5.3 (docs), but according to composer.json the project is now using Guzzle 6. And since Guzzle 6 you shouldn't use the defaults key in the options, but specify options directly (docs), so instead of that, configure guzzle like this:

$tr = new TranslateClient(null, 'en', [
    'timeout' => 10,
    'proxy' => [
        'http'  => 'tcp://localhost:8125',
        'https' => 'tcp://localhost:9124'
    ],
    'headers' => [
        'User-Agent' => 'Foo/5.0 Lorem Ipsum Browser'
    ]
]);

I'm using it like this for a really long time (and never used ->setHttpOption), because back then, I figured this out myself reading Guzzle's docs, and I also wanted to create and issue (created one just now) and a pull request on this, but didn't have the time and forgot about it. So I think the problem was this simple: you thought you are using proxies but you haven't. This is why you thought that "if you already BANNED, the proxy doesn't help" because Google banned your real IP and Guzzle ignored your proxy settings, so you were still using your own. Google only bans IPs (there is nothing else they see from your request), so if "you are banned" it means your IP is banned, nothing else.

@trenccan777 : socks5 proxies are a bit tricky with Guzzle, please check #1484 in Guzzle's issues. Maybe you were passing the proxy option correctly to guzzle by using ->setHttpOption, but you run into problems because of socks5.

About "NID cookies": According to Google it is just a cookie for storing user preferences, and I don't think they ever issued bans based on this cookie which are simply "settings". Don't want to go into details why or how it may worked for you, but believe me, I'm pretty sure if you get your proxy settings right, you can forget about setting any cookies.


@Stichoza Also I think after fixing #96, it would be a good idea to share some informations about this on the main page, telling other developers that "503 Service Unavailable" is not definitely a problem with this package, but most likely it means their IP address is banned, and they should limit the requests or use proxies (correctly). And then, maybe this issue can be closed. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment