diff --git a/recipes/ecogeek.recipe b/recipes/ecogeek.recipe index 484cb3e11f..f199f22a32 100644 --- a/recipes/ecogeek.recipe +++ b/recipes/ecogeek.recipe @@ -6,7 +6,9 @@ __copyright__ = '2009, Darko Miletic ' EcoGeek.org ''' +import os from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ptempfile import PersistentTemporaryDirectory class EcoGeek(BasicNewsRecipe): title = 'EcoGeek' @@ -14,19 +16,19 @@ class EcoGeek(BasicNewsRecipe): description = 'EcoGeek - Technology for the Environment Blog Feed' publisher = 'EcoGeek' language = 'en' - - category = 'news, ecology, blog' - oldest_article = 30 - max_articles_per_feed = 100 no_stylesheets = True - use_embedded_content = True - html2lrf_options = [ - '--comment', description - , '--category', category - , '--publisher', publisher - ] - - html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' - feeds = [(u'Posts', u'http://feeds2.feedburner.com/EcoGeek')] + def parse_index(self): + tdir = PersistentTemporaryDirectory('_ecogeek') + articles = [] + soup = self.index_to_soup('http://feeds2.feedburner.com/EcoGeek') + for i, article in enumerate(soup.findAll('div', attrs={'class':'article'})): + fname = os.path.join(tdir, '%d.html' % i) + with open(fname, 'wb') as f: + f.write(unicode(article).encode('utf-8')) + articles.append({ + 'title':self.tag_to_string(article.find('h2')), + 'url':'file://' + fname.replace(os.sep, '/'), + }) + return [('EcoGeek', articles)]