View Single Post
Old 07-20-2011, 02:44 PM   #3
khromov
Connoisseur
khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.khromov ought to be getting tired of karma fortunes by now.
 
Posts: 83
Karma: 499304
Join Date: Jul 2011
Device: Kindle
I did figure this one out myself, sort of. I settled with adding the title into the content container (it makes no difference when viewed anyway.)

It's done by using postprocess_html(), which gives you the HTML of each article just before heading to the finished paper.
Code:
 def postprocess_html(self, soup, first_fetch):
        #find container, in my case it's a div with the id attribute set to "story" and insert the HTML you wish, in my case the string '<h1>testing</h1>'
        for link_tag in soup.findAll(attrs={"id" : "story"}):
            link_tag.insert(0,'<h1>testing</h1>')
khromov is offline   Reply With Quote