View Single Post
Old 02-05-2011, 04:40 PM   #3
alison87
Member
alison87 began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Feb 2011
Device: Kindle 3G
It seems i was totally overcomplicating the solution. Here is some code that works, for anyone wanting to do the same thing. Presumably you could also insert the RSS item's author here as well, which is useful for blogs with more than one contributor.

Code:
    def populate_article_metadata(self, article, soup, first):
        h2 = soup.find('h2')
        h2.replaceWith(h2.prettify() + '<p><em>posted at ' + article.localtime.strftime('%Y-%m-%d %H:%M:%S') + '</em></p>')
alison87 is offline   Reply With Quote