View Single Post
Old 09-05-2010, 05:34 AM   #2639
cynvision
Member
cynvision began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Sep 2010
Device: nook
Well, I tried the Ft. Wayne site but it's choking on the URL variable. Maybe someone can run with this.
Spoiler:
Code:
class AdvancedUserRecipe1283666183(BasicNewsRecipe):
    title          = u'Journal Gazette Ft. Wayne IN'
    oldest_article = 4
    max_articles_per_feed = 4
    index                 = 'http://www.journalgazette.net/section/LOCAL'
    keep_only_tags = [dict(name='div', attrs={'id':'coll'}), 
                               dict(name='div', attrs={'id':'main'})
                                ]
    def parse_index(self):
        totalfeeds = []
        soup   = self.index_to_soup(self.index)
        features = soup.findAll('li')
        if features:
           farticles = []
           for li in features:
               divurl = li.find('a', href=True)
               if divurl:
                      divdesc = li.find('div',attrs={'class':'postinfo'})
                      url = 'http://www.journalgazette.net' + divurl.a['href']
                      title = self.tag_to_string(divurl.a)
                      description = self.tag_to_string(divdesc)
                      date  = strftime(self.timefmt)
                      divurl= []
                      if '/article/' in url:
                           farticles.append({
                                      'title'      :title
                                     ,'date'       :date
                                     ,'url'        :url
                                     ,'description':description
                                    })

           totalfeeds.append(('Local', farticles))
        return totalfeeds
cynvision is offline