Google Translate API wrong 403 and 503

Tình hình là em có xài đoạn code như ri

BASE_URL="https://www.googleapis.com/language/translate/v2?key=[key]&q=hello%20world&source=en&target=de";
public static void main(String[] args) {
    say("Hallo Welt");
}
public static void say(String text) {
    try {
        File f = new File("translate_tts.mp3");
        String sentence = URLEncoder.encode(text,"UTF-8");
        String urlString = MessageFormat.format(BASE_URL, sentence,"en");
        BinaryResource res = new Resty().bytes(new URI(urlString));
        res.save(f);

        FileInputStream in = new FileInputStream(f);
        Audio audio = Audio.getInstance();
        audio.play(in);

        Player p = new Player(in);

        p.play();

        p.close();
        f.delete();

    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    } catch (JavaLayerException e) {
        e.printStackTrace();
    }
}

mà nó lại lỗi, huhu, có thánh nào rành java giúp em. em muốn xài để sử dụng text to speech

Hello Hưng :smile: A không biết làm nhưng vào chào chú một tiếng =))

https://translate.google.com/#[lang_from]/[lang_to]/[text_to_translate]

String url của bạn trả về cái này

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "keyInvalid",
    "message": "Bad Request"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

Mình nghĩ bạn nên tìm hiểu vì sao nó bị limit và keyinvalid

Mình có tìm hiểu nhưng nó nhận đc dưới 40 từ, trên 50 từ là nó bị lỗi 400 và không đọc từ từ text sang speech

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?