Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TKK key setting after Google Translate changes #14

Merged
merged 1 commit into from Sep 21, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+3 −8
Diff settings

Always

Just for now

update TKK key setting after Google Translate changes

  • Loading branch information...
ncpierson committed Sep 21, 2018
commit b5d1b8561fc1a34fac1e66bb280cd153d1a31044
Copy path View file
@@ -18,15 +18,10 @@ module.exports = function (timeout) {
return res.text();
})
.then(function (html) {
var TKK = null;
var match = html.match("TKK='(\\d+.\\d+)';");

try {
eval(html.match(/TKK=eval\(\'\(.*\)\'\);/g)[0]); // TKK = '405291.1334555331'
if (TKK === null) throw null;
} catch (e) {
throw new Error('get key failed from google');
}
if (!match) throw new Error('get key failed from google');

return TKK;
return match[1];
});
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.