
from calibre.web.feeds.news import BasicNewsRecipe

class AntywebRecipe(BasicNewsRecipe):
    encoding = 'utf-8'
    __license__ = 'GPL v3'
    __author__ = u'Artur Stachecki <artur.stachecki@gmail.com>'
    language = 'pl'
    version = 1
    title = u'Antyweb'
    category = u'News'
    description = u'Blog o internecie i nowych technologiach'
    cover_url=''
    remove_empty_feeds= True
    auto_cleanup = False
    no_stylesheets=True
    use_embedded_content = False
    oldest_article = 1
    max_articles_per_feed = 100
    remove_javascript = True
    simultaneous_downloads = 3

    keep_only_tags =[]
    keep_only_tags.append(dict(name = 'h1', attrs = { 'class' : 'entry-title '}))
    keep_only_tags.append(dict(name = 'div', attrs = {'class' : 'news-content'}))
    extra_css = '''body {font-family: verdana, arial, helvetica, geneva, sans-serif ;}'''

    feeds          = [
                            (u'Artykuly', u'feed://feeds.feedburner.com/Antyweb?format=xml'),
                     ]
    def preprocess_html(self, soup):
        for alink in soup.findAll('a'):
            if alink.string is not None:
                tstr = alink.string
                alink.replaceWith(tstr)
        return soup
