import re
from calibre.web.feeds.news import BasicNewsRecipe


class autogids(BasicNewsRecipe):
    title = u'Automatiseringgids IT'
    oldest_article = 7
    __author__ = 'DrMerry'
    description = 'IT-nieuws van Automatiseringgids'
    language = 'nl'
    publisher = 'AutomatiseringGids'
    category = 'Nieuws, IT, Nederlandstalig'
    simultaneous_downloads = 5
    timefmt = ' [%a, %d %B, %Y]'
    no_stylesheets = True
    remove_javascript = True
    remove_empty_feeds = True
    publication_type = 'newspaper'
    encoding = 'utf-8'
    cover_url = 'http://www.automatiseringgids.nl/binaries/content/gallery/ag/marketing/ag-avatar-100x50.jpg'
    keep_only_tags = [dict(name='div', attrs={'class': ['content']})]

    preprocess_regexps = [
        (re.compile(r'(<h3>Reacties</h3>|<h2>Zie ook:</h2>|<div style=".*</div>|<a[^>]*>|</a>)', re.DOTALL | re.IGNORECASE),
         lambda match: ''),
    ]

    feeds = [(u'Actueel', u'http://www.automatiseringgids.nl/rss.aspx')]
