update tkk regularly

This commit is contained in:
Akash Mozumdar 2018-11-08 05:51:20 -05:00
parent ddc8313d37
commit 22bb1420c1

View File

@ -99,7 +99,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
std::wstring GetTranslationUri(std::wstring text, unsigned TKK) std::wstring GetTranslationUri(std::wstring text, unsigned TKK)
{ {
// If no TKK available, use this uri. Can't use too much or google will detect unauthorized access. // If no TKK available, use this uri. Can't use too much or google will detect unauthorized access
if (!TKK) return L"/translate_a/single?client=gtx&dt=ld&dt=rm&dt=t&tl=" + translateTo + L"&q=" + text; if (!TKK) return L"/translate_a/single?client=gtx&dt=ld&dt=rm&dt=t&tl=" + translateTo + L"&q=" + text;
// Artikash 8/19/2018: reverse engineered from translate.google.com // Artikash 8/19/2018: reverse engineered from translate.google.com
@ -155,7 +155,6 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
std::wstring translation; std::wstring translation;
if (internet) if (internet)
{ {
if (!TKK)
if (HINTERNET connection = WinHttpConnect(internet, L"translate.google.com", INTERNET_DEFAULT_HTTPS_PORT, 0)) if (HINTERNET connection = WinHttpConnect(internet, L"translate.google.com", INTERNET_DEFAULT_HTTPS_PORT, 0))
{ {
if (HINTERNET request = WinHttpOpenRequest(connection, L"GET", L"/", NULL, NULL, NULL, WINHTTP_FLAG_SECURE)) if (HINTERNET request = WinHttpOpenRequest(connection, L"GET", L"/", NULL, NULL, NULL, WINHTTP_FLAG_SECURE))