uBlockOrigin / uAssets

Resources for uBlock Origin, uMatrix: static filter lists, ready-to-use rulesets, etc.
GNU General Public License v3.0
4.24k stars 778 forks source link

ebay.com: ads #23491

Open sha-265 opened 7 months ago

sha-265 commented 7 months ago

Prerequisites

URL address of the web page

https://www.ebay.com/sch/i.html

Category

ads

Description

Some sponsored listings are appears in search results in eBay

Other extensions used

CanvasBlocker

Screenshot(s)

Screenshot(s) ![image](https://github.com/uBlockOrigin/uAssets/assets/4103710/fdf3de9f-0493-4084-a11f-271699c96968)

Configuration

```yaml uBlock Origin: 1.57.2 Firefox: 125 filterset (summary): network: 145565 cosmetic: 47666 scriptlet: 19277 html: 1793 listset (total-discarded, last-updated): removed: plowe-0: null added: adguard-spyware-url: 1504-120, now block-lan: 66-0, now fanboy-thirdparty_social: 68-0, now dpollock-0: 11669-369, now ISR-0: 1866-3, now default: user-filters: 5-0, never ublock-filters: 37821-109, now ublock-badware: 8450-0, now ublock-privacy: 875-2, now ublock-unbreak: 2321-2, now ublock-quick-fixes: 183-18, now easylist: 86849-174, now easyprivacy: 50825-64, now urlhaus-1: 12750-0, now filterset (user): [array of 6 redacted] trustedset: added: [array of 1 redacted] hostRuleset: added: [array of 3 redacted] userSettings: advancedUserEnabled: true cloudStorageEnabled: true cnameUncloakEnabled: false hiddenSettings: [none] supportStats: allReadyAfter: 4510 ms (selfie) maxAssetCacheWait: 229 ms cacheBackend: indexedDB popupPanel: blocked: 9 network: ebay.com: 4 ebaystatic.com: 5 extended: ##div[title="ADVERTISEMENT"] ```
stephenhawk8054 commented 7 months ago

They are using content inside ::before so I don't think this can be solved.

sha-265 commented 7 months ago

They are using content inside ::before so I don't think this can be solved.

@stephenhawk8054 can't we use has() element <span data-w="Sponsored">, or something like that?

stephenhawk8054 commented 7 months ago

Every item has <span data-w="Sponsored">, it's just some show the text, and some hide the text

gwarser commented 7 months ago
span[data-w]:matches-css-before(content: /attr/)
stephenhawk8054 commented 7 months ago

Oh, didn't know there's :matches-css-before, but looks like I'm mistaken, it might not be related to content

sha-265 commented 7 months ago

so is it solvable or not?

stephenhawk8054 commented 7 months ago

Others may find some ways, but currently I don't know how to address it.

It uses 2 transform: rotate steps to rotate the "sponsored" text. The sponsored items will be rotated back to normal position and we can see the "sponsored" text, others will be rotated out of view and we cannot see that text.

u-RraaLL commented 7 months ago

From what I can tell, the rotation and attribute values are generated randomly, server-side on each page load (blocking all scripts, changes nothing).

The attribute value is mentioned in another element though, so we'd need a procedural that can check the value of the ID in one element against the value of another attribute in listing items.

gwarser commented 7 months ago

check the value of the ID in one element against the value of another attribute in listing items.

Should be possible with XPath.

u-RraaLL commented 7 months ago

I was wondering about that. But it's not within my skillset to attempt this.

##[aria-hidden="true"]>span.clipped[id]:not(:has(+[aria-labelledby]))
##.s-item [aria-labelledby]
Yuki2718 commented 7 months ago

Are we talking about Sponsored in the screenshot? I don't see sponsored at all, maybe geolocation. When I visit https://www.ebay.com/sch/i.html I'm redirected to https://www.ebay.com/n/all-categories which looks very different.

mapx- commented 7 months ago

see for example https://www.ebay.com/b/32-Degrees/bn_7064048796

image

Yuki2718 commented 7 months ago

@u-RraaLL

The attribute value is mentioned in another element though, so we'd need a procedural that can check the value of the ID in one element against the value of another attribute in listing items.

What exactly?

Yuki2718 commented 7 months ago

It seems Sponsored items have longer links like FB. Or just ##.s-item__wrapper:has(a[href*="&amdata="])?

u-RraaLL commented 7 months ago

What exactly?

I've mentioned them above. The value of id in body>[aria-hidden="true"]>span.clipped[id]:not(:has(+[aria-labelledby])) is the same as sponsored's .s-item [aria-labelledby].

It seems Sponsored items have longer links like FB. Or just ##.s-item__wrapper:has(a[href*="&amdata="])?

Oh, it is? Guess we can check that.

That selector doesn't work for me though - it only finds one thing which is not part of the results?

https://imgur.com/RcLh4bB.png and https://imgur.com/TAZs58j.png

Yuki2718 commented 6 months ago

Maybe geolocation, it's working for me and I'll add to EL unless it causes FP on your side. Whoops, the rule leaves leftover. So ##.s-item:has(a[href*="&amdata="])

sha-265 commented 6 months ago

Maybe geolocation, it's working for me and I'll add to EL unless it causes FP on your side. Whoops, the rule leaves leftover. So ##.s-item:has(a[href*="&amdata="])

@Yuki2718, this filter is not working for me, sponsored items still shown

Yuki2718 commented 6 months ago

I know, but I first have to reproduce the ads you guys see. Which country do you access from?

mapx- commented 6 months ago

on my example page your filter is working fine (FR, US, DE, etc)

u-RraaLL commented 6 months ago

You're right. The filter works fine when browsing by category. It just doesn't affect search results

https://www.ebay.com/sch/i.html?_from=R40&_nkw=ps5&_sacat=0
sha-265 commented 6 months ago

I know, but I first have to reproduce the ads you guys see. Which country do you access from?

@Yuki2718, Israel

You're right. The filter works fine when browsing by category. It just doesn't affect search results

https://www.ebay.com/sch/i.html?_from=R40&_nkw=ps5&_sacat=0

@u-RraaLL, not for me. This is a screen shot from the page you linked to: image

u-RraaLL commented 6 months ago

I was replying to mapx, who was referring to his URL which is "browse by a category".

I said the filter doesn't work on search results and provided an example for that. So you're just confirming what I said :)

Yuki2718 commented 6 months ago

Test

ebay.com##:xpath(//li[contains(@class, "s-item ")]//span[@aria-labelledby=ancestor::body//span[@class="clipped" and @id and not(following-sibling::span[1 and @aria-labelledby])]/@id]/ancestor::li[contains(@class, "s-item ")])

Looks doesn't work, maybe needs :watch-attr()

sha-265 commented 6 months ago

When creating the filter, it is working, but after page refresh the sponsored items are shown again

Yuki2718 commented 6 months ago

The rule works with AdGuard but with noticeble delay to display the page. So I suspect it's a matter of :watch-attr(). But even

ebay.com##*:watch-attr(aria-labelledby,class,id):xpath(//li[contains(@class, "s-item ")]//span[@aria-labelledby=ancestor::body//span[@class="clipped" and @id and not(following-sibling::span[1 and @aria-labelledby])]/@id]/ancestor::li[contains(@class, "s-item ")])

doesn't work. Any idea? And somehow if I add :remove(), it removes all the content. Bug?

Yuki2718 commented 6 months ago

Maybe :watch-attr()doesn't watch attributes specified in :xpath()? @gorhill

STR

  1. Visit https://www.ebay.com/sch/i.html?_from=R40&_nkw=ps5&_sacat=0
  2. Check ##body:xpath(//li[contains(@class, "s-item ")]//span[@aria-labelledby=ancestor::body//span[@class="clipped" and @id and not(following-sibling::span[1 and @aria-labelledby])]/@id]/ancestor::li[contains(@class, "s-item ")]) hides sponsored items with the picker
  3. Create the rule
  4. Refresh the page and see sponsored items are not hidden
  5. Same with ebay.com##body:watch-attr(aria-labelledby,class,id):xpath(//li[contains(@class, "s-item ")]//span[@aria-labelledby=ancestor::body//span[@class="clipped" and @id and not(following-sibling::span[1 and @aria-labelledby])]/@id]/ancestor::li[contains(@class, "s-item ")])
  6. Somehow ebay.com##body:xpath(//li[contains(@class, "s-item ")]//span[@aria-labelledby=ancestor::body//span[@class="clipped" and @id and not(following-sibling::span[1 and @aria-labelledby])]/@id]/ancestor::li[contains(@class, "s-item ")]):remove() removes everything

But ebay.com##body:xpath(//li[contains(@class, "s-item ")]//span[@aria-labelledby=ancestor::body//span[@class="clipped" and @id and not(following-sibling::span[1 and @aria-labelledby])]/@id]/ancestor::li[contains(@class, "s-item ")]) works with AdGuard, though with noticebly slower loading.

gwarser commented 6 months ago

Do not use wildcard, this executes xpath on every element (freezes my browser). Start with body or html.


No idea why it works fine in picker, but does not from my filters.

Yuki2718 commented 6 months ago

Should body be added to all existing ##:xpath rules?

u-RraaLL commented 6 months ago

No idea why it works fine in picker, but does not from my filters.

Maybe xpath executes too early?

body>[aria-hidden="true"]>span.clipped[id]:not(:has(+[aria-labelledby]))

This selector works only after the page finished loading. Earlier there's another element there too. It corresponds to the "dummy sponsored" and gets deleted by an inline script.

sha-265 commented 6 months ago

any updates?

JobcenterTycoon commented 6 months ago

Userscript which hide the ads in the search results:

ebay.com##+js(rpnt, script, removeItem("SRP.PLBTimestamp");o(true)}}}\,3e3)})}})(), removeItem("SRP.PLBTimestamp");o(true)}}}\,3e3)})}})(); !function(){let e=document.querySelectorAll(".srp-results > .s-item");for(let t=0;t<e.length;t++){let r=e[t].querySelector('span[aria-hidden="true"][data-w="Sponsored"]')\,l=(r=window.getComputedStyle(r).getPropertyValue("transform")).split("(")[1].split(")")[0].split("\,")\,o=l[0]\,a=l[1];l[2]\,l[3];let s=Math.round(Math.atan2(a\,o)*(180/Math.PI))\,n=e[t].querySelector('span[aria-hidden="true"][data-w="Sponsored"]')\,p=(n=window.getComputedStyle(n\,"::before").getPropertyValue("transform")).split("(")[1].split(")")[0].split("\,")\,d=p[0]\,u=p[1];p[2]\,p[3];let i=Math.round(Math.atan2(u\,d)*(180/Math.PI));s+i>=-1&&s+i<=1&&(e[t].style.display="none")}}();)
Yuki2718 commented 6 months ago

So this can be fixed with rpnt. I still wonder why the xpath filter doesn't work with uBO. BTW [data-w="Sponsored"] is for English interface. I guess [data-w] is unique enough?

JobcenterTycoon commented 6 months ago

So

ebay.*##+js(rpnt, script, removeItem("SRP.PLBTimestamp");o(true)}}}\,3e3)})}})(), removeItem("SRP.PLBTimestamp");o(true)}}}\,3e3)})}})(); !function(){let e=document.querySelectorAll(".srp-results > .s-item");for(let t=0;t<e.length;t++){let r=e[t].querySelector('span[aria-hidden="true"][data-w]')\,l=(r=window.getComputedStyle(r).getPropertyValue("transform")).split("(")[1].split(")")[0].split("\,")\,o=l[0]\,a=l[1];l[2]\,l[3];let s=Math.round(Math.atan2(a\,o)*(180/Math.PI))\,n=e[t].querySelector('span[aria-hidden="true"][data-w]')\,p=(n=window.getComputedStyle(n\,"::before").getPropertyValue("transform")).split("(")[1].split(")")[0].split("\,")\,d=p[0]\,u=p[1];p[2]\,p[3];let i=Math.round(Math.atan2(u\,d)*(180/Math.PI));s+i>=-1&&s+i<=1&&(e[t].style.display="none")}}();)

to cover also regional sites like ebay.de . Saw no breakage so far (checked without account). For the xpath issue i don’t know i never work with xpath.

loadstring1 commented 5 months ago

@JobcenterTycoon you forgot to close this issue

sha-265 commented 1 month ago

I don't know why you closed this issue. Ads are still shown on eBay.

stephenhawk8054 commented 1 month ago

There were no feedbacks at that time (5 months ago), so it's normal to close. If you see the ads, just continue here, no need for asking why closing the issue.

sha-265 commented 1 month ago

I will ask why this issue is closed, because I can't reopen it my self.

The problem never solved. No one asked for feedback.

stephenhawk8054 commented 1 month ago

No one was able to reproduce the issue after the filters were added, hence it's closed. If no one continued commenting, we of course couldn't know the issue's state.

Anyways, if any volunteers are able to reproduce, they will re-open.

Yuki2718 commented 1 month ago

Though I can reproduce on https://www.ebay.com/sch/i.html?_from=R40&_nkw=ps5&_sacat=0, it's almost "Can't fix" when they even counter JS fixes.

Yuki2718 commented 1 month ago

I keep this opened since it might be worth @gorhill 's investigation why ebay.com##body:xpath(//li[contains(@class, "s-item ")]//span[@aria-labelledby=ancestor::body//span[@class="clipped" and @id and not(following-sibling::span[1 and @aria-labelledby])]/@id]/ancestor::li[contains(@class, "s-item ")]) doesn't work even with :watch-attr() as I said in https://github.com/uBlockOrigin/uAssets/issues/23491#issuecomment-2104309049 The rule works on AG MV2 extension. It might possibly be that performance-hit reached the limit, but I'm not sure.

sha-265 commented 1 month ago

No one was able to reproduce the issue after the filters were added, hence it's closed. If no one continued commenting, we of course couldn't know the issue's state.

No one said he is unable to reproduce, because no one asked to try it. I can't even find this filter in my uBO.

gorhill commented 1 month ago

It might possibly be that performance-hit reached the limit,

Yes, that filter is too CPU expensive to enforce:

image

Execution time well over a second per DOM mutation processing cycle, so uBO disables it.


When I use this filter in AdGuard MV3, it does work, but page load takes very long, and profiler shows that over 20 seconds was spend in AdGuard's content script's code at page load time, and more specifically the browser's own document.evaluate(xpath) code.

stephenhawk8054 commented 1 month ago

No one was able to reproduce the issue after the filters were added, hence it's closed. If no one continued commenting, we of course couldn't know the issue's state.

No one said he is unable to reproduce, because no one asked to try it. I can't even find this filter in my uBO.

There were 2 comments for 2 filters above. Anyone who wants to test can read the above:

We are not customer service to ask each person for testing, everyone can read the comments.


Btw, this one looks working for me, but I'm not too sure:

ebay.com##+js(rpnt, script, (function(scope){, '(()=>{document.querySelectorAll("li.s-item").forEach((item=>{const divItem=item.querySelector("span[data-w] > div");const styles=window.getComputedStyle(divItem);let sums=0;for(const style of["padding-top","transform","margin-top"]){if(style==="transform"){const matrix=new WebKitCSSMatrix(styles.webkitTransform);sums+=matrix.m42}else{sums+=window.parseInt(styles[style].split("px")[0])}}if(sums===0){item.style.display="none"}}))})();(function(scope){')

I haven't tested with other TLDs (ebay.de) yet.

Yuki2718 commented 1 month ago

Btw, this one looks working for me, but I'm not too sure:

It works on my end, feel free to add. The thing is just that nobody seems to be willing to keep the cat-and-mouse game with them.

wertzuz commented 1 week ago

On some searches for example: https://www.ebay.de/sch/i.html?_nkw=handy there is a top-banner-ad shown only verified on ebay.de image

Yuki2718 commented 1 week ago

On some searches for example: https://www.ebay.de/sch/i.html?_nkw=handy there is a top-banner-ad shown only verified on ebay.de

Looks to be self-promotion though it says Anzeige.

keplx commented 3 hours ago

Execution time well over a second per DOM mutation processing cycle, so uBO disables it.

Can each determine on his own his tolerance for waiting (processing)? then adjusting some setting per domain or globally?