NanoAdblocker / NanoFilters

Script snippets and filters
GNU General Public License v3.0
127 stars 28 forks source link

[Anti-adblock] ani.gamer.com.tw #280

Open lancelot-moon opened 5 years ago

lancelot-moon commented 5 years ago

URLs where this issue occurs (Required) https://ani.gamer.com.tw/animeVideo.php?sn=11778

Screenshots (Required) Anti-adblock warning:

Screenshot: ![image](https://i.imgur.com/C6rNBYa.png)

Ad video from the beginning:
Screenshot: ![image](https://i.imgur.com/iZi5V2c.jpg)

1. Need Taiwan IP for watching videos there. Please add `@@||ani.gamer.com.tw^$generichide` for hiding the popup of anti-adblock warning. (Just an annoyance. It doesn't forbid users continuing to watch anime videos.) 2. From the beginning of playing anime video, there is ad video. Nano Defender can decrease the countdown of ad video to 3 seconds. Generally, the countdown of ad video is **30 seconds**. Is it possible to perfectly skip the ad video? For your reference, this is valid script for skipping ad videos on https://ani.gamer.com.tw/ https://greasyfork.org/en Step 1: install a user script manager https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo Step 2: install this script for skipping ad videos on https://ani.gamer.com.tw/ https://greasyfork.org/en/scripts/370155-%E8%B7%B3%E9%81%8E%E5%8B%95%E7%95%AB%E7%98%8B%E5%BB%A3%E5%91%8A/code
jspenguin2017 commented 5 years ago

I can't reproduce anti-adblock. As for ads, Nano Defender has a solution for it, but I guess there's no way around the 3 seconds server-enforced timer. That Userscript also has to wait for 3 seconds.

image

jspenguin2017 commented 5 years ago

Closing as invalid as you did not fill the template.

lancelot-moon commented 5 years ago

No, you need to have an account for logining into it first. Then you'll see that anti-adblock warning.

Screenshot: ![image](https://i.imgur.com/jdGAelw.jpg)

Without login, I also won't see that anti-adblock warning. You need to add `@@||ani.gamer.com.tw^$generichide` in your filter.
jspenguin2017 commented 5 years ago

Ah, OK, I see the code that does that.

    a.prototype.antiBlock = function() {
        var e = t.createElement("div");
        jQuery(e).addClass("afs_ads").html(" "),
        jQuery("body").append(e),
        setTimeout(function() {
            var e = t.getElementsByClassName("afs_ads")
              , n = e[e.length - 1];
            n && 0 != n.innerHTML.length && 0 != n.clientHeight ? n.style.display = "none" : alert("由於擋廣告插件會影響播放器運作,如果您有安裝,請您將 gamer.com.tw / bahamut.com.tw 網域加入白名單或考慮關閉插件,動畫瘋感謝您的支持!")
        }, 2e3)
    }
lancelot-moon commented 5 years ago

So, will you add any rules for it?

jspenguin2017 commented 5 years ago

Already added.

lancelot-moon commented 5 years ago

Which filter did you add the rule in? I can't find it... Thanks.

jspenguin2017 commented 5 years ago

https://github.com/NanoAdblocker/NanoFilters/commit/85d761619fbe69b96e14d23c5c1772b7a274001f

lancelot-moon commented 5 years ago

ani.gamer.com.tw recently updated the ad scripts. Now, need to wait for 10 sec, not 3 sec.

jspenguin2017 commented 5 years ago

Seems to still work with 3 sec for me. Maybe they didn't roll the change out to everyone. @LiCybora Can you test?

LiCybora commented 5 years ago

Still 3 secs for me with or without login, for both normal and beta player.

lancelot-moon commented 5 years ago

I disabled Nano contrib filter – Placeholder buster. That's why I ​​​​​​​​​needed to wait for 10 sec. After enabling Nano contrib filter – Placeholder buster, it's 3 sec. Thanks.

jspenguin2017 commented 5 years ago

That's not possible, the placeholder buster filter is no-op on this domain.

lancelot-moon commented 5 years ago

It seems that it updates scripts today. Although ad video is blocked, need to wait for 30 sec.

Screenshot: ![image](https://i.imgur.com/sON6O0G.png)

LiCybora commented 5 years ago

Because their updated script become this:

    n = 86414 == u.adID || 86413 == u.adID ? '00:00:20' : '00:00:30';
    xml = '<VAST xmlns:xs ...... <Linear skipoffset="' + n + '"> ......

A more bulletproof solution will be using regex for capturing the offset and forced to be 3 seconds.

jspenguin2017 commented 5 years ago

I'll disable the rule while we investigate this issue.

LiCybora commented 5 years ago

Better not disable it since the 3 seconds rule still works for beta player.

Change the timer offset can resolve: const adsTimerOffset = /<Linear skipoffset=.*?>/;

Btw, the ads hiding and auto-skip no longer works for beta, but 3 seconds rule still holds for both old and new rules.

jspenguin2017 commented 5 years ago

This is going to break again when the script changes though... It's pretty fragile.

lancelot-moon commented 5 years ago

It doesn't work. It also doesn't work for beta player.

Originally, ad video was blocked at least though needing to wait for 30 sec after it updated scrips. But you did the changes. https://github.com/jspenguin2017/uBlockProtector/commit/14abb947d3f201ccf1abda2cfffd9b8594c9c440

Now, not only need to wait for 30 sec but also watch ad video.

jspenguin2017 commented 5 years ago

The new solution isn't released yet as I'm worried that it's going to break again soon.

I'll test & release it now as I don't think we can come up with a solution that'll last longer.

jspenguin2017 commented 5 years ago

I just released the new fix, can someone verify?

lancelot-moon commented 5 years ago

The new fix is valid for both release and beta players. 3 sec timer and ad video blocked. Thanks!

Screenshot: ![image](https://i.imgur.com/8HMyN8b.png)

lancelot-moon commented 5 years ago

Yesterday, it updated scripts.

  1. 3 sec timer is still valid.
  2. But ad video can't be blocked, and users need to manually click the button of "Click here for skipping ad". (Its beta player doesn't have the point 2 issue.)
    Screenshot:

image

LiCybora commented 5 years ago

They merge some changes in beta to normal player. The beta solution works for normal player as well now.

jspenguin2017 commented 5 years ago

How often do they update their player? If it happens every week then we might have a problem.

lancelot-moon commented 5 years ago
  1. Can't normally play videos with Firefox or Kiwi Browser on Android. Black screen. (mobile mode)

  2. If swifting mobile browser to desktop mode, a cross on the screen. When using desktop browser on PC, sometimes also meet the cross. Refreshing page can solve it for desktop browser. But refreshing page is useless for mobile browser.

    Screenshot:

image

lancelot-moon commented 5 years ago

It seems that your rules are totally failed now. With Nano, it doesn't allow playing videos after clicking the skip button.

lancelot-moon commented 5 years ago

Did you cancel the 3 sec timer for the website, right? Now, need to wait for 30 sec of ad video.

jspenguin2017 commented 5 years ago

The complexity of the fix is too high, and publishing extension updates isn't instantaneous anymore.

I'll wait until Manifest V3 so I can have configurable content scripts. That way, I can be sure high complexity fixes can be quickly turned off to avoid breakage.

LiCybora commented 5 years ago

3 sec is no more due to their change in server side (now need more time for wait but still better than 30). Rules for beta are still valid for both players.

Rule is moved to experimental rule in Firefox, as Firefox has already equipped with configurable content scripts and experimental rule can be quickly toggle.