Etsy - Remove Promoted Ads

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

< 脚本Etsy - Remove Promoted Ads的反馈

评价:一般 - 脚本能用,但还有一些问题

§
发表于:2020-02-04

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
§
发表于:2020-03-16
编辑于:2020-03-16

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);
    });
}
§
发表于:2020-04-08

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

§
发表于:2020-07-29

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

§
发表于:2020-09-26

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

§
发表于:2022-03-18

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);
            }
        }
    });
}
§
发表于:2022-03-18

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

§
发表于:2023-08-01

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?

发表回复

登录以发表回复。