#!/usr/bin/env python

__license__ = 'GPL v3'
__author__ = 'teepel <teepel44@gmail.com>'

'''
http://www.osw.waw.pl - Osrodek studiow wschodnich
'''

from calibre.web.feeds.news import BasicNewsRecipe


class OSW_Recipe(BasicNewsRecipe):
    language = 'pl'
    title = 'Ośrodek Studiów Wschodnich'
    __author__ = 'teepel <teepel44@gmail.com>'
    INDEX = 'http://www.osw.waw.pl'
    description = 'Ośrodek Studiów Wschodnich im. Marka Karpia. Centre for Eastern Studies.'
    category = 'News'
    oldest_article = 7
    max_articles_per_feed = 100
    cover_url = ''
    remove_empty_feeds = True
    no_stylesheets = True
    remove_javascript = True
    simultaneous_downloads = 5

    keep_only_tags = []
    keep_only_tags.append(dict(name='h2', attrs={'class': 'node-title'}))
    keep_only_tags.append(dict(name='div', attrs={'class': 'content clearfix'}))

    remove_tags = []
    remove_tags.append(dict(name='table', attrs={'id': 'attachments'}))
    remove_tags.append(dict(name='div', attrs={'class': 'print-submitted'}))

    feeds = [('OSW', 'https://www.osw.waw.pl/pl/rss.xml')]

    def print_version(self, url):
        return url.replace('https://www.osw.waw.pl/pl/', 'https://www.osw.waw.pl/pl/print/')
