View Single Post
Old 02-06-2012, 05:24 PM   #4
kiavash
Old Linux User
kiavash began at the beginning.
 
Posts: 36
Karma: 12
Join Date: Jan 2012
Device: NST
Thumbs up

Thanks for this post.

This is how I achived the same. You can see I used the same trick to make article title better standing out.

Spoiler:
PHP Code:
    def preprocess_html(selfsoup):
        
# Finds all the jpg links
        
for figure in soup.findAll('a'attrs = {'href' lambda xand 'jpg' in x}):
            
            
# makes sure that the link points to the absolute web address
            
if figure['href'].startswith('/'):
                
figure['href'] = self.site figure['href']
            
            
figure.name 'img' # converts the links to img
            
figure['src']= figure['href'# with the same address as href        
        
        # Makes the title standing out
        
title soup.find('a'attrs = {'class''commonSectionTitle'})
        
title.name 'h1'

        
return soup 
kiavash is offline   Reply With Quote