#!/usr/bin/env  python2

__license__ = 'GPL v3'
__copyright__ = u'2010-2011, Tomasz Dlugosz <tomek3d@gmail.com>'
'''
frazpc.pl
'''

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


class FrazPC(BasicNewsRecipe):
    title = u'frazpc.pl'
    publisher = u'frazpc.pl'
    description = u'Tw\xf3j Vortal Technologiczny'
    language = 'pl'
    __author__ = u'Tomasz D\u0142ugosz'
    oldest_article = 7
    max_articles_per_feed = 100
    use_embedded_content = False
    no_stylesheets = True
    remove_empty_feeds = True
    cover_url = 'http://www.frazpc.pl/images/logo.png'
    feeds = [
        (u'Aktualno\u015bci', u'http://www.frazpc.pl/feed/aktualnosci'),
        (u'Artyku\u0142y', u'http://www.frazpc.pl/feed/artykuly')
    ]

    keep_only_tags = [dict(name='div', attrs={'class': 'article'})]

    remove_tags = [
        dict(name='div', attrs={'class': 'title-wrapper'}),
        dict(name='p', attrs={'class': 'tags'}),
        dict(name='p', attrs={'class': 'article-links'}),
        dict(name='div', attrs={'class': 'comments_box'})
    ]

    remove_tags_after = dict(name='div', attrs={'class': 'content'})
    preprocess_regexps = [(re.compile(
        r'\| <a href="#comments">Komentarze \([0-9]*\)</a>'), lambda match: '')]

    remove_attributes = ['width', 'height']
