I was using the following code from a Chrome extension and it was working fine up until a few days ago, meaning Google must’ve introduced a change of some sort. I’ve been trying to fogure this out without success …
I have the following code, can be executed from a background script:
fetch("data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7")
.then(function(response) { return response.blob(); })
.then(function(blob) {
var form = new FormData();
form.append("encoded_image", blob, "blob");
form.append("sbisrc", navigator.userAgent);
fetch("https://www.google.com/searchbyimage/upload", { method: "POST", body: form })
.then(function(response) {
console.log(response.url); // opening the URL loads results
})
.catch(function(error) {});
})
.catch(function(error) {});
The following works fine (Google Images) however once the URL is changed
from:
“https://www.google.com/searchbyimage/upload”
to:
“https://lens.google.com/v3/upload”
We see that it fails and I’m trying to figure out what’s going on …
I might have to change the code and upload the images temporarily to let’s say imgur before sending to Google, but would prefer to get it working directly like it always did