static void makeSpeechCereproc(S text, S voice, File destMp3) ctex { S format = "mp3"; S post = "<speakExtended key='p86ffzyal3tvgqfr'><voice>" + htmlencode(voice) + "</voice><text>" + /*htmlencode*/(text) + "</text><audioFormat>" + format + "</audioFormat>\n" + "</speakExtended>"; S url = "https://www.cereproc.com/livedemo.php"; URL _url = new URL(url); URLConnection conn = _url.openConnection(); conn.setRequestProperty("Content-Type", "text/plain;charset=UTF-8"); conn.setRequestProperty("Accept", "*/*"); conn.setRequestProperty("Accept-Encoding", "gzip, deflate"); conn.setRequestProperty("Accept-Language", "en-US,en;q=0.8,de;q=0.6"); conn.setRequestProperty("Cookie", "has_js=1; Drupal.visitor.liveDemo=p86ffzyal3tvgqfr; _ga=GA1.2.1406621623.1444122980; _gat=1"); conn.setRequestProperty("Origin", "https://www.cereproc.com"); conn.setRequestProperty("Referer", "https://www.cereproc.com/"); conn.setRequestProperty("User-Agent", "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/44.0.2403.89 Chrome/44.0.2403.89 Safari/537.36"); conn.setDoOutput(true); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); writer.write(post); writer.flush(); S encoding = conn.getContentEncoding(); //print("Encoding: " + encoding); S contentType = conn.getContentType(); //print("Content type: " + contentType); byte[] response = loadBinaryPage(conn); //print("Bytes read: " + response.length); if ("gzip".equals(encoding)) response = gunzipBinaryData(response); //print("Bytes unpacked: " + response.length); S s = new String(response, "UTF-8"); //print(s); S oggUrl = null; L<S> tok = htmlcoarsetok(s); for (int i = 1; i < tok.size(); i += 2) if (isTag(tok.get(i), "url")) { oggUrl = tok.get(i+1); break; } if (oggUrl == null) fail("No sound URL found"); byte[] ogg = loadBinaryPage(oggUrl); saveBinaryFile(destMp3, ogg); //print("Saved: " + destMp3.getAbsolutePath() + " (" + ogg.length + " bytes)"); }
Began life as a copy of #1001268
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001273 |
Snippet name: | makeSpeechCereproc |
Eternal ID of this version: | #1001273/1 |
Text MD5: | 0d88b012c21cd64ac7b500316346c6cc |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-29 02:15:44 |
Source code size: | 2240 bytes / 54 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 649 / 920 |
Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1002670 - getSoundURLCereproc #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |