Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

google api needs to use POST for long requests #44

Closed
mote0230 opened this issue Sep 13, 2015 · 3 comments
Closed

google api needs to use POST for long requests #44

mote0230 opened this issue Sep 13, 2015 · 3 comments
Assignees

Comments

@mote0230
Copy link
Collaborator

Otherwise it returns error 400
Cutoff seems to be around 1359 characters

@mote0230 mote0230 self-assigned this Sep 13, 2015
@mote0230
Copy link
Collaborator Author

fixed 2ceeece
the code might use some styling

@mote0230
Copy link
Collaborator Author

Still some issue with non-western scripts

@mote0230 mote0230 reopened this Sep 13, 2015
@mote0230 mote0230 closed this as completed Oct 5, 2015
@mote0230
Copy link
Collaborator Author

mote0230 commented Oct 5, 2015

Relevant code in chrome's official translate extension:

function(a, b, c, d) {
        if ("" != a) {
            window.selection = a;
            a = new Wf("gtx", "https://translate.googleapis.com");
            var e = chrome.i18n.getUILanguage ? chrome.i18n.getUILanguage() : "en";
            d = null != d ? d : "auto";
            var f = Ag();
            c = new M("source=" + c);
            var g = window.selection,
                k = a.a + "/translate_a/single",
                l = new M,
                v = new M;
            window.EGGS_JANGO && ("qab" == d && (l.set("slo", "qab"), d = "en"), "qab" == f && (l.set("tlo", "qab"), f = "en"));
            l.set("client", a.c);
            l.set("sl", d);
            l.set("tl", f);
            l.set("hl", e);
            Mc(l, "dt", ["t", "bd"]);
            l.set("dj", "1");
            c && l.g(c);
            v.set("q",
                g);
            Yf(a, k, l, v, t(a.f, a, b))
        }

  Yf = function(a, b, c, d, e) {
            c = c.toString();
            c += "&tk=" + Xf();
            d = d.toString();
            var f = "POST";
            b += "?" + c;
            2E3 > c.length + d.length && (f = "GET", b += "&" + d, d = "");
// ...
}

@mote0230 mote0230 reopened this Oct 5, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant