View Single Post
Old 08-15-2012, 06:00 AM   #6
lrui
Enthusiast
lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.lrui ought to be getting tired of karma fortunes by now.
 
lrui's Avatar
 
Posts: 49
Karma: 475062
Join Date: Aug 2012
Device: nook simple touch
this is another way, you can try it

BEAUTIFUL SOUP DOCUMENTAION
http://www.crummy.com/software/Beaut...%20**kwargs%29

Attachment 90791
Code:
 def append_page(self, soup, appendtag, position):
        pager = soup.find('div', attrs={'class':'text-c'})
        if pager:
           pagenum = soup.find('span')
           nextpage = pagenum.findNextSiblings('a', attrs={'class':'a1'})
           if nextpage:
               nexturl = nextpage['href']
               soup2 = self.index_to_soup(nexturl)
               texttag = soup2.find('div', attrs={'class':'content_left_5'})
               for it in texttag.findAll(style=True):
                   del it['style']
               newpos = len(texttag.contents)
               self.append_page(soup2,texttag,newpos)
               texttag.extract()
               pager.extract()
               appendtag.insert(position,texttag)
i don‘t know whether it works,please tell me.

Last edited by lrui; 08-15-2012 at 06:09 AM.
lrui is offline   Reply With Quote