#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
from calibre.web.feeds.news import BasicNewsRecipe

def classes(classes):
    q = frozenset(classes.split(' '))
    return dict(
        attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)})
    
class AdvancedUserRecipe1502348373(BasicNewsRecipe):
    title          = 'The Federalist (Test)'
    oldest_article = 7
    max_articles_per_feed = 100
    no_stylesheets = True
    encoding = 'utf8'
    use_embedded_content = False
    remove_attributes = ['xmlns', 'lang']

    keep_only_tags = [
      dict(itemprop=['headline', 'articleBody']),
      classes('entry-title title standard-subtitle alpha-byline byline-month byline byline-standard "entry-content standard clearfix" "entry-content long clearfix" shortbio'),
        ]  
    
    remove_tags = [
     classes(
       'post-categories player-container footer-disclaimer auth-ad date-widget perma-date-title cat-popular-wrapper most-pop-widget perma-pop-title popular-title cat-pop-excerpt popular-excerpt popular-link date-posts-wrapper cat-popular-thumb cat-popular-title cat-popular-excerpt tag-wrapper tags similar-posts-wrapper taboola standard-post-comment-wrapper aside-image-wrapper aside-pos-fix aside-pos aside-alpha aside-header-wrapper aside-left flicker-auth aside-tag-wrapper aside-disclaimer'),
        ]       
      
    feeds          = [
        ('All', 'http://thefederalist.com/feed/'),
    ]
    
