02-05-2007, 04:47 AM | #1 |
Junior Member
Posts: 2
Karma: 10
Join Date: Feb 2007
Device: palm tx
|
How to rewrite New Scientist links
I am trying to rewrite the links for the NewScientist page, but am having no luck. They very cleverly run their RSS feeds through another company so it is impossible (?) to remove the ads, so I am trying to do it from the front page.
I am attempting to 1. Include only articles and no ads 2. rewrite the article urls to include only the printer friendly versions OK, so here is what the links look like http://www.newscientist.com/article/...cord-time.html to http://www.newscientist.com/article....099&print=true and others like http://environment.newscientist.com/...to-action.html to http://environment.newscientist.com/...096&print=true I have so far written as my filters to try and take the first section up to the ".newscientist", then the article id up to the first hyphen (so "dn11096" above), and then append the "&print=true" to get the final printer version. Here are my trial filters (that don't do the job!) http://(.*)\.newscientist\.com/article\.ns?id=(.*)&(.*) changing to http://$1\.newscientist\.com/article\.ns?id=$2\&print=true Any help would be greatly appreciated! |
02-05-2007, 02:39 PM | #2 |
Intentionally Left Blank
Posts: 172
Karma: 300106
Join Date: Feb 2006
Location: Royal Oak, MI, USA
Device: Nook STR
|
The following seems to work. I tried it on their news page with success.
Filter: (.*)newscientist\.com/article/dn(.{5,5}).* Rewrite as: $1newscientist.com/article.ns?id=dn$2&print=true The expression (.{5,5}) captures any string of exactly five characters. (Literally, any string of length between 5 and 5.) |
Advert | |
|
02-05-2007, 03:40 PM | #3 |
Junior Member
Posts: 2
Karma: 10
Join Date: Feb 2007
Device: palm tx
|
Excellent- works perfectly!
Thanks DTM |
02-05-2007, 05:50 PM | #4 |
Intentionally Left Blank
Posts: 172
Karma: 300106
Join Date: Feb 2006
Location: Royal Oak, MI, USA
Device: Nook STR
|
You're welcome!
I noticed that some of the links still don't get rewritten because they include newscientisttech in the URL. I think the following should catch that (but have not tried it). Filter: (.*)newscientist(.*)\.com/article/dn(.{5,5}).* Rewrite as: $1newscientist$2.com/article.ns?id=dn$3&print=true (Note that the old $2 is now $3.) |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WSJ: E-Books Rewrite Bookselling | markbot | News | 21 | 05-25-2010 01:02 PM |
e-reader for a scientist | Olga Shpak | Which one should I buy? | 9 | 03-04-2010 04:57 PM |
NYT: Textbooks That Professors Can Rewrite Digitally | ekaser | News | 7 | 03-01-2010 01:27 PM |
Request: New Scientist recipe | AprilHare | Calibre | 11 | 11-24-2008 09:26 AM |
Greetings and offering to help on the wiki rewrite | orchidpop | Introduce Yourself | 10 | 05-11-2008 11:12 PM |