View Single Post
Old 10-31-2010, 12:38 PM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by marbs View Post
thought of something like this:
Spoiler:
Code:
    def postprocess_html(self, soup):
        print 'the soup is', soup
        for tag in soup.findAll(name=['p']):
            print tag
            text= tag.contents()
            print text
            if text = ' ':
                tag.extract ()


once i add this function, the recipe does not give me any articles. am i using it right?
You are using "=" the assignment operator. You want "==" the comparison operator. You could also use
Code:
    preprocess_regexps = [
        (re.compile(r'<p>&nbsp;</p>', re.DOTALL|re.IGNORECASE), lambda match: '')
        ]
Quote:
can i the description as one of the variables that postprocess_html gets?
what is the name of the description variable in calibre?
The name is "text_summary", available in parse_feeds
Code:
    def parse_feeds (self): 
      feeds = BasicNewsRecipe.parse_feeds(self) 
      for feed in feeds:
        for article in feed.articles[:]:
          print 'article.text_summary is: ', article.text_summary
      return feeds
I've never used it outside of parse_feeds, that part is up to you.
Starson17 is offline   Reply With Quote