Skip to content

Colombia ads - Missed ads #247

Closed
Closed

Description

@gotitbro

I am seeing "Recommended by Colombia" (recommended content) ads on websites which use the Colombia Ad network (https://www.colombiaonline.com/). These ads can be hidden by:
indiatimes.com##STYLE[type="text/css"] + [class] but a lot of resources are used in loading the ads.

Example URLs:
http://timesofindia.indiatimes.com/us-elections-2016/Obama-tells-Latin-America-and-world-Give-Trump-time-dont-assume-worst/articleshow/55523627.cms
http://www.in.techradar.com/news/misc/your-smart-samsung-tv-is-about-to-get-a-lot-more-personalized/articleshow/56204222.cms
http://www.idiva.com/news-work-life/things-you-should-definitely-say-yes-to-in/16122235

SS:
Ads appear in the sidebar and below the article (cannot post screenshot due to fragmentation of image).

The ads don't seem to be loaded externally and the script seems to be embedded in the webpage itself. Further discussion: https://forums.lanik.us/viewtopic.php?f=62&t=34718&p=110665

Versions:

  • Browser/version: Chrome 55
  • uBlock Origin version: v1.10.4

Activity

  1. gorhill commented on Dec 27, 2016

    @gorhill
    Member

    Does this work?

    ||clmbtech.com^
    
  2. uBlock-user commented on Dec 27, 2016

    @uBlock-user
    Member

    No, infact blocking 3rd party content and inline script won't stop it either from appearing.

  3. gorhill commented on Dec 27, 2016

    @gorhill
    Member

    I noticed this afterward, the site use a cookie to not always serve the Columbia ads, this made me think the filter above worked.

    I came up with this:

    timesofindia.indiatimes.com##.main-content > div[class]:matches-css(background-image: /timesofindia\.indiatimes\.com/toiitpic/commons/images/rbc-/)
    timesofindia.indiatimes.com##.sidebar > .ctn_ads_rhs > div[class]
    

    First one is uBO-specific, second one should also work for ABP.

  4. uBlock-user commented on Dec 27, 2016

    @uBlock-user
    Member

    How are they able to load even after inline-script and first party scripts are blocked ?

  5. gorhill commented on Dec 27, 2016

    @gorhill
    Member

    They are not loaded after, they are served as part of the document by the server.

  6. uBlock-user commented on Dec 27, 2016

    @uBlock-user
    Member

    So basically the script is fragmented and embedded as a part of the document and no longer a standalone js.

  7. gorhill commented on Dec 27, 2016

    @gorhill
    Member

    The HTML tags making up the "Recommended by Columbia" are embedded in the document, no need for javascript. Easy to find out, just put view-source:http://timesofindia.indiatimes.com/us-elections-2016/Obama-tells-Latin-America-and-world-Give-Trump-time-dont-assume-worst/articleshow/55523627.cms in address bar and search for "columbia" (inline javascript only makes them clickable).

  8. gorhill commented on Dec 27, 2016

    @gorhill
    Member

    Actually the filter suggested filter on EasyList forum works well, the random-class div containing the ads are pretty much always preceded by a style tag:

    indiatimes.com##style[type="text/css"] + div[class]
    

    So no need for any extended uBO syntax.

  9. gotitbro commented on Dec 29, 2016

    @gotitbro
    Author

    @gorhill As I posted in the first post, the above cosmetic filter works. I started this issue as I saw a lot of data being spent to load the ad images but as you posted above these ads can't seem to be blocked and the best we can do for now is hide them.

  10. gotitbro commented on Jul 21, 2017

    @gotitbro
    Author

    @gorhill @okiehsch The the filter suggested filter on the EasyList forum does not seem to be working anymore: ##style[type="text/css"] + div[class]

    I am again seeing the "Recommended by Colombia" ads.

    Error URL:
    http://timesofindia.indiatimes.com/world/europe/polish-parliament-adopts-contested-supreme-court-reform/articleshow/59686535.cms

  11. okiehsch commented on Jul 21, 2017

    @okiehsch
    Contributor

    The first one suggested by gorhill still works for me

    timesofindia.indiatimes.com##.main-content > div[class]:matches-css(background-image: /timesofindia\.indiatimes\.com/toiitpic/commons/images/rbc-/)
    
  12. gotitbro commented on Jul 21, 2017

    @gotitbro
    Author

    @okiehsch That does work for the ads in the articles but these Colombia ads are displayed all over this website without that background image and they do not get hidden. Like on the homepage: http://timesofindia.indiatimes.com

    SS: https://i.imgur.com/i3r2THZ.png

    The same is true for ads on other websites in this ad network (owned by the publisher of these websites) which are displayed without that background picture. For example:
    http://navbharattimes.indiatimes.com/world/rest-of-europe/head-of-french-military-quits-after-row-with-emmanuel-macron/articleshow/59678633.cms

  13. okiehsch commented on Jul 21, 2017

    @okiehsch
    Contributor

    @gotitbro this

    navbharattimes.indiatimes.com##.leftmain > div[class]:matches-css(background-image: /navbharattimes\.indiatimes\.com/nbige/commons/images/rbc-/)
    navbharattimes.indiatimes.com##.parentRgtSuperhtSec > div[class]:matches-css(background-image: /navbharattimes\.indiatimes\.com/nbige/commons/images/rbc-/)
    

    seems to work at http://navbharattimes.indiatimes.com/world/rest-of-europe/head-of-french-military-quits-after-row-with-emmanuel-macron/articleshow/59678633.cms on my end, I hope, as I can't read hindi.

  14. gotitbro commented on Jul 21, 2017

    @gotitbro
    Author

    @okiehsch Thanks, those filters do work for the ads in the articles, the ads on the homepage are still visible: http://navbharattimes.indiatimes.com

    The previous filter covered all these ads on the different websites of the publisher. A similar solution would be really beneficial here. There are quite a few websites using these ads:
    AdguardTeam/AdguardFilters#4787

  15. 14 remaining items

  16. jspenguin2017 commented on Sep 4, 2017

    @jspenguin2017
    Contributor

    As you scroll, more contents are loaded, so you need to keep scanning it...

  17. okiehsch commented on Apr 8, 2018

    @okiehsch
    Contributor
  18. jspenguin2017 commented on Apr 8, 2018

    @jspenguin2017
    Contributor

    The script rule for reference:

    Details
    if (a.domCmp(["adageindia.in", "bombaytimes.com", "businessinsider.in", "gizmodo.in", "iamgujarat.com", "idiva.com",
        "in.techradar.com", "indiatimes.com", "timesofindia.com", "lifehacker.co.in", "mensxp.com", "samayam.com",
        "gadgetsnow.com"])) {
        //https://gitlab.com/xuhaiyang1234/uBlockProtectorSecretIssues/issues/8
        a.inject(() => {
            "use strict";
            const magic = "a" + window.Math.random().toString(36).substring(2);
            const reScript = /typeof otab == 'function'/;
            const reComment = /\d{5,} \d{1,2}/;
            const getter = () => {
                let script;
                {
                    let temp = [...window.document.querySelectorAll(`script:not([src]):not([${magic}])`)];
                    if (window.document.currentScript && !window.document.currentScript.hasAttribute(magic)) {
                        temp.unshift(window.document.currentScript);
                    }
                    if (!temp.length) {
                        return true;
                    }
                    for (let i = 0; i < temp.length; i++) {
                        temp[i].setAttribute(magic, 1);
                        if (reScript.test(temp[i].textContent)) {
                            script = temp[i];
                            break;
                        }
                    }
                }
                if (!script) {
                    return true;
                }
                {
                    const previous = script.previousSibling;
                    let temp = previous;
                    while (temp = temp.previousSibling) {
                        if (temp.nodeType === window.Node.COMMENT_NODE && reComment.test(temp.data)) {
                            previous.style.setProperty("display", "none", "important");
                            return false;
                        }
                    }
                }
            };
            window.Object.defineProperty(window, "trev", {
                configurable: false,
                set() { },
                get() {
                    let r;
                    let i = 0;
                    do {
                        try {
                            r = getter();
                        } catch (err) { }
                    } while (!r && i++ < 100);
                    return null;
                },
            });
            window.addEventListener("load", () => {
                void window.trev;
            });
        });
    
        let isInBackground = false;
        const reStart = /^\/[a-z_]+\.cms/;
        const reEnd = /^ \d{5,} \d{1,2} $/;
        const adsHidder = () => {
            if (isInBackground || !document.body) {
                return;
            }
            let iterator = document.createTreeWalker(document.body, NodeFilter.SHOW_COMMENT);
            let comment;
            while (comment = iterator.nextNode()) {
                if (reStart.test(comment.data)) {
                    let toHide = [];
                    let previous = comment;
                    while (previous = previous.previousSibling) {
                        if (previous.nodeType === Node.COMMENT_NODE && reEnd.test(previous.data)) {
                            if (toHide.length < 15) {
                                for (let i = 0; i < toHide.length; i++) {
                                    try {
                                        toHide[i].style.setProperty("display", "none", "important");
                                    } catch (err) { }
                                }
                            }
                            break;
                        }
                        toHide.push(previous);
                    }
                }
            }
        };
        setInterval(adsHidder, 1000);
        //@pragma-if-debug
        //a.setBenchmarkedInterval(adsHidder, 1000);
        //@pragma-end-if
        a.on("focus", () => { isInBackground = false; });
        a.on("blur", () => { isInBackground = true; });
    }
  19. ghajini commented on May 7, 2018

    @ghajini
    Collaborator

    a PR for this would help a lot @jspenguin2017

  20. jspenguin2017 commented on May 7, 2018

    @jspenguin2017
    Contributor

    I can PR if @gorhill accepts it.
    I think he'll shake his head on the setInterval.

  21. gotitbro commented on May 27, 2018

    @gotitbro
    Author

    @okiehsch Any plan on incorporating the Nano solution to the uBO filters?

  22. okiehsch commented on May 28, 2018

    @okiehsch
    Contributor

    @gotitbro
    jspenguin2017 already pinged gorhill, it's his decision.

  23. gorhill commented on May 29, 2018

    @gorhill
    Member

    How would a scriptlet look like? I would like to try it first on my side.

  24. jspenguin2017 commented on May 29, 2018

    @jspenguin2017
    Contributor

    It would look the same, just in ES5. a.inject is not needed because scriptlets are already in page scope. a.on is just mapped to window.addEventListener.

  25. gotitbro commented on Aug 16, 2018

    @gotitbro
    Author

    @gorhill Can the Nano fix be added to uBO? Would be great if this issue can be solved.

  26. jspenguin2017 commented on Aug 18, 2018

    @jspenguin2017
    Contributor

    uBO probably won't have it because it has a measurable performance impact.

    I'm not too worried about that as Nano is intended to be for computers only (not for cell phones). I'm rolling an experimental port of the solution in ND:
    NanoAdblocker/NanoFilters@4f4de6c
    NanoAdblocker/NanoFilters@df8a96f

  27. mapx- commented on Mar 13, 2019

    @mapx-
    Contributor
    • meanwhile were added various filters to ublock filters list.
    • open new issues if new ads are added on the same pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions