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

GoogleDWIMages breaks #17

Closed
re11ding opened this issue Apr 27, 2021 · 8 comments
Closed

GoogleDWIMages breaks #17

re11ding opened this issue Apr 27, 2021 · 8 comments
Labels

Comments

@re11ding
Copy link

Heyo! So, sorry to bother, but I was doing some image searching yesterday with this script installed. Something appears to have changed on google's end as I'm getting this wonderful error in console:

Can't find image URL for result (20): TypeError: METADATA[index][1] is null
    nthImageUrl moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:119
    onResult moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:192
    J moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:9
    each moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:9
    init moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:172
    tms_ff3a70de_bd41_4e61_9185_9042d0b6be57 moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:209
    s eval:4
    <anonymous> moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:1
    <anonymous> moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:1
    <anonymous> moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:214
    <anonymous> moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:216
    s eval:4
    t eval:3
    E_u eval:4
    create eval line 2 > Function:74
    create eval line 2 > Function:76
    c eval line 2 > Function:15
    s eval:4
    i eval line 2 > Function:13
    s eval line 2 > Function:13
    v eval:13
    v eval:13
    s eval:4
    t eval:12
    s eval:4
    h eval:12
    h eval:12
    send eval:13
    s eval line 2 > Function:13
    setTimeout eval line 2 > Function:14
    run eval line 2 > Function:16
    runListeners eval line 2 > Function:15
    anonymous eval line 2 > Function:77
    v eval:13
Google DWIMages.user.js:194:17
    onResult moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:194
    J moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:9
    each moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:9
    init moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:172
    tms_ff3a70de_bd41_4e61_9185_9042d0b6be57 moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:209
    s eval:4
    <anonymous> moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:1
    <anonymous> moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:1
    <anonymous> moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:214
    <anonymous> moz-extension://c65a532d-920f-4167-a118-2a2391811c90/userscripts/Google DWIMages.user.js?id=ff3a70de-bd41-4e61-9185-9042d0b6be57:216
    s eval:4
    t eval:3
    E_u eval:4
    create eval line 2 > Function:74
    create eval line 2 > Function:76
    c eval line 2 > Function:15
    s eval:4
    i eval line 2 > Function:13
    s eval line 2 > Function:13
    v eval:13
    v eval:13
    (Async: Async)
    s eval:4
    t eval:12
    s eval:4
    h eval:12
    h eval:12
    send eval:13
    s eval line 2 > Function:13
    setTimeout eval line 2 > Function:14
    run eval line 2 > Function:16
    runListeners eval line 2 > Function:15
    anonymous eval line 2 > Function:77
    v eval:13

Hopefully this isn't a matter of google slowly pushing out the update and it's applied to everyone, but essentially due to this error, what happens is that the images it couldn't process are not added to the list. So, the corresponding direct links to images steps back. Meaning after the first failure, the link to the image is for the previous image behind it. This worsens with every error it encounters. You can see it yourself by searching "Lawn Mower" and clicking the one with the granny pushing the mower. That one will be an image that failed to link and everything after links to the wrong image.

@chocolateboy
Copy link
Owner

chocolateboy commented May 2, 2021

I can't reproduce this (yes, it's possible they're A/B testing or still rolling this out). In order to investigate, I'll need more details (this applies to any issue report), e.g.:

  • Operating System
  • Browser name/version
  • Userscript engine name/version
  • Userscript version
  • Relevant custom browser/engine/script settings
  • Other relevant addons/userscripts?
  • Logged in or not logged in?
  • Any errors in the web/browser console? ✔

My guess is that it's a conflict with another addon (e.g.), so I'd rule that out first.

@re11ding
Copy link
Author

re11ding commented May 2, 2021

Am not sure what you mean by platform, so I am going to assume Google?
Firefox Browser version 88.0
Tampermonkey 4.13.6136
Google DWIMages 2.3.2
I will need a description of what you mean by custom settings. I did not know the script was configurable.
I have disabled all other scripts and addons not just related to google but to everything except DWIMages and Tampermonkey. Still gives the error.
Happens both when logged in or not logged in.

So based on this, we know it's not a conflict with another script and/or add-on.
It's funny you mention that script specifically though. I am trying to aid the writer of that to fix the new A/B testing that they're applying. I made a very "hacky" means of fixing it before finding out about your addon that does the same thing and works regardless if on the A/B side. I would have actually tried fixing this script too, but yours is a lot more complex and I definitely can't wrap my head around it.

EDIT: Would you like a copy of the HTML, in case it is A/B testing that's affecting both my logged in and incognito mode?

@chocolateboy
Copy link
Owner

Am not sure what you mean by platform, so I am going to assume Google?

I've changed it to Operating System.

I will need a description of what you mean by custom settings.

Any relevant settings in Firefox, Tampermonkey, or the script.

Would you like a copy of the HTML?

Sure, you can email it to me at the address in my profile. Just incognito, though. Please don't send me anything which could expose your account details.

@re11ding
Copy link
Author

re11ding commented May 2, 2021

Ah okay. Windows 10 Education Edition version 1709 (incapable of updating further due to functionality issues.)
All Tampermonkey settings are default (Injection mode was originally on instant due to that hacky script I made since it needed it to work, but that's since been reverted to the default before I reported results from earlier.) Script is completely unmodified. It would take far too long to list settings changes on Firefox, so to make it easier, I created a new profile where all settings are default and unchanged, installed the add-on, installed the script, and same issue exists. So it's not a Firefox settings conflict.

I would just list all the Firefox setting changes I made, but there's quite a bit about:configs that are different and it would be very difficult to list them all.

I will email you the incognito HTML in a bit then. I will have everything disabled in order for you to apply the script and see what's wrong.

EDIT: The file has been sent.

@chocolateboy
Copy link
Owner

Thanks, got it.

Try this.

@re11ding
Copy link
Author

re11ding commented May 3, 2021

Hey nice work! Looks like it's working fine! If I may ask, what changed in the A/B testing to break the script so... selectively? I am still a programmer, just not familiar with javascript. Would love to expand my knowledge a bit, hence why I'm asking.

@chocolateboy
Copy link
Owner

chocolateboy commented May 3, 2021

The metadata appears to have switched from (simplified):

Mine

[
    { type: "image", index: 0, url: "https://example.com/1.jpg" },
    { type: "relatedSearches", links: [...] }, // no index, but consumes 1
    { type: "image", index: 2, url: "https://example.com/2.jpg" },
]

to:

Yours

[
    { type: "image", index: 0, url: "https://example.com/1.jpg" },
    { type: "advert", data: [...] }, // no index, and doesn't consume 1
    { type: "image", index: 1, url: "https://example.com/2.jpg" },
]

- which means an array can no longer be used to look up the metadata for an image based on its index. I switched to a Map keyed on the index property since the result indices may (now) be distinct from the array indices. This is cleaner and probably a bit faster than cloning/duplicating the structure of the original array, so it's an improvement even if they don't roll out this change.

As for why your metadata/results are different than mine: I'm not sure. It looks like there are some advertising-related nodes in your metadata that aren't in mine. I can't tell from the HTML and it might not be visible if you're using an ad-blocker. New advertising widgets, and possibly distinguishing the metadata that populates them from the metadata for real results, seems like the sort of thing an advertising company might experiment with, particularly when searching for something like "lawn mower".

@re11ding
Copy link
Author

re11ding commented May 3, 2021

That's curious. I gave you the complete HTML with all addons and userscripts disabled, so I am unsure as to why this is the case. I wanted the raw to be as clean as possible. If there was some way to make it cleaner, I'm all ears on that one so we may better find the root of the cause.

Curiously, uBlock does block the elements on both local and online, so if you're using an adblocker yourself, this may be why you don't see it. I mention this specifically as I can see the ads myself on my copy of the local but only with uBlock disabled.

None the less, I appreciate you heavily for fixing it! Thanks for keeping this up to date!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants