mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update EcoGeek
This commit is contained in:
parent
2ad5da0915
commit
712f94049a
@ -6,7 +6,9 @@ __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
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)]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user