__license__ = 'GPL v3'
__copyright__ = '2011, Pat Stapleton <pat.stapleton at gmail.com>'
'''
https://www.spectator.com.au/
'''
from calibre.web.feeds.recipes import BasicNewsRecipe


class SpectatorAU(BasicNewsRecipe):
    title = 'Spectator Australia'
    __author__ = 'Pat Stapleton, Dean Cording, James Cridland'
    description = 'Spectator Australia is an Australian edition of The Spectator, first published in the UK in July 1828.'
    masthead_url = 'https://www.spectator.com.au/content/themes/spectator-australia/assets/images/spec-aus-logo.png'
    cover_url = 'https://spectator.imgix.net/content/uploads/2015/10/Spectator-Australia-Logo.jpg'
    oldest_article = 7
    handle_gzip = True
    no_stylesheets = True
    use_embedded_content = False
    scale_news_images_to_device = True
    encoding = 'utf8'
    publisher = 'Spectator Australia'
    category = 'Australia,News'
    language = 'en_AU'
    publication_type = 'newspaper'
    extra_css = '.article-header__author{margin-bottom:20px;}'
    conversion_options = {
        'comments': description,
        'tags': category,
        'language': language,
        'publisher': publisher,
        'linearize_tables': False
    }

    keep_only_tags = [dict(attrs={'class': ['article']})]
    remove_tags = [
        dict(
            attrs={
                'class': [
                    'big-author', 'article-header__category', 'margin-menu',
                    'related-stories', 'disqus_thread', 'middle-promo',
                    'show-comments', 'article-tags'
                ]
            }
        ),
        dict(name=['h4', 'hr'])
    ]
    remove_attributes = ['width', 'height']

    feeds = [
        ('Spectator Australia', 'https://www.spectator.com.au/feed/'),
    ]
