(unofficial) Googletrans: Free and Unlimited Google translate API for Python. Translates totally free of charge.

Overview

Googletrans

GitHub license travis status Documentation Status PyPI version Coverage Status Code Climate

Googletrans is a free and unlimited python library that implemented Google Translate API. This uses the Google Translate Ajax API to make calls to such methods as detect and translate.

Compatible with Python 3.6+.

For details refer to the API Documentation.

Features

  • Fast and reliable - it uses the same servers that translate.google.com uses
  • Auto language detection
  • Bulk translations
  • Customizable service URL
  • HTTP/2 support

TODO

more features are coming soon.

  • Proxy support
  • Internal session management (for better bulk translations)

HTTP/2 support

This library uses httpx for HTTP requests so HTTP/2 is supported by default.

You can check if http2 is enabled and working by the ._response.http_version of Translated or Detected object:

>>> translator.translate('테스트')._response.http_version
# 'HTTP/2'

How does this library work

You may wonder why this library works properly, whereas other approaches such like goslate won't work since Google has updated its translation service recently with a ticket mechanism to prevent a lot of crawler programs.

I eventually figure out a way to generate a ticket by reverse engineering on the obfuscated and minified code used by Google to generate such token, and implemented on the top of Python. However, this could be blocked at any time.


Installation

To install, either use things like pip with the package "googletrans" or download the package and put the "googletrans" directory into your python path.

$ pip install googletrans

Basic Usage

If source language is not given, google translate attempts to detect the source language.

>>> from googletrans import Translator
>>> translator = Translator()
>>> translator.translate('안녕하세요.')
# <Translated src=ko dest=en text=Good evening. pronunciation=Good evening.>
>>> translator.translate('안녕하세요.', dest='ja')
# <Translated src=ko dest=ja text=こんにちは。 pronunciation=Kon'nichiwa.>
>>> translator.translate('veritas lux mea', src='la')
# <Translated src=la dest=en text=The truth is my light pronunciation=The truth is my light>

Customize service URL

You can use another google translate domain for translation. If multiple URLs are provided, it then randomly chooses a domain.

>>> from googletrans import Translator
>>> translator = Translator(service_urls=[
      'translate.google.com',
      'translate.google.co.kr',
    ])

Advanced Usage (Bulk)

Array can be used to translate a batch of strings in a single method call and a single HTTP session. The exact same method shown above works for arrays as well.

>>> translations = translator.translate(['The quick brown fox', 'jumps over', 'the lazy dog'], dest='ko')
>>> for translation in translations:
...    print(translation.origin, ' -> ', translation.text)
# The quick brown fox  ->  빠른 갈색 여우
# jumps over  ->  이상 점프
# the lazy dog  ->  게으른 개

Language detection

The detect method, as its name implies, identifies the language used in a given sentence.

>>> from googletrans import Translator
>>> translator = Translator()
>>> translator.detect('이 문장은 한글로 쓰여졌습니다.')
# <Detected lang=ko confidence=0.27041003>
>>> translator.detect('この文章は日本語で書かれました。')
# <Detected lang=ja confidence=0.64889508>
>>> translator.detect('This sentence is written in English.')
# <Detected lang=en confidence=0.22348526>
>>> translator.detect('Tiu frazo estas skribita en Esperanto.')
# <Detected lang=eo confidence=0.10538048>

GoogleTrans as a command line application

$ translate -h
usage: translate [-h] [-d DEST] [-s SRC] [-c] text

Python Google Translator as a command-line tool

positional arguments:
  text                  The text you want to translate.

optional arguments:
  -h, --help            show this help message and exit
  -d DEST, --dest DEST  The destination language you want to translate.
                        (Default: en)
  -s SRC, --src SRC     The source language you want to translate. (Default:
                        auto)
  -c, --detect

$ translate "veritas lux mea" -s la -d en
[veritas] veritas lux mea
    ->
[en] The truth is my light
[pron.] The truth is my light

$ translate -c "안녕하세요."
[ko, 1] 안녕하세요.

Note on library usage

DISCLAIMER: this is an unofficial library using the web API of translate.google.com and also is not associated with Google.

  • The maximum character limit on a single text is 15k.
  • Due to limitations of the web version of google translate, this API does not guarantee that the library would work properly at all times (so please use this library if you don't care about stability).
  • Important: If you want to use a stable API, I highly recommend you to use Google's official translate API.
  • If you get HTTP 5xx error or errors like #6, it's probably because Google has banned your client IP address.

Versioning

This library follows Semantic Versioning from v2.0.0. Any release versioned 0.x.y is subject to backwards incompatible changes at any time.

Contributing

Contributions are more than welcomed. See CONTRIBUTING.md


License

Googletrans is licensed under the MIT License. The terms are as follows:

The MIT License (MIT)

Copyright (c) 2015 SuHun Han

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Issues
  • Add handling for when TKK is already rendered

    Add handling for when TKK is already rendered

    Randomly the TKK value is coming back already rendered. This will handle that case.

    opened by Guy-Dipietro-Bose 49
  • Found a Google Translate endpoint that doesn't require an API key.

    Found a Google Translate endpoint that doesn't require an API key.

    This isn't a bug report, just a sharing of some findings while looking through minified source code.

    While digging through the source code of Google's Google Dictionary Chrome extension, which has support for translating via Google Translate, I found the endpoint they use in order to do just that. Since googletrans frequently runs into 5xx errors, it might be useful to switch off to another endpoint, although this one is also annoyingly touchy with 403s.

    Breakdown

    Endpoint: https://clients5.google.com/translate_a/t

    Query Parameters

    | Query Parameter | Default | Notes | |-----------------|------------------|---------------------------------------------------------------| | client | dict-chrome-ex | Needs to be dict-chrome-ex or else you'll get a 403 error. | | sl | auto | Designates the source language of the text to translate. | | tl | (none) | Designates the destination language of the text to translate. | | q | (none) | Text to translate |

    Example Response

    URL: https://clients5.google.com/translate_a/t?client=dict-chrome-ex&sl=auto&tl=en&q=bonjour

    {
      "sentences": [
        {
          "trans": "Hello",
          "orig": "bonjour",
          "backend": 1
        }
      ],
      "dict": [
        {
          "pos": "interjection",
          "terms": [
            "Hello!",
            "Hi!",
            "Good morning!",
            "Good afternoon!",
            "How do you do?",
            "Hallo!",
            "Hullo!",
            "Welcome!"
          ],
          "entry": [
            {
              "word": "Hello!",
              "reverse_translation": [
                "Bonjour!",
                "Salut!",
                "Tiens!",
                "Allô!"
              ],
              "score": 0.7316156
            },
            {
              "word": "Hi!",
              "reverse_translation": [
                "Salut!",
                "Bonjour!",
                "Hé!"
              ],
              "score": 0.084690653
            },
            {
              "word": "Good morning!",
              "reverse_translation": [
                "Bonjour!"
              ],
              "score": 0.065957151
            },
            {
              "word": "Good afternoon!",
              "reverse_translation": [
                "Bonjour!"
              ],
              "score": 0.02749503
            },
            {
              "word": "How do you do?",
              "reverse_translation": [
                "Bonjour!",
                "Salut!",
                "Ça marche?"
              ]
            },
            {
              "word": "Hallo!",
              "reverse_translation": [
                "Bonjour!",
                "Tiens!",
                "Salut!",
                "Allô!"
              ]
            },
            {
              "word": "Hullo!",
              "reverse_translation": [
                "Tiens!",
                "Allô!",
                "Salut!",
                "Bonjour!"
              ]
            },
            {
              "word": "Welcome!",
              "reverse_translation": [
                "Salut!",
                "Bonjour!",
                "Soyez le bienvenu!"
              ]
            }
          ],
          "base_form": "Bonjour!",
          "pos_enum": 9
        }
      ],
      "src": "fr",
      "alternative_translations": [
        {
          "src_phrase": "bonjour",
          "alternative": [
            {
              "word_postproc": "Hello",
              "score": 1000,
              "has_preceding_space": true,
              "attach_to_next_token": false
            }
          ],
          "srcunicodeoffsets": [
            {
              "begin": 0,
              "end": 7
            }
          ],
          "raw_src_segment": "bonjour",
          "start_pos": 0,
          "end_pos": 0
        }
      ],
      "confidence": 0.96875,
      "ld_result": {
        "srclangs": [
          "fr"
        ],
        "srclangs_confidences": [
          0.96875
        ],
        "extended_srclangs": [
          "fr"
        ]
      },
      "query_inflections": [
        {
          "written_form": "bonjour",
          "features": {
            "gender": 1,
            "number": 2
          }
        },
        {
          "written_form": "bonjours",
          "features": {
            "gender": 1,
            "number": 1
          }
        },
        {
          "written_form": "bonjour",
          "features": {
            "number": 2
          }
        },
        {
          "written_form": "bonjours",
          "features": {
            "number": 1
          }
        }
      ]
    }
    
    pinned 
    opened by SuperSonicHub1 48
  • AttributeError: 'NoneType' object has no attribute 'group'

    AttributeError: 'NoneType' object has no attribute 'group'

    My script like this: #-- coding:utf-8 -- from googletrans import Translator import sys import io

    translator = Translator() tanstext = u'我们' tran_ch = translator.translate(tanstext ).text print tran_ch ############### yesterday this is ok and no problem,but today I run my script without internet, show some problem.And I run the script in the internet environment, but it's show same problem,can't run. The cmd show the Traceback like this: Traceback (most recent call last): File "D:\JDstory\workstory\translation-project\filetocut\trans-test.py", line 10, in tran_ch = translator.translate(tanstext).text File "D:\software\Python27\lib\site-packages\googletrans\client.py", line 132, in translate data = self._translate(text, dest, src) File "D:\software\Python27\lib\site-packages\googletrans\client.py", line 57, in _translate token = self.token_acquirer.do(text) File "D:\software\Python27\lib\site-packages\googletrans\gtoken.py", line 180, in do self._update() File "D:\software\Python27\lib\site-packages\googletrans\gtoken.py", line 59, in _update code = unicode(self.RE_TKK.search(r.text).group(1)).replace('var ', '') AttributeError: 'NoneType' object has no attribute 'group' ######################### That's why? Thank you so much!

    opened by halleyshx 40
  • Feature/enhance use of direct api

    Feature/enhance use of direct api

    In a perspective to help solving issue #234 I propose a solution that implements a proper way to use translate.googleapis.com as url service. This url service has following characteristics:

    • no need for a token
    • uses client gtx instead of webapp I made a few modifications to mainly deal with these characteristics, preserving the possibility to use standard webapp calls. The client should use 'translate.googleapis.com' as service url when instanciating Translator() object, adapted code will manage the valuation of client gtx in utils params. Looking forward to reading your remarks for improvement is needed before final merge.
    opened by alainrouillon 38
  • json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    I am trying to translate a list of tokens from chinese to english. I get the following error after a few attempts of translation. Is this because of rate limits?

    File "/home/sharath/.local/lib/python3.5/site-packages/googletrans/client.py", line 127, in translate
       translated = self.translate(item, dest=dest, src=src)
     File "/home/sharath/.local/lib/python3.5/site-packages/googletrans/client.py", line 132, in translate
       data = self._translate(text, dest, src)
     File "/home/sharath/.local/lib/python3.5/site-packages/googletrans/client.py", line 63, in _translate
       data = utils.format_json(r.text)
     File "/home/sharath/.local/lib/python3.5/site-packages/googletrans/utils.py", line 62, in format_json
       converted = legacy_format_json(original)
     File "/home/sharath/.local/lib/python3.5/site-packages/googletrans/utils.py", line 54, in legacy_format_json
       converted = json.loads(text)
     File "/data/anaconda2/envs/dlatk/lib/python3.5/json/__init__.py", line 319, in loads
       return _default_decoder.decode(s)
     File "/data/anaconda2/envs/dlatk/lib/python3.5/json/decoder.py", line 339, in decode
       obj, end = self.raw_decode(s, idx=_w(s, 0).end())
     File "/data/anaconda2/envs/dlatk/lib/python3.5/json/decoder.py", line 357, in raw_decode
       raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    
    opened by chandrasg 32
  • AttributeError: 'NoneType' object has no attribute 'group'

    AttributeError: 'NoneType' object has no attribute 'group'

    I'm using one of the basic code:

    from googletrans import Translator
    
    translator = Translator()
    
    translation=translator.translate('안녕하세요.', dest='ja')
    
    print(translation)
    

    And I'm getting an attribute error : AttributeError: 'NoneType' object has no attribute 'group'

    Please let me know if the module is still working properly.

    wontfix 
    opened by Itz-MrJ 24
  • Google Trans - Giving me same Input as Output

    Google Trans - Giving me same Input as Output

    Googletrans version:

    • 3.x

    I'm submitting a ...

    • bug report

    Current behavior: I am trying to translate from AWS EC2 Instance with googletrans python library using below snippet:

    translator = Translator(service_urls=['translate.google.com', 'translate.google.co.kr'])
    translated_text = str(translator.translate("你好!", dest="en").text)
    
    print(translated_text) # <------- outputs to 你好! but it should be ideally Hello there
    

    Even I tried with proxy like below where I read proxy from file and use it at translator() method, but no luck:

    translator = Translator(service_urls=['translate.google.com', 'translate.google.co.kr'],proxies=proxy)
    translated_text = str(translator.translate("你好!", dest="en").text)
    print(translated_text)
    

    The same code was working for 6+ months at same instance, but from last 2-3 days , I am getting output same as input. I checked it translate.google.com , it was working fine, so thought it would be a bug with googletrans

    Current Behaviour:

    Suppose if I want to translate 你好! to English , At Output , I am getting same value "你好!" - before that it converts to "Hello there".

    Environment:

    1. Ubuntu 16.04.6 LTS
    2. Python 3.7.3
    3. GoogleTrans - 3.0.0, httpcore - 0.9.1 , httpx - 0.13.3
    4. AWS Region : US_EAST

    Please help me to figure out root-cause of this error. The same code works on different machine - is there any limitation on IP?

    Even for Single text, this is happening. Any help appreciated, Thanks!

    opened by mohamedniyaz1996 23
  • [Error] Google changed their API... again

    [Error] Google changed their API... again

    Google has changed their API yet again. Using this tool and the fix in #78 no longer works as it now gives this error:

    \googletrans\gtoken.py", line 66, in _update code = unicode(self.RE_TKK.search(r.text).group(1)).replace('var ', '') AttributeError: 'NoneType' object has no attribute 'group'

    Does anybody have an idea how to fix this?

    opened by Darkblader24 22
  • googletrans 4.0.0-rc1 fails with TypeError: 'NoneType' object is not iterable on client.py:222

    googletrans 4.0.0-rc1 fails with TypeError: 'NoneType' object is not iterable on client.py:222

    Googletrans version:

    • 4.0.0rc1

    I'm submitting a ...

    • [x] bug report
    • [ ] feature request

    Current behavior:

    python3
    Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from googletrans import Translator
    >>> translator = Translator()
    >>> print(translator.translate("Author", src="en", dest="de").text)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "c:\Users\Max\AppData\Local\Programs\Python\Python37-32\lib\site-packages\googletrans\client.py", line 222, in translate
        translated_parts = list(map(lambda part: TranslatedPart(part[0], part[1] if len(part) >= 2 else []), parsed[1][0][0][5]))
    TypeError: 'NoneType' object is not iterable
    

    Expected behavior:

    I expect the "Author" word in deuch

    Steps to reproduce:

    • Install googletrans 4.0.0-rc1
    • Call python and make steps from "Current behavior"
    bug wontfix 
    opened by MaxBrain 21
  • gtoken changed

    gtoken changed

    The gtoken format has changed. This doesn't work anymore.

    opened by gorm-db 18
  • no result back

    no result back

    api can not use, the result is null Googletrans version:

    • [ o] 4.0.0rc1
    • [ ] 3.1.0a0
    • [ ] 3.0.0
    • [ ] 2.x

    I'm submitting a ...

    • [ o] bug report
    • [ ] feature request

    Current behavior:

    Expected behavior:

    Steps to reproduce:

    Related code:

    insert short code snippets here
    

    Other information:

    opened by songsh 0
  • Idea : Make its command line tool read from stdin ?

    Idea : Make its command line tool read from stdin ?

    Googletrans version:

    • [ ] 4.0.0rc1
    • [x] 3.1.0a0

    I'm submitting a ...

    • [ ] bug report
    • [x] feature request

    Could make a new featue for the command line tool read from the stdin ? Currently I use a ugly method solving the request.

    echo 你好世界 | xargs -I {} translate {}
    [zh-CN] 你好世界
        ->
    [en] Hello World
    [pron.] None
    
    opened by siuoly 0
  • Idea: Return extra_data as dictionary instead of lists?

    Idea: Return extra_data as dictionary instead of lists?

    Edit: Using version 3.1.0a

    I wonder if it is possible to have the library parse extra_data into a more convenient structure instead of a tree of nested lists. I had to write a lot of code to parse extra_data into a more usable list of dictionaries. I think other uses may benefit from getting "tagged" data. I couldn't find any documentation about the returned data format and client.py doesn't explain the extra_data structure beyond the initial categories.

    I fear that my assumptions on my limited testing might not be enough. Although, I did find this project which provides sorted json: https://github.com/FreddieDeWitt/extended-google-translate-api It'd be nice to have a similar sorted output.

    Current Output of extra_data

    translator = googletrans.Translator()
    result = translator.translate(text=text, src=src, dest=dest)
    main_translation = {
            "input_text": text,
            "src":src,
            "dest":dest,
            "translated_text": result.text,
            "pronunciation":result.pronunciation,
        }
        print(main_translation)
    print(result.extra_data['all-translations'])
    

    {'input_text': 'test', 'src': 'en', 'dest': 'zh-tw', 'translated_text': '測試', 'pronunciation': 'Cèshì'}

    I'm not sure what the "None" values are, so I just discard them. Other categories have even more complex structures.

    [['noun', ['測試', '試驗', '試', '實驗', '考試', '考驗', '測驗'], [['測試', ['test', 'examination'], None, 0.61608213], ['試驗', ['test', 'experiment', 'tentative'], None, 0.21967085], ['試', ['test', 'examination', 'experiment', 'exam', 'fitting'], None, 0.020115795], ['實驗', ['experiment', 'test'], None, 0.015912903], ['考試', ['examination', 'exam', 'test'], None, 0.012588142], ['考驗', ['test', 'trial', 'ordeal'], None, 0.012588142], ['測驗', ['test', 'quiz'], None, 0.004559123]], 'test', 1], ['verb', ['檢驗', '試', '考', '測驗', '驗', '考查', '嘗'], [['檢驗', ['test', 'examine', 'inspect'], None, 0.0505711], ['試', ['test', 'try'], None, 0.020115795], ['考', ['test', 'study', 'examine', 'investigate', 'verify', 'check'], None, 0.015184198], ['測驗', ['test', 'put to test'], None, 0.004559123], ['驗', ['test', 'check', 'verify', 'examine', 'prove', 'confirm'], None, 0.0010999396], ['考查', ['test', 'investigate', 'check', 'study'], None, 0.00043074254], ['嘗', ['taste', 'flavor', 'try the flavor', 'test', 'flavour'], None, 6.3755516e-07]], 'test', 2]]

    all-translations Structure Analysis

    From what I can tell, the returned list has a bunch of redundant information.

    ["super" categories of the part of speech, for example noun or verbs
        [The list of words],
        [[Each word, a list of translations, an unknown "None", and the frequency]]
        [The input_text]
        [The number of the result]
    ]
    

    all-translations to list() of dict()

    This code pulls out the relevant information.

    list_of_alternate_translations = list()
    for pos_per_translation in result.extra_data['all-translations']:
        part_of_speech_per_translation = pos_per_translation[0]
        for all_translation in pos_per_translation[2]:
            intermediate_dic_for_list = {
                    "part-of-speech": part_of_speech_per_translation,
                    "all-translation-word": all_translation[0],
                    "all-translation-definition": all_translation[1],
                    "frequency": all_translation[3], 
                }
                list_of_alternate_translations.append(intermediate_dic_for_list)
    print(list_of_alternate_translations)
    

    The result is far more usable

    	{
    		'part-of-speech': 'noun', 
    		'all-translation-word': '測試', 
    		'all-translation-definition': ['test', 'examination'], 
    		'frequency': 0.61608213
    	}, 
    	{
    		'part-of-speech': 'noun', 
    		'all-translation-word': '試驗', 
    		'all-translation-definition': ['test', 'experiment', 'tentative'], 
    		'frequency': 0.21967085
    	}, 
    	{
    		'part-of-speech': 'noun', 
    		'all-translation-word': '試', 
    		'all-translation-definition': ['test', 'examination', 'experiment', 'exam', 'fitting'], 
    		'frequency': 0.020115795
    	}, 
    	{
    		'part-of-speech': 'noun', 
    		'all-translation-word': '實驗', 
    		'all-translation-definition': ['experiment', 'test'], 
    		'frequency': 0.015912903
    	}, 
    	{
    		'part-of-speech': 'noun', 
    		'all-translation-word': '考試', 
    		'all-translation-definition': ['examination', 'exam', 'test'], 
    		'frequency': 0.012588142
    	}, 
    	{
    		'part-of-speech': 'noun', 
    		'all-translation-word': '考驗', 
    		'all-translation-definition': ['test', 'trial', 'ordeal'], 
    		'frequency': 0.012588142
    	}, 
    	{
    		'part-of-speech': 'noun', 
    		'all-translation-word': '測驗', 
    		'all-translation-definition': ['test', 'quiz'], 
    		'frequency': 0.004559123
    	}, 
    	{
    		'part-of-speech': 'verb', 
    		'all-translation-word': '檢驗', 
    		'all-translation-definition': ['test', 'examine', 'inspect'], 
    		'frequency': 0.0505711
    	}, 
    	{
    		'part-of-speech': 'verb', 
    		'all-translation-word': '試', 
    		'all-translation-definition': ['test', 'try'], 
    		'frequency': 0.020115795
    	}, 
    	{
    		'part-of-speech': 'verb', 
    		'all-translation-word': '考', 
    		'all-translation-definition': ['test', 'study', 'examine', 'investigate', 'verify', 'check'], 
    		'frequency': 0.015184198
    	}, 
    	{
    		'part-of-speech': 'verb', 
    		'all-translation-word': '測驗', 
    		'all-translation-definition': ['test', 'put to test'], 
    		'frequency': 0.004559123
    	}, 
    	{
    		'part-of-speech': 'verb', 
    		'all-translation-word': '驗', 
    		'all-translation-definition': ['test', 'check', 'verify', 'examine', 'prove', 'confirm'], 
    		'frequency': 0.0010999396
    	}, 
    	{
    		'part-of-speech': 'verb', 
    		'all-translation-word': '考查', 
    		'all-translation-definition': ['test', 'investigate', 'check', 'study'], 
    		'frequency': 0.00043074254
    	}, 
    	{
    		'part-of-speech': 'verb', 
    		'all-translation-word': '嘗', 
    		'all-translation-definition': ['taste', 'flavor', 'try the flavor', 'test', 'flavour'], 
    		'frequency': 6.3755516e-07
    	}
    ]```
    
    Isn't that nicer?
    opened by bai-yi-bai 2
  • IndexError: list index out of range

    IndexError: list index out of range

    File "C:\Python39\lib\site-packages\aiogoogletrans\client.py", line 125, in translate data = await self._translate(text, dest, src) File "C:\Python39\lib\site-packages\aiogoogletrans\client.py", line 48, in _translate token = await self.token_acquirer.do(text) File "C:\Python39\lib\site-packages\aiogoogletrans\gtoken.py", line 188, in do await self._update() File "C:\Python39\lib\site-packages\aiogoogletrans\gtoken.py", line 59, in _update self.tkk = self.RE_TKK.findall(text)[0] IndexError: list index out of range

    opened by simbadmorehod 0
  • Setuptools warning

    Setuptools warning

    Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
    https://bugs.gentoo.org/800137

    A trivial fix is needed in setup.cfg

    opened by CyberTailor 0
  • Language detection faulty

    Language detection faulty

    Right now, I'm trying to execute the code with several spanish texts, and it's detecting english with 100% confidence. I thought you should know.

    en Detected(lang=en, confidence=1) Translated(src=en, dest=en, [email protected] Gracias por la información. Por favor siga nuestra cuenta @AskPlayStation para mayor asistencia vía mensajes directos., [email protected] Gracias por la información. Por favor siga nuestra cuenta @AskPlayStation para mayor asistencia vía mensajes directos., extra_data="{'translat...") en Detected(lang=en, confidence=1) Translated(src=en, dest=en, [email protected] Lamentamos que tenga este problema. Visite este enlace y siga los pasos para ese código específico: https://t.co/124Egi2Mzs, [email protected] Lamentamos que tenga este problema. Visite este enlace y siga los pasos para ese código específico: https://t.co/124Egi2Mzs, extra_data="{'translat...") en Detected(lang=en, confidence=1) Translated(src=en, dest=en, [email protected] Lamentamos que tenga problemas al intentar actualizar la información de facturación. Encuentre información para saber cómo agregar PayPal aquí: https://t.co/qzxpmKL2wI 1/2, [email protected] Lamentamos que tenga problemas al intentar actualizar la información de facturación. Encuentre información para saber cómo agregar PayPal aquí: https://t.co/qzxpmKL2wI 1/2, extra_data="{'translat...") en Detected(lang=en, confidence=1) Translated(src=en, dest=en, [email protected] Lamentamos que tenga este problema. Visite este enlace y siga los pasos para ese código específico: https://t.co/QVJC35Yggj, [email protected] Lamentamos que tenga este problema. Visite este enlace y siga los pasos para ese código específico: https://t.co/QVJC35Yggj, extra_data="{'translat...") en Detected(lang=en, confidence=1) Translated(src=en, dest=en, [email protected] Hola, gracias por contactarnos. Lamentamos saber que tienes problemas con tu juego. ¿Has intentado los pasos en este enlace: https://t.co/QVJC35Yggj? Dejanos saber el resultado., [email protected] Hola, gracias por contactarnos. Lamentamos saber que tienes problemas con tu juego. ¿Has intentado los pasos en este enlace: https://t.co/QVJC35Yggj? Dejanos saber el resultado., extra_data="{'translat...") en Detected(lang=en, confidence=1) Translated(src=en, dest=en, [email protected]_18 Hola Abel, gracias por contactarnos. Lamentamos saber que tienes problemas con tu juego. ¿Has intentado los pasos en este enlace: https://t.co/QVJC35Yggj? Dejanos saber el resultado., [email protected]_18 Hola Abel, gracias por contactarnos. Lamentamos saber que tienes problemas con tu juego. ¿Has intentado los pasos en este enlace: https://t.co/QVJC35Yggj? Dejanos saber el resultado., extra_data="{'translat...") en Detected(lang=en, confidence=1) Translated(src=en, dest=en, [email protected] Gracias. Siguenos a traves de Twitter para poder enviarte un Mensaje Privado con instrucciones., [email protected] Gracias. Siguenos a traves de Twitter para poder enviarte un Mensaje Privado con instrucciones., extra_data="{'translat...") en

    opened by jasperan 1
  • httpcore._exceptions.ConnectTimeout: _ssl.c:1029: The handshake operation timed out

    httpcore._exceptions.ConnectTimeout: _ssl.c:1029: The handshake operation timed out

    httpcore._exceptions.ConnectTimeout: _ssl.c:1029: The handshake operation timed out。

    excuse me,sir! some errors occur. image

    opened by WBWhiteBeard 2
  • Demo code is not working.

    Demo code is not working.

    Hello,

    I am not able to run demo code from you.

    from googletrans import Translator
    translator = Translator()
    translator.translate('안녕하세요.')
    

    Error: AttributeError: 'NoneType' object has no attribute 'group'

    Googletrans version:

    • [ ] 4.0.0rc1
    • [ ] 3.1.0a0
    • [ ] 3.0.0
    • [ ] 2.x

    I'm submitting a ...

    • [ ] bug report
    • [ ] feature request

    Current behavior:

    Expected behavior:

    Steps to reproduce:

    Related code:

    insert short code snippets here
    

    Other information:

    opened by pandya6988 5
  • Is this package deprecated?

    Is this package deprecated?

    When I run it, it just return "AttributeError: 'NoneType' object has no attribute 'group' " Is there a maintained fork that i can use?

    wontfix 
    opened by bensonchow123 4
  • Remove UTF-32 to UTF-16 to UTF-8 conversion

    Remove UTF-32 to UTF-16 to UTF-8 conversion

    In JavaScript, charCodeAt() returns UTF-16 surrogate pairs. Hence a UTF-16 to UTF-8 convertor was included in desktop_module_main.js.

    But in Python, batteries are included, so it makes absolutely no sense to first convert UTF-32 to UTF-16 manually, then UTF-16 to UTF-8 manually...

    opened by Arnie97 2
Releases(1.2)
  • 1.2(Jul 17, 2015)

    This release of py-googletrans includes following updates:

    • 29819f7: Add languages, and print exception with details
    • #1: FIx unicode error in the CLI result
    • #2: Prevent invalid language codes being passed to the translate function, and add a converter that substitutes for special cases
    Source code(tar.gz)
    Source code(zip)
streamlit translator is used to detect and translate between languages created using gTTS, googletrans, pillow and streamlit python packages

Streamlit Translator Streamlit Translator is a simple translator app to detect and translate between languages. Streamlit Translator gets text and lan

Siva Prakash 4 Jan 16, 2022
💻 Discord-Auto-Translate-Bot - If you type in the chat room, it automatically translates.

?? Discord-Auto-Translate-Bot - If you type in the chat room, it automatically translates.

LeeSooHyung 1 Jan 8, 2022
Translates English into Mandalorian (Mando'a) utilizing a "funtranslations" free API

Mandalorian Translator Translates English into Mandalorian (Mando'a) utilizing a "funtranslations" free API About I created this app to experiment wit

Hayden Covington 1 Dec 4, 2021
This is a translator that i made by myself in python with the 'googletrans' library

Translator-Python This is a translator that i made by myself in python with the 'googletrans' library This application completely made in python allow

Thadeuks 2 Jan 16, 2022
A hilarious program that translates text to Google's

Bork, bork, bork! A hilarious program that translates text in a file to Google's "bork bork bork' language. How to use Download the main.py file. Chan

The Algorithmic 1 Dec 17, 2021
A simple language translator with python and google translate api

Language translator with python A simple language translator with python and google translate api Install pip and python 3.9. All the required depende

null 0 Nov 11, 2021
AirDrive lets you store unlimited files to cloud for free. Upload & download files from your personal drive at any time using its super-fast API.

AirDrive lets you store unlimited files to cloud for free. Upload & download files from your personal drive at any time using its super-fast API.

Sougata 2 Jan 16, 2022
🚧 finCLI's own News API. No more limited API calls. Unlimited credible and latest information on BTC, Ethereum, Indian and Global Finance.

?? finCLI's own News API. No more limited API calls. Unlimited credible and latest information on BTC, Ethereum, Indian and Global Finance.

finCLI 4 Nov 28, 2021
Free and Open Source Machine Translation API. 100% self-hosted, no limits, no ties to proprietary services. Built on top of Argos Translate.

LibreTranslate Try it online! | API Docs Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on pro

UAV4GEO 1.9k Jan 20, 2022
A Simple Google Translate Bot By VndGroup ❤️ Made With Python

VndGroup Google Translator Heroku Deploy ❤️ Functions This Bot Can Translate 95 Languages We Can Set Custom Language Group Support Mandatory Vars [+]

Venuja Sadew 2 Dec 17, 2021
Telegram Google Translater Bot Can Translate Any Language To Your Selected Language

?? TELEGRAM GOOGLE TRANSLATER ?? • ⚡ INSTALLING ⚡ • • ✅ OFFICIAL SUPPORTS ✅ •

⚝ANKIT KUMAR⚝ 2 Jan 16, 2022
First Party data integration solution built for marketing teams to enable audience and conversion onboarding into Google Marketing products (Google Ads, Campaign Manager, Google Analytics).

Megalista Sample integration code for onboarding offline/CRM data from BigQuery as custom audiences or offline conversions in Google Ads, Google Analy

Google 37 Jan 10, 2022
🔍 Google Search unofficial API for Python with no external dependencies

Python Google Search API Unofficial Google Search API for Python. It uses web scraping in the background and is compatible with both Python 2 and 3. W

Avi Aryan 191 Jul 28, 2021
UNLIMITED CALL AND SMS BOMBING PYTHON SCRIPT

cc_sim_crack v.1 An open-source SMS/call bomber for Linux And Termux. Note: Due misusing of cc_sim_crack, several API's died. Don't be afraid if you d

CYBER CRACKER OFFICIAL 3 Jul 5, 2021
Braje: a python based credit hacker tool. Hack unlimited RAJE LIKER app Credit

#ReCoded Evan Al Mahmud Irfan ✨ ථ BRAJE 1.0 AUTO LIKER, AUTO COMMENT AND AUTO FOLLOWER APP CREDIT HACKER TOOL About Braje: Braje is a python based cre

Evan Al Mahmud Irfan ථ 2 Dec 23, 2021
Robot to convert files to direct links, hosting files on Telegram servers, unlimited and without restrictions

stream-cloud demo : downloader_star_bot Run : Docker : install docker , docker-compose set Environment or edit Config/init.py docker-compose up Heroku

null 27 Jan 17, 2022
Add members to unlimited telegram channels and groups

Program Features ?? Coded with Python version 10. ?? without the need for a proxy. ?? without the need for a Telegram ID. ?? Ability to add infinite p

hack4lx 2 Jan 18, 2022
Unlimited Filter Telegram Bot 2

Mother NAther Bot Features Auto Filter Manuel Filter IMDB Admin Commands Broadcast Index IMDB search Inline Search Random pics ids and User info Stats

LɪᴏɴKᴇᴛᴛʏUᴅ 1 Oct 30, 2021
A Telegram Filter Bot, Support Unlimited Filter. Also, The Bot can auto-filter telegram File | video

A Telegram Filter Bot, Support Unlimited Filter. Also, The Bot can auto-filter telegram File | video

Hash Minner 3 Nov 27, 2021