Skip to content

Instantly share code, notes, and snippets.

@scplay
Created March 19, 2017 16:20
Show Gist options
  • Save scplay/ec06ede4660e8d8904a14a6b8762d509 to your computer and use it in GitHub Desktop.
Save scplay/ec06ede4660e8d8904a14a6b8762d509 to your computer and use it in GitHub Desktop.
Google 语音果然不好搞啊
var Jp = "413871.1941337652"; // 这个到底是什么卵??
function getToken(a) {
var b;
if (null !== Jp)
b = Jp;
else {
b = Hp(String.fromCharCode(84));
var c = Hp(String.fromCharCode(75));
b = [b(), b()];
b[1] = c();
b = (Jp = window[b.join(c())] || "") || "";
}
var d = Hp(String.fromCharCode(116))
, c = Hp(String.fromCharCode(107))
, d = [d(), d()];
d[1] = c();
c = "&" + d.join("") + "=";
d = b.split(".");
b = Number(d[0]) || 0;
for (var e = [], f = 0, g = 0; g < a.length; g++) {
var l = a.charCodeAt(g);
128 > l ? e[f++] = l : (2048 > l ? e[f++] = l >> 6 | 192 : (55296 == (l & 64512) && g + 1 < a.length && 56320 == (a.charCodeAt(g + 1) & 64512) ? (l = 65536 + ((l & 1023) << 10) + (a.charCodeAt(++g) & 1023),
e[f++] = l >> 18 | 240,
e[f++] = l >> 12 & 63 | 128) : e[f++] = l >> 12 | 224,
e[f++] = l >> 6 & 63 | 128),
e[f++] = l & 63 | 128)
}
a = b;
for (f = 0; f < e.length; f++)
a += e[f],
a = Ip(a, "+-a^+6");
a = Ip(a, "+-3^+b+-f");
a ^= Number(d[1]) || 0;
0 > a && (a = (a & 2147483647) + 2147483648);
a %= 1E6;
return c + (a.toString() + "." + (a ^ b))
};
function Hp(a) {
return function() {
return a
}
}
function Ip(a, b) {
for (var c = 0; c < b.length - 2; c += 3) {
var d = b.charAt(c + 2)
, d = "a" <= d ? d.charCodeAt(0) - 87 : Number(d)
, d = "+" == b.charAt(c + 1) ? a >>> d : a << d;
a = "+" == b.charAt(c) ? a + d & 4294967295 : a ^ d
}
return a
}
function googleTranslateUrl(string , speed ){
var token = getToken(string);
var encode_str = encodeURI(string);
var speed = speed || 1;
return "https://translate.google.com/translate_tts?ie=UTF-8&q=" + encode_str + "&tl=zh-CN&total=1&idx=0&textlen=7&tk=" + token + "&client=t&prev=nput&ttsspeed=" + speed;
}
window.location = googleTranslateUrl("这个简直吊爆炸了");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment