mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
#!/usr/bin/env python2
|
|
|
|
__license__ = 'GPL v3'
|
|
__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'
|
|
__author__ = 'Darko Miletic'
|
|
description = 'EcoGeek - Technology for the Environment Blog Feed'
|
|
publisher = 'EcoGeek'
|
|
language = 'en'
|
|
no_stylesheets = True
|
|
|
|
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)]
|
|
|