#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Record (Portugal) — jornal desportivo, receita Calibre.

Site: https://www.record.pt
Feed: https://www.record.pt/rss

Notas:
- Cobre futebol nacional e internacional, modalidades, motorismo.
- Conteúdo aberto e gratuito; bom para um "Record diário" no Kindle.
"""

from calibre.web.feeds.news import BasicNewsRecipe


class RecordPT(BasicNewsRecipe):
    title = 'Record'
    description = 'Jornal desportivo Record — futebol, modalidades e motores'
    language = 'pt'
    publisher = 'Cofina Media'
    publication_type = 'newspaper'
    category = 'desporto, futebol, Portugal'
    oldest_article = 1
    max_articles_per_feed = 50
    no_stylesheets = True
    remove_javascript = True
    use_embedded_content = False
    encoding = 'utf-8'
    auto_cleanup = True

    feeds = [
        ('Record — Últimas', 'https://www.record.pt/rss'),
    ]

    remove_tags = [
        dict(name=['script', 'noscript', 'iframe', 'aside', 'footer']),
        dict(attrs={'class': lambda x: x and any(
            cls in x for cls in [
                'social', 'newsletter', 'related', 'comments',
                'advertisement', 'banner', 'tags', 'sharing',
                'video-player'
            ])}),
    ]
