| View previous topic :: View next topic |
| Author |
Message |
Scoop
Sergeant

 Joined: Jun 03, 2003 Posts: 148
|
Posted: Tue May 27, 2008 8:06 pm Post subject: Anyone help with these ads please?? |
|
|
http://www.skyuser.co.uk/forum/sky-news-announcements/
Im a bit of a nob when it comes to filtering but thought I would give it a go to remove the large ads in the above site. However Im pulling my hair out now! Can someone please help and tell me how its done too!
| Description: |
|
| Filesize: |
104.17 KB |
| Viewed: |
45 Time(s) |

|
_________________ Kind Regards
Scoop
|
|
| Back to top |
|
 |
z12
Captain

 Joined: Jul 17, 2002 Posts: 385 Location: USA
|
Posted: Wed May 28, 2008 12:56 am Post subject: |
|
|
Here's the code that my filter blocked for that big ad:
| Code: |
<Match: Remove Ad Containers 3.1.7.0.3 >
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-5535065998260700";
/* 300x250, created 21/03/08 */
google_ad_slot = "9132077434";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script language=JavaScript src=http://www.skyuseradserver.co.uk/bm/abm.aspx?z=6></script>
</div>
</Match>
<?nako removed=div,script: ad ?>
|
Based on the above match, here's a site specific filter:
| Code: |
[Patterns]
Name = "SkyUser Forum Google Ad Killer"
Active = TRUE
URL = "www.skyuser.co.uk/forum/"
Limit = 512
Match = "$NEST(<div,</div >)"
"&*$NEST(<script,*google_ad_slot*,</script >)"
Replace = "<? removed google ad ?>"
|
HTH
|
|
| Back to top |
|
 |
whenever
Lieutenant

 Joined: May 18, 2007 Posts: 163 Location: China
|
|
| Back to top |
|
 |
z12
Captain

 Joined: Jul 17, 2002 Posts: 385 Location: USA
|
Posted: Thu May 29, 2008 1:15 pm Post subject: |
|
|
proxo basically tests the expression that follows the "&" to see if it's true or false.
A trailing "*" is not needed for the and expression test.
Whether or not you need an "*" after the "&", depends on what you are testing for.
In the filter above, the "&" expression could have been written like this:
| Code: |
&<div*$NEST(<script,*google_ad_slot*,</script >)
|
HTH
z12
|
|
| Back to top |
|
 |
whenever
Lieutenant

 Joined: May 18, 2007 Posts: 163 Location: China
|
Posted: Sat Jun 07, 2008 12:52 pm Post subject: |
|
|
@z12, thanks for the explanation. So, is my below conclusion right?
- The position of the sub-expressions doesn't matter
- All the sub-expressions are to be tested from the same starting postion but don't need to be ended at the same position
- The final matched text is determined by the sub-expression which matched the longest text
|
|
| Back to top |
|
 |
z12
Captain

 Joined: Jul 17, 2002 Posts: 385 Location: USA
|
Posted: Mon Jun 09, 2008 3:29 am Post subject: |
|
|
whenever
For the most part, I find the help file description of "&"
/proxomitron-Matching%20Rules.html
to be confusing. That said, here's how I see it.
I visualize the AND function like this:
| Code: |
(
(matching expression)
&(and expression 1)
&(and expression 2)
)
|
The matching expression is of primary importance.
It determines the code block "and expressions" search for a match.
The "and expressions" are secondary True/False matching expressions.
&$TST() allows you check something other than the matching expression.
Here's a filter based on the code example in the help file:
| Code: |
[Patterns]
Name = "img to foo 1."
Active = FALSE
Limit = 256
Match = "<img (*src="picture" & *height=60 & *width=200)*>"
Replace = "<?foo ?>"
|
At first glance, it looks like it should only match a specific img tag.
But open the Test window and check this:
| Code: |
Test code:
<img src="foo" height=6 width=2>
<img width=2 height=6 src="bar">
<img src="picture" height=60 width=200>
hello
Result:
<?foo ?>
hello
|
Three tags were replaced. What went wrong?
The problem is the scope of the matching expression.
It starts with a "<img" and can expand up-to 256 Bytes.
Nothing constrains the match expression to one img tag.
Proxo didn't find all the attributes within the first img tag.
So the attribute search continued beyond the first img tag.
Eventually, all the attributes were found within the scope limit.
Ultimately, the match encompassed three img tags.
For this filter, a Bounds expression can constrain the match:
| Code: |
[Patterns]
Name = "img to foo 1a."
Active = FALSE
Bounds = "<img\s[^>]+>"
Limit = 256
Match = "*"
"&*src="picture""
"&*height=60"
"&*width=200"
Replace = "<?foo ?>"
|
This produces the desired result.
"&&" can also be used to limit the scope of the matching expression:
| Code: |
[Patterns]
Name = "img to foo 1b."
Active = FALSE
Limit = 256
Match = "("
"<img\s[^>]+>
"&&*"
"&*src="picture""
"&*height=60"
"&*width=200"
")"
Replace = "<?foo ?>"
|
The filter above is quite flexible.
You could add tag checks before and after the img match.
Even add a Bounds match that encompassed all the tags.
The img match would still work as expected.
If need be, the other tag checks could use the same technique.
Lastly, the ad filter I posted earlier is not so good.
It should be re-written using methods of filter 1(a|b).
This would insure the match was constrained to the div.
HTH
z12
|
|
| Back to top |
|
 |
whenever
Lieutenant

 Joined: May 18, 2007 Posts: 163 Location: China
|
|
| Back to top |
|
 |
z12
Captain

 Joined: Jul 17, 2002 Posts: 385 Location: USA
|
Posted: Mon Jun 09, 2008 11:28 am Post subject: |
|
|
| whenever wrote: |
@z12, thank you very much for the tutorial, it helps me a lot!
|
Your welcome. Glad it helped some.
For the heck of it, here's a revised ad filter:
| Code: |
[Patterns]
Name = "SkyUser Forum Google Ad Killer"
Active = TRUE
URL = "www.skyuser.co.uk/forum/"
Bounds = "$NEST(<div,</div >)"
Limit = 512
Match = "*&*$NEST(<script,*google_ad_slot*,</script >)"
Replace = "<? removed google ad ?>"
|
z12
|
|
| Back to top |
|
 |
|
|