zoukankan      html  css  js  c++  java
  • Adblock Plus完美过滤视频网站广告、无黑屏!及屏蔽非本站脚本的Adblock Plus过滤器语法之探讨

    测试用浏览器:Firefox 24。订阅的Adblock Plus过滤规则有默认的 ChinaList + EasyList,和国内视频广告规则[Yge.me],其网址:http://i.yge.me/killad/kill.video.ad.txt

    注:使用Chrome衍生浏览器(如金山猎豹、世界之窗6、枫树浏览器)的最好另行使用插件:Adkill and Media Download

    但光有这二个订阅规则还不够,youku.com有广告时长的黑屏, iqiyi.com的视频广告也没过滤掉!

    添加上如下规则:

    ||static.soku.com/v*/soku/js/
    @@||static.youku.com/v*/index/js/common.js
    ||static.youku.com/v*/index/js/
    ||nl.rcd.iqiyi.com^

    还得对ChinaList + EasyList订阅规则再作处理,将订阅规则以下二条白名单禁用(即将规则后的勾选取消,如下图)

    @@||valf.atm.youku.com/vf?$object-subrequest
    @@||data.video.qiyi.com/videos/other/$object_subrequest

    贴上我的完整过滤规则:

    @@||115.com^$document
    !--------屏蔽外站脚本
    |http://*^$script,third-party,domain=binhuo.com|ranwen.cc|ranwen.net
    !--------youku广告
    ||static.soku.com/v*/soku/js/
    @@||static.youku.com/v*/index/js/common.js
    ||static.youku.com/v*/index/js/
    ||nl.rcd.iqiyi.com^
    !-------屏蔽在线邮图片
    !--/webmail^$image
    !--||mail.*.com^$image
    !-------------------广告联盟站点--------------------
    ||91hui.com^$third-party
    ||360.rbc.cn^$third-party
    ||dian5000.com^$third-party
    ||hm.baidu.com^$third-party
    ||cnzz.com^$third-party
    ||code.xqt7.com^$third-party
    ||google-analytics.com^$third-party
    ||jiathis.com^$third-party
    ||scorecardresearch.com^$third-party
    ||adclick-cn.
    ||sinajs.cn^$third-party
    ||unionli.com^$third-party
    !--------风行网
    ||funshion.com/market^$script

    别忘了将那二条白名单禁用!因为白名单规则的优先级是最高的,所以没办法写到自定义规则中!

    隔了一天,优酷又黑屏了!!加个脚本吧:http://userscripts.org/scripts/show/119622

    其实只有优酷有黑屏,安装完脚本后,其实只须限定过滤优酷,将脚本的以下二行

    // @include http://*/*
    // @include https://*/*

    替换为

    // @include http://*.youku.com/*

    其中的播放器下载可能有点慢,得~将播放器缓存到本地,先备份一下该脚本:

    //将以下四行替换
    // @updateURL https://userscripts.org/scripts/source/119622.meta.js
    // @downloadURL https://userscripts.org/scripts/source/119622.user.js
    // @include http://*/*
    // @include https://*/*
    
    //替换为
    
    // @require https://haoutil.googlecode.com/svn/trunk/player/testmod/loader.swf
    // @require https://haoutil.googlecode.com/svn/trunk/player/testmod/player.swf
    // @require https://haoutil.googlecode.com/svn/trunk/player/ku6.swf
    // @require https://haoutil.googlecode.com/svn/trunk/player/testmod/iqiyi.swf
    // @require https://haoutil.googlecode.com/svn/trunk/player/testmod/iqiyi5.swf
    // @require https://haoutil.googlecode.com/svn/trunk/player/testmod/iqiyi_out.swf
    // @require https://haoutil.googlecode.com/svn/trunk/player/testmod/tudou.swf
    // @require https://haoutil.googlecode.com/svn/trunk/player/testmod/olc_8.swf
    // @require https://haoutil.googlecode.com/svn/trunk/player/testmod/sp.swf
    // include http://v.youku.com/v_show/id_*.html*
    // @include http://*.youku.com/*
    

    经测试,优酷、爱奇艺、土豆、酷六、乐视、腾讯视频、搜狐视频、PPS、PPlive、CNTV、风行网等都能完美过滤广告,也无黑屏!


    对Adblock Plus过滤器语法有兴趣可看看:

    很多网站的非本站脚本其实都可以屏蔽,但ABP的过滤语法怎么写,以前一直没有头绪。Google也找不到资料,刚好这二天找到了方法:

    $third-party选项很强大,大都用来设定广告联盟网址的,但怎么一条规则就屏蔽非本站脚本或其它资源呢,试用$~third-party,但直接屏蔽本站脚本了。试用domain选项,OK了,见我的自定义规则第二条。哈哈,真爽,可以一条规则定义几个网站屏蔽非本站资源,嗯,可以是Flash、脚本、图片等。另外举个例子,如爱奇艺的视频广告基本是非本站地址,可这样写,下面的规则未经测试,但语法是没问题。

    |http://*^$third-party,object,object-subrequest,domain=iqiyi.com|qiyi.com|youku.com

    国内视频广告规则[Yge.me]好多条以.swf结尾的规则可简化为上述规则一条,再加上一二条白名单。一条规则搞定N多的广告及网站,爽吧!!!

  • 相关阅读:
    【HDOJ】2267 How Many People Can Survive
    【HDOJ】2268 How To Use The Car
    【HDOJ】2266 How Many Equations Can You Find
    【POJ】2278 DNA Sequence
    【ZOJ】3430 Detect the Virus
    【HDOJ】2896 病毒侵袭
    求奇数的乘积
    平方和与立方和
    求数列的和
    水仙花数
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3358016.html
Copyright © 2011-2022 走看看