convert translation output into a string
<p>The translated output text that I get using Google Translate API seems only to be made available in a browser and in html format.  How can I get output as a string that can be analyzed using Python, for example.  </p>

<h2>I would also like to understand how larger blocks of text can be translated in this way. Examples provided all seem to be short strings.</h2>

<p>I've experimented a bit more and share findings.   Following the usage guide that accompanies the API registration, common practice is to include the text to be translated in a URL provided for this purpose.  The place within the URL where the text is to be inserted is designated with the letter "q".  This is preceded by a place to specify parameters for source and target language as well as registered  API key.</p>

<p>The output from this appears in the browser (I've used Chrome) in the following format:</p>

<pre><code>200 OK

{
    "data": {
       "translations": [
        {
            "translatedText": "Hallo Welt"
        }
</code></pre>

<p>This example makes use of a single string as input that is inserted following the "q" referenced above.  The guide suggests that translating multiple strings is best accomplished by replicating the "q" entry method for each subsequent string.  </p>

<p>Entering text to be translated in this way is cumbersome, to say the least. Doing anything with the output (parsing, tokenizing, etc.) is also not very convenient or straightforward.   </p>

<p>Any advice on a more efficient and effective approach (perhaps one that does not require use of a browser and html would be appreciated.  </p>

<p>This is just the way the browser displays what the API has sent you, it's the browser's kind interpretation of it, not how it actually looks. It's json. You need to use the Python json module I expect, although I haven't attempted to use the API myself.</p>

python api text translate