sS getSoundURLCereproc(S text, S voice) { ret getSoundURLCereproc_raw(htmlencode(text), voice); } static S getSoundURLCereproc_raw(S text, S voice) ctex { S format = "mp3"; S post = "<speakExtended key='2k4fhzwgr8eka9k9'><voice>" + htmlencode(voice) + "</voice><text>" + 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; _ga=GA1.2.1903717829.1455235694; Drupal.visitor.liveDemo=2k4fhzwgr8eka9k9"); 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()); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream(), "UTF-8"); 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"); ret oggUrl; }
Began life as a copy of #1001273 Huh. What is the relation of this to makeSpeechCereproc?
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002670 |
Snippet name: | getSoundURLCereproc |
Eternal ID of this version: | #1002670/2 |
Text MD5: | abff7090a3553626ca427b4c8ec241fe |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-08-25 20:51:32 |
Source code size: | 2150 bytes / 55 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 696 / 649 |
Version history: | 1 change(s) |
Referenced in: | #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) |