0

I am not good with these programming terminologies as i am still new. But i have this code:

 private void _btnSpeak_Click(object sender, RoutedEventArgs e)
    {
        if (!string.IsNullOrEmpty(this._translationSpeakUrl))
        {
            new WebBrowser().Navigate(this._translationSpeakUrl);
        }
    }

_translationspeakurl is the link to google's listen function "https://translate.googleapis.com/translate_tts?ie=UTF-8&q={0}&tl={1}&total=1&idx=0&textlen={2}&client=gtx"

I do not want the prompt window asking Open/Save when the button is pressed but instead auto save it in a folder as an mp3.

Codes taken from : "https://www.codeproject.com/Articles/12711/Google-Translator"

1 Answers1

0

You can use WebClient and use .DownloadFile(), or you can use HttpClient....or you can use URLMon based APIs (which can "use" any session that been established by your WebBrowser)

Here are the differences between the two.

WebClient:

HttpClient:

URLMon style:

If you have issues downloading via that HTTPS url, then you may need to select the TLS/SSL protocol to be used/preferred.

Community
  • 1
  • 1
Colin Smith
  • 12,375
  • 4
  • 39
  • 47