Update EcoGeek

This commit is contained in:
Kovid Goyal 2014-11-27 12:26:27 +05:30
parent 2ad5da0915
commit 712f94049a

View File

@ -6,7 +6,9 @@ __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
EcoGeek.org EcoGeek.org
''' '''
import os
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ptempfile import PersistentTemporaryDirectory
class EcoGeek(BasicNewsRecipe): class EcoGeek(BasicNewsRecipe):
title = 'EcoGeek' title = 'EcoGeek'
@ -14,19 +16,19 @@ class EcoGeek(BasicNewsRecipe):
description = 'EcoGeek - Technology for the Environment Blog Feed' description = 'EcoGeek - Technology for the Environment Blog Feed'
publisher = 'EcoGeek' publisher = 'EcoGeek'
language = 'en' language = 'en'
category = 'news, ecology, blog'
oldest_article = 30
max_articles_per_feed = 100
no_stylesheets = True no_stylesheets = True
use_embedded_content = True
html2lrf_options = [ def parse_index(self):
'--comment', description tdir = PersistentTemporaryDirectory('_ecogeek')
, '--category', category articles = []
, '--publisher', publisher 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)
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' with open(fname, 'wb') as f:
feeds = [(u'Posts', u'http://feeds2.feedburner.com/EcoGeek')] 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)]