Etsy - Remove Promoted Ads

Remove the promoted ads that clutter the search results on Etsy.

< Feedback on Etsy - Remove Promoted Ads

Review: OK - script works, but has bugs

§
Posted: 04-02-2020

Uses outdated selector

Etsy has removed the ad selector to make this more difficult. The selector is now random. For now, it seems other listings don't have an absolute floating span, so I've changed the script to use "span.z-index-1" instead and it works as expected. A better selector could probably be used.

Kie
§
Posted: 16-03-2020
Edited: 16-03-2020

Ahhh this saved me, thank you! For those of you who don't know where to edit the script, just cut and paste this for the userscript:

window.onload = function() {
    var elements = document.querySelectorAll('span.z-index-1');
    Array.prototype.forEach.call(elements, function(el, i) {
        var item = el.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
        item.parentNode.removeChild(item);
    });
}
§
Posted: 08-04-2020

Thank you guys for the heads-up, and sorry I didn't check my GreasyFork sooner! The script has now been updated.

§
Posted: 29-07-2020

They appear to have changed the site again so this isn't working.

§
Posted: 26-09-2020

They have indeed.
Sorry it took me two months to notice. It is now fixed.

§
Posted: 18-03-2022

The site changed again, and the code doesn't work. Here's an updated version of the function that does.

Changes:

  • Updated the query selector class to use the one currently used on the site.
  • Added a check of the computed style to see if the element is actually displayed.
  • Added an additional parentNode to get rid of the "More like this" link.
window.onload = function() {
    var elements = document.querySelectorAll('.wt-screen-reader-only');
    Array.prototype.forEach.call(elements, function(el, i) {

        for(var count=0; count < promoted.length; count++) {
            var style = window.getComputedStyle(el), display=style.getPropertyValue('display');
            if(el.innerHTML.includes(promoted[count]) && display != 'none') {
                var item = el.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
                item.parentNode.removeChild(item);
            }
        }
    });
}
§
Posted: 18-03-2022

Thanks for the heads-up, I'm updating it right away!

§
Posted: 01-08-2023

If you have uBlock Origin, adding this line to your filters works for me (as of time of posting at least!),

etsy.com##ol > li:not(:has(p.wt-screen-reader-only[aria-hidden])):style(display:none !important)

Although all the listings contain the 'Ad from Etsy seller' text in the html, and they both have it repeated with the wt-screen-reader-only class, for the screen reader version, the ones that aren't actually ads also have aria-hidden="true" whereas the real ads don't (this makes sense from an accessibility perspective).

I'm not certain why I needed the :style(...) operator part (since that's what it should be doing by default), but perhaps there's a filter somewhere exempting etsy, and specifying :style(...) overcomes this?

Post reply

Sign in to post a reply.