View Single Post
Old 05-16-2011, 08:56 AM   #3
xXxXxXxXxXx
Enthusiast
xXxXxXxXxXx began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Apr 2011
Device: none
Thank you,
J want to create my own recipe, but J always have problems with changing url to print version,

Could you explain this: (write comment in each line what you do )?

def print_version(self,url):
segments = url.split('/')
printURL = '/'.join(segments[0:3]) + '/print-this/' + '/'.join(segments[4:])
return printURL

def preprocess_html(self, soup):
for alink in soup.findAll('a'):
if alink.string is not None:
tstr = alink.string
alink.replaceWith(tstr)
return soup
xXxXxXxXxXx is offline   Reply With Quote