Skip to content

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

@SuperSonicHub1

Description

@SuperSonicHub1

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
      }
    }
  ]
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions