View Single Post
Old 09-26-2011, 10:59 AM   #14
macpablus
Enthusiast
macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.macpablus once ate a cherry pie in a record 7 seconds.
 
Posts: 25
Karma: 1896
Join Date: Aug 2011
Device: Kindle 3
And here it is. Modified postprocess_html that inserts a second comic strip (the one located at the end of the page):

Spoiler:
Code:
    def postprocess_html(self, soup, first):
        # Try to find the div containing the first image
        rudy = soup.find('div', attrs={'id':'rudy_paz'})
		# Try to find the div containing the second image
        rep = soup.find('div', attrs={'id':'rep'})
                        
        if rep:
            # if found, extract the div, clear the body and add the image again. Finished.
            #rep.extract()
            while len(soup.body) > 0:
                soup.body.next.extract()
            soup.body.insert(0, rudy)
            soup.body.insert(rudy,rep)
            return soup


Now, I'm trying to insert an <hr> tag between the two, but I can't find the way.
macpablus is offline   Reply With Quote