uBlockOrigin / uAssets

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

instagram.com: ads #19731

Closed D4niloMR closed 1 year ago

D4niloMR commented 1 year ago

Prerequisites

URL address of the web page

https://www.instagram.com/

Category

ads

Description

Seeing ads on instagram, tested in Firefox and Opera GX with default lists

this rule from adguard work:

instagram.com#$?#main > div div[style*="flex-direction: column;"] > article > div:has(span:contains(/(Sponsored|Gesponsert|Sponsorlu|Sponsorowane|Ispoonsara godhameera|Geborg|Bersponsor|Ditaja|Disponsori|Giisponsoran|Sponzorováno|Sponsoreret|Publicidad|May Sponsor|Sponsorisée|Oipytyvôva|Ɗaukar Nayin|Sponzorirano|Uterwa inkunga|Sponsorizzato|Imedhaminiwa|Hirdetés|Misy Mpiantoka|Gesponsord|Sponset|Patrocinado|Patrocinado|Sponsorizat|Sponzorované|Sponsoroitu|Sponsrat|Được tài trợ|Χορηγούμενη|Спонсорирано|Спонзорирано|Ивээн тэтгэсэн|Реклама|Спонзорисано|במימון|سپانسرڈ|دارای پشتیبانی مالی|ስፖንሰር የተደረገ|प्रायोजित|ተደረገ|प|प्रायोजित|স্পনসর্ড|ਪ੍ਰਯੋਜਿਤ|પ્રાયોજિત|ପ୍ରାୟୋଜିତ|செய்யப்பட்ட செய்யப்பட்ட|చేయబడినది చేయబడినది|ಪ್ರಾಯೋಜಿಸಲಾಗಿದೆ|ചെയ്‌തത് ചെയ്‌തത്|ලද ලද ලද|สนับสนุน สนับสนุน รับ สนับสนุน สนับสนุน|ကငြာ ကငြာ|ឧបត្ថម្ភ ឧបត្ថម្ភ ឧបត្ថម្ភ|광고|贊助|内容 内容|贊助|告 告|広告|സ്‌പോൺസർ ചെയ്‌തത്)/)) { height: 1px !important; visibility: hidden !important; }

but it also remove any post that contains the word in the description

DOM; https://appp.me/DjXGKx

Other extensions used

cookie editor

Screenshot(s)

Screenshot(s) ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/4d27e75c-c0a6-44e6-aeea-41adbbba1626) ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/f047ff88-7123-465b-abbc-286665da0d87) ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/bde4693e-835b-4f0a-a2dc-1be253bbb2d1) ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/8f8e651f-9afc-4072-817e-56d8e738fce7)

Configuration

```yaml uBlock Origin: 1.52.0 Chromium: 115 filterset (summary): network: 218743 cosmetic: 191519 scriptlet: 30290 html: 0 listset (total-discarded, last-updated): added: https://github.com/AdroitAdorKhan/antipopads-re/raw/master/formats/filter.txt: 91730-0, 36m https://gitlab.com/magnolia1234/bypass-paywalls-clean-filters/-/raw/main/bpc-paywall-filter.txt: 929-0, 36m https://raw.githubusercontent.com/DandelionSprout/adfilt/master/LegitimateURLShortener.txt: 2262-0, 36m adguard-cookies: 27551-30, 36m adguard-mobile-app-banners: 4614-8, 36m adguard-other-annoyances: 13510-7, 36m adguard-popup-overlays: 24022-78, 36m adguard-social: 21400-907, 36m adguard-spyware: 56669-340, 36m adguard-spyware-url: 1208-144, 36m adguard-widgets: 2304-6, 36m easylist-annoyances: 3970-217, 36m [8 lists not shown]: [too many] default: user-filters: 104-0, never easylist: 70710-25821, 36m easyprivacy: 33257-16734, 36m plowe-0: 3723-1198, 36m spa-1: 5594-72, 36m ublock-badware: 7986-173, 36m ublock-filters: 34687-635, 36m ublock-privacy: 557-150, 35m ublock-quick-fixes: 282-201, 35m ublock-unbreak: 2128-88, 35m urlhaus-1: 5743-0, 35m filterset (user): [array of 60 redacted] switchRuleset: added: [array of 1 redacted] userSettings: advancedUserEnabled: true suspendUntilListsAreLoaded: true hiddenSettings: userResourcesLocation: [redacted] supportStats: allReadyAfter: 3253 ms (selfie) maxAssetCacheWait: 453 ms popupPanel: blocked: 372 network: instagram.com: 369 facebook.com: 3 extended: ###fb-root:not(body):not(html) ##._aagw:empty ##body:style(overflow: visible!important;) ##div[class]:has(> div[class]:first-child > a[href="/explore/peo… ##[class]:style(-webkit-touch-callout: default !important; -webk… ##+js(set-session-storage-item, loggedOutAppSheetIsMinimized, 1) ##+js(set-constant, _sharedData.is_whitelisted_crawl_bot, true) ##+js(trusted-set-cookie, ig_did, 0C826C21-17C3-444A-ABB7-EBABD3… ##+js(remove-class, _31e, body > ._li) ##+js(addEventListener-defuser, scroll, showPopup) ##+js(trusted-set-cookie, datr, __GMZCgwVF5BbyvAtfJojQwg, 1year,… ```
mapx- commented 1 year ago

I get no ads on instagram (maybe because I use it only for test) If you have any idea how to avoid removing legit posts just comment here, otherwise I can add AG filter

designspg commented 1 year ago

I am also seeing ads on Firefox.

D4niloMR commented 1 year ago

I get no ads on instagram

Try: https://www.instagram.com/?variant=past_posts

If you have any idea how to avoid removing legit posts just comment here, otherwise I can add AG filter

All ads that show for me has a href facebook.com/ads, a filter can be made with this

instagram.com#?#main > div div[style*="flex-direction: column;"] > article > div:has(a[href^="https://www.facebook.com/ads/ig_redirect/"][target="_blank"]):style(height: 1px !important; visibility: hidden !important;)

the filter above is efficient but I don't know why it wasn't added before, I looked in the old issues and didn't see anyone mention it, maybe it's a bad selector?

instagram.com#?#main > div div[style*="flex-direction: column;"] > article > div:has(> div:first-child:has(span:has-text(/Sponsored|Gesponsert|Sponsorlu|Sponsorowane|Ispoonsara godhameera|Geborg|Bersponsor|Ditaja|Disponsori|Giisponsoran|Sponzorováno|Sponsoreret|Publicidad|May Sponsor|Sponsorisée|Oipytyvôva|Ɗaukar Nayin|Sponzorirano|Uterwa inkunga|Sponsorizzato|Imedhaminiwa|Hirdetés|Misy Mpiantoka|Gesponsord|Sponset|Patrocinado|Patrocinado|Sponsorizat|Sponzorované|Sponsoroitu|Sponsrat|Được tài trợ|Χορηγούμενη|Спонсорирано|Спонзорирано|Ивээн тэтгэсэн|Реклама|Спонзорисано|במימון|سپانسرڈ|دارای پشتیبانی مالی|ስፖንሰር የተደረገ|प्रायोजित|ተደረገ|प|प्रायोजित|স্পনসর্ড|ਪ੍ਰਯੋਜਿਤ|પ્રાયોજિત|ପ୍ରାୟୋଜିତ|செய்யப்பட்ட செய்யப்பட்ட|చేయబడినది చేయబడినది|ಪ್ರಾಯೋಜಿಸಲಾಗಿದೆ|ചെയ്‌തത് ചെയ്‌തത്|ලද ලද ලද|สนับสนุน สนับสนุน รับ สนับสนุน สนับสนุน|ကြော်ငြာ ကြော်ငြာ|ឧបត្ថម្ភ ឧបត្ថម្ភ ឧបត្ថម្ភ|광고|贊助|内容 内容|贊助|告 告|広告|സ്‌പോൺസർ ചെയ്‌തത്/))):style(height: 1px !important; visibility: hidden !important;)

This filter also works without removing the post with "Sponsored'" in the description, but idk if it's too heavy, and the current uBO filter does the same thing (remove the post that has the specified filter word in the description)

Screenshots ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/5aec757d-0cb6-4f77-9875-f1faf1522c75) ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/be46784a-4560-4eae-a365-7fff8deb3fb8) ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/55cf2ed9-5ea3-4dec-98b0-f4d2b6d299bd)
mapx- commented 1 year ago

I was able to get the ads now and your filter is working fine

D4niloMR commented 1 year ago

thank you

MasterKia commented 1 year ago

https://github.com/uBlockOrigin/uAssets/issues/19803:

https://www.instagram.com/?variant=past_posts

First of all, I wiped the data regarding Facebook & Instagram in the Chrome browser and logged in again.

To reproduce it:

  1. Turn on the Instagram Posts audio.
  2. Scroll down the page until you hear the Sponsored post background audio. (Like in the video)

Note: Some Sponsored posts may not contain sound because they consist only of images. In other words, sponsored posts with video content should be the target. It can be difficult.

I hope you can reproduce it. 👍

Video (Audio included) https://github.com/uBlockOrigin/uAssets/assets/56846906/2bbf6589-660f-44d2-a9f0-f31072ea39ac
Screenshot (without uBO) ![Without uBO](https://github.com/uBlockOrigin/uAssets/assets/56846906/b04c46ff-4d52-405f-98da-4d2a19b06042)
mapx- commented 1 year ago

try

||scontent.cdninstagram.com/v/t50$xhr

kodiakhub commented 1 year ago

try

||scontent.cdninstagram.com/v/t50$xhr

@mapx- This works but I'm not sure it's okay. Because it causes spam:

Video (With audio) https://github.com/uBlockOrigin/uAssets/assets/56846906/d98b1cc2-722c-4c27-8d63-d97df02f4aba
kodiakhub commented 1 year ago

@mapx- the rule you added also blocks some non-sponsored video posts (incorrect blocking). See:

Screenshot ![image](https://github.com/uBlockOrigin/uAssets/assets/56846906/40a0e021-908b-4074-99c2-f50e519bf73f)

I recommend that you reconsider or remove the rule you added. I've customized this rule a bit, background sponsored post audio are blocked and non-sponsored posts are not affected. With this rule:

||scontent.cdninstagram.com/v/t50.2886-16$removeparam

But I'm not sure whether you should add this or not. It may differ due to factors such as geo-specific variation etc. At least I understand what to block with the user rule. Thanks. 👍


Update: I checked posts over 100+ more and noticed that this rule too was causing some posts not to load. I guess it won't be easy, but if it's hard, it might be fine to leave this unfixed.

||scontent.cdninstagram.com/v/t50.2886-16$removeparam
kodiakhub commented 1 year ago

@mapx- I updated the previous comment again, sorry. I have rarely seen this rule too cause issues.

Screenshot ![image](https://github.com/uBlockOrigin/uAssets/assets/56846906/5b159136-5d12-4b7e-a520-ff776a065daf)
kodiakhub commented 1 year ago

@mapx- I think this rule works better, that literally blocks Sponsored posts!

instagram.com##main > div div[style*="flex-direction: column;"] > article > div:has(a[href^="https://www.facebook.com/ads/ig_redirect/"][target="_blank"]):remove()

...(height: 1px !important; visibility: hidden !important;) this rule, came from this issue topic:

Due to infinite loop scroll issue.


On my end, I did a long-term test and there is no such infinite loop scrolling issue anymore, instead there is a minor problem that has no effect. See:

Video https://github.com/uBlockOrigin/uAssets/assets/56846906/84a8e756-8140-4310-885c-6811de38e9e6

Can you please check if the situation is the same for you?

mapx- commented 1 year ago

it seems to be ok

kodiakhub commented 1 year ago

@mapx- To inform: After some time, I noticed that some Sponsored Posts were not blocked. See:

Screenshots ![image](https://github.com/uBlockOrigin/uAssets/assets/56846906/8d96659f-1cb5-4b3f-93e3-577d95e904ac) ![image](https://github.com/uBlockOrigin/uAssets/assets/56846906/9f60c951-d0e8-4371-b311-f57b77156a8c)

On my end, just tested this rule. No more Sponsored Posts and I haven't seen infinite scrolling or any other issues yet. Except this minor issue I mentioned:

minor problem that has no effect.

! uBO automatically converts this rule syntax:
instagram.com#$?#main > div div[style*="flex-direction: column;"] > article > div:has(span:contains(/(Sponsored|Sponsorlu)/)) { remove: true; }
Screenshot ![image](https://github.com/uBlockOrigin/uAssets/assets/56846906/35121411-3a98-4cdb-80a8-879993f68980)

I hope it's the same situation on your end. Otherwise, just take it as info. Because the situation may be different for other users. 👍

designspg commented 11 months ago

I am seeing ads on instagram again. https://www.instagram.com/ https://github.com/uBlockOrigin/uAssets/assets/111537648/bb9f9246-5d33-4563-b2b5-7fe9f600a310

D4niloMR commented 11 months ago

Me too.

Sponsored: ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/328c6c35-ee03-4991-9887-95a9858eb041)
Normal post: ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/82cc8d5f-7ba5-4c4f-a984-8a388fd43eba)

After span[style="line-height: var(--base-line-clamp-line-height); --base-line-clamp-line-height: 16px;"] on normal posts, it has a [href] or just nothing after:

Screenshot ![image](https://github.com/uBlockOrigin/uAssets/assets/70459964/faf1720b-b799-4085-9fe0-dc5a6f8e09c6)

But in sponsored posts, it has this sequence: span[style="line-height: var(--base-line-clamp-line-height); --base-line-clamp-line-height: 16px;"] > div > span > svg > use

This filter works to me:

instagram.com#?#main > div div[style*="flex-direction: column;"] > article > div:has(>div:first-child span[style="line-height: var(--base-line-clamp-line-height); --base-line-clamp-line-height: 16px;"] > div > span > svg > use):remove()

Can be this also: instagram.com#?#main > div div[style*="flex-direction: column;"] > article > div:has(>div:first-child a[href*="/?enable_persistent_cta="]):remove()

This filter doesn't work anymore:

https://github.com/uBlockOrigin/uAssets/blob/a53e8924c018611db7d2a60986444107add56249/filters/filters-2022.txt#L3948

D4niloMR commented 11 months ago

@designspg Can you test this filter?

instagram.com#?#main > div div[style*="flex-direction: column;"] > article > div:has(>div:first-child span[style="line-height: var(--base-line-clamp-line-height); --base-line-clamp-line-height: 16px;"] > div > span > svg > use):style(border: 2px dotted red !important;)

designspg commented 11 months ago

It put a red dotted line around the "sponsored post" which looks to be your intent?

D4niloMR commented 11 months ago

instagram.com#?#main > div div[style*="flex-direction: column;"] > article > div:has(>div:first-child a[href*="/?enable_persistent_cta="]):remove()

instagram.com#?#main > div div[style*="flex-direction: column;"] > article > div:has(>div:first-child span[style="line-height: var(--base-line-clamp-line-height); --base-line-clamp-line-height: 16px;"] > div > span > svg > use):remove()

I still can see some ads. Will any of these or a better filter be added?

mapx- commented 11 months ago

if you use instagram and getting ads .. you could propose a PR

kodiakhub commented 11 months ago

@D4niloMR I can say that, currently with uBO default, Sponsored posts appear on the Instagram and if we enable the AdGuard Base filter, there are no Sponsored posts. Could you try with AdGuard Base filter enabled?

I think this AdGuard Base filter rule is relevant 👉 https://github.com/AdguardTeam/AdguardFilters/commit/8c4fec7112532f1c7cf360033df4dc4d24840a6b

But, I could not see any info about AdGuard base filters rule in the uBO logger. Hope it helps. 👍

D4niloMR commented 11 months ago

Could you try with AdGuard Base filter enabled?

I can see sponsored posts with AdGuard Base filter enabled.