# -*- coding: utf-8 -*-

from calibre.web.feeds.news import BasicNewsRecipe


class Star (BasicNewsRecipe):

    title = u'Star Gazetesi'
    __author__ = u'thomass'
    description = 'yeni Türkiye''nin Gazetesi'
    oldest_article = 2
    max_articles_per_feed = 100
    no_stylesheets = True
    encoding = 'utf-8'
    publisher = 'thomass'
    category = 'güncel, haber, türkçe'
    language = 'tr'
    publication_type = 'newspaper'

    conversion_options = {
        'tags': category, 'language': language, 'publisher': publisher, 'linearize_tables': True
    }
    extra_css = '  .font8{font-weight: bold; font-size:20px}.font11{font-weight: normal; font-size:small}#hdetay{ font-family:sans-serif;font-size: 9px }'

    keep_only_tags = [dict(name='div', attrs={'class': ['font8']}), dict(
        name='span', attrs={'class': ['font11']}), dict(name='div', attrs={'id': ['hdetay']})]

    cover_img_url = 'http://www.stargazete.com/starnew/img/starlogo.png'
    masthead_url = 'http://www.stargazete.com/starnew/img/starlogo.png'
    remove_empty_feeds = True

    feeds = [


        (u'MANSET', u'http://open.dapper.net/services/starmanset'),
        (u'GÜNCEL', u'http://www.stargazete.com/guncel.xml'),
        (u'POLİTİKA', u'http://www.stargazete.com/politika.xml'),
        (u' EKONOMİ', u'http://www.stargazete.com/ekonomi.xml'),
        (u'DÜNYA', u'http://www.stargazete.com/dunya.xml'),
        (u'YAZARLAR', u'http://www.stargazete.com/gazeteyazarlar.xml'),
        (u'SPOR', u'http://www.stargazete.com/spor.xml'),
        (u'SPOR YAZARLARI',
         u'http://www.stargazete.com/index.php?metot=rss&islem=sporyazarlar'),
        (u'SİNEMA', u'http://www.stargazete.com/sinema.xml'),
        (u'KADIN&SAĞLIK', u'http://www.stargazete.com/kadinsaglik.xml'),
        (u' STARTEK', u'http://www.stargazete.com/startek.xml'),
        (u' AÇIK GÖRÜŞ', u'http://www.stargazete.com/acikgorus.xml'),
        (u'Star PAZAR', u'http://www.stargazete.com/pazar.xml'),
        (u'Star CUMARTESİ', u'http://www.stargazete.com/cumartesi.xml'),



    ]

    def preprocess_html(self, soup):  # remove links
        for alink in soup.findAll('a'):
            if alink.string is not None:
                tstr = alink.string
                alink.replaceWith(tstr)
        return soup
    # def print_version(self, url):
    # return url.replace('/', 'http://www.stargazete.com/')
