View Single Post
Old 06-19-2011, 02:49 AM   #8
scissors
Addict
scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.
 
Posts: 241
Karma: 1001369
Join Date: Sep 2010
Device: prs300, kindle keyboard 3g
I've noticed the link for the print version is the same as the standard with "print-" sandwiched in after the last slash. I thought i might try that instead....

I did some trawling and found starsons thread regarding the join/split by slash method. It seems ideal as i counted the slashs and there were 6, only the string to be inserted changed.

The two links end as...

Cornish-campsite/_ch3_nw1433
Cornish-campsite/Print-_ch3_nw1433

So I thought it was just a case of adding code after the feeds=[] command such as

def print_version(self,url):
segments = URL.split('/')
printURL = '/'.join(segments[0:6]) + '/Print-' + ''.join(segments[6:])
return printURL

I thought this took the url, split it,added '/Print-' and then added the end of the url back on.

it appears to do nothing and the original feeds are still fetched. I've obviously mis-understood how this works.

Can anyone help?
Also is it possible to echo a string to screen so you can test what's going on?


EDit.

I just used the bbc print_version example pasted in after the feeds
ie:

def print_version(self, url):
return url.replace('http://', 'http://newsvote.bbc.co.uk/mpapps/pagetools/print/')

in my reasoning this should have failed as each article would be for example

http://newsvote.bbc.co.uk/mpapps/pag...te/_ch3_nw1433

which wouldn't exist - but the origianl article is still fetched.

I'm baffled now - any help?


thanks guys

Last edited by scissors; 06-19-2011 at 06:16 AM.
scissors is offline   Reply With Quote