#!/usr/bin/env  python2

__license__ = 'GPL v3'
__copyright__ = '2010 Starson17'
'''
fudzilla.com
'''

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


class Fudzilla(BasicNewsRecipe):
    title = u'Fudzilla'
    __author__ = 'Starson17'
    language = 'en'

    description = 'Tech news'
    oldest_article = 7
    remove_javascript = True
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False

    remove_tags_before = dict(name='div', attrs={'class': ['padding']})

    remove_tags = [dict(name='td', attrs={'class': ['left', 'right']}),
                   dict(name='div', attrs={'id': ['toolbar', 'buttons']}),
                   dict(name='div', attrs={
                        'class': ['artbannersxtd', 'back_button']}),
                   dict(name='span', attrs={'class': ['pathway']}),
                   dict(name='th', attrs={
                        'class': ['pagenav_next', 'pagenav_prev']}),
                   dict(name='table', attrs={'class': ['headlines']}),
                   ]

    feeds = [
        (u'Posts', u'http://www.fudzilla.com/?format=feed')
    ]

    preprocess_regexps = [
        (re.compile(r'<p class="MsoNormal"> Welcome.*</p> ',
                    re.DOTALL | re.IGNORECASE), lambda match: '')
    ]
