# -*- coding: utf-8 -*-
__license__ = 'GPL v3'

from calibre.web.feeds.news import BasicNewsRecipe


class UnitedDaily(BasicNewsRecipe):
    title = u'聯合新聞網'
    oldest_article = 1
    max_articles_per_feed = 100

    feeds = [(u'焦點', u'http://udn.com/udnrss/focus.xml'),
             (u'政治', u'http://udn.com/udnrss/politics.xml'),
             (u'社會', u'http://udn.com/udnrss/social.xml'),
             (u'生活', u'http://udn.com/udnrss/life.xml'),
             (u'綜合', u'http://udn.com/udnrss/education.xml'),
             (u'意見評論', u'http://udn.com/udnrss/opinion.xml'),
             (u'校園博覽會', u'http://mag.udn.com/udnrss/campus_rss.xml'),
             (u'大台北', u'http://udn.com/udnrss/local_taipei.xml'),
             (u'桃竹苗', u'http://udn.com/udnrss/local_tyhcml.xml'),
             (u'中彰投', u'http://udn.com/udnrss/local_tcchnt.xml'),
             (u'雲嘉南', u'http://udn.com/udnrss/local_ylcytn.xml'),
             (u'高屏離島', u'http://udn.com/udnrss/local_ksptisland.xml'),
             (u'基宜花東', u'http://udn.com/udnrss/local_klilhltt.xml'),
             (u'台灣百寶鄉', u'http://udn.com/udnrss/local_oddlyenough.xml'),
             (u'台灣人物', u'http://mag.udn.com/udnrss/people_rss.xml'),
             (u'兩岸要聞', u'http://udn.com/udnrss/mainland.xml'),
             (u'國際焦點', u'http://udn.com/udnrss/international.xml'),
             (u'台商經貿', u'http://udn.com/udnrss/financechina.xml'),
             (u'國際財經', u'http://udn.com/udnrss/financeworld.xml'),
             (u'全球觀察', u'http://mag.udn.com/udnrss/world_rss.xml'),
             (u'財經焦點', u'http://udn.com/udnrss/financesfocus.xml'),
             (u'股市要聞', u'http://udn.com/udnrss/stock.xml'),
             (u'股市快訊', u'http://udn.com/udnrss/stklatest.xml'),
             (u'稅務法務', u'http://udn.com/udnrss/tax.xml'),
             (u'房市情報', u'http://udn.com/udnrss/houses.xml'),
             (u'個人理財', u'http://mag.udn.com/udnrss/wealth_rss.xml'),
             (u'研究報告', u'http://mag.udn.com/udnrss/report_rss.xml'),
             (u'基金', u'http://mag.udn.com/udnrss/fund_rss.xml'),
             (u'理財會客室', u'http://mag.udn.com/udnrss/m_forum_rss.xml'),
             (u'棒球', u'http://udn.com/udnrss/baseball.xml'),
             (u'籃球', u'http://udn.com/udnrss/basketball.xml'),
             (u'體壇動態', u'http://udn.com/udnrss/sportsfocus.xml'),
             (u'熱門星聞', u'http://udn.com/udnrss/starsfocus.xml'),
             (u'廣電港陸', u'http://udn.com/udnrss/tv.xml'),
             (u'海外星球', u'http://udn.com/udnrss/starswestern.xml'),
             (u'日韓星情', u'http://udn.com/udnrss/starsjk.xml'),
             (u'電影世界', u'http://udn.com/udnrss/movie.xml'),
             (u'流行音樂', u'http://udn.com/udnrss/music.xml'),
             (u'觀點專題', u'http://udn.com/udnrss/starssubject.xml'),
             (u'消費流行', u'http://mag.udn.com/udnrss/happylife_rss.xml'),
             (u'食樂指南', u'http://udn.com/udnrss/food.xml'),
             (u'數位資訊', u'http://mag.udn.com/udnrss/digital_rss.xml'),
             (u'折扣好康', u'http://udn.com/udnrss/shopping.xml'),
             (u'發燒車訊', u'http://mag.udn.com/udnrss/car_rss.xml'),
             (u'醫藥新聞', u'http://udn.com/udnrss/health.xml'),
             (u'家婦繽紛', u'http://udn.com/udnrss/benfen.xml'),
             (u'談星論命', u'http://udn.com/udnrss/astrology.xml'),
             (u'文化副刊', u'http://udn.com/udnrss/reading.xml'),
             (u'旅遊休閒', u'http://travel.udn.com/udnrss/travel_rss.xml'),
             (u'健康醫藥', u'http://mag.udn.com/udnrss/life_rss.xml'),
             ]

    extra_css = '''div[id='story_title'] {font-size:200%; font-weight:bold;} td[class='story_title'] {font-size:200%; font-weight:bold;} td[class='story_title'] td[class='story_title']>div {font-size:200%; font-weight:bold;}'''  # noqa

    __author__ = 'Eddie Lau'
    __version__ = '1.2'
    language = 'zh_TW'
    publisher = 'United Daily News Group'
    description = 'United Daily (Taiwan)'
    category = 'News, Chinese, Taiwan'
    remove_javascript = True
    use_embedded_content = False
    no_stylesheets = True
    encoding = 'utf-8'
    conversion_options = {'linearize_tables': True}
    masthead_url = 'http://udn.com/NEWS/2004/images/logo_udn.gif'
    cover_url = 'http://udn.com/NEWS/2004/images/logo_udn.gif'
    auto_cleanup = True
    # keep_only_tags = [dict(name='td', attrs={'class':['story_title']}),
    #                  dict(name='div', attrs={'id':['story_title']}),
    #                  dict(name='td', attrs={'class':['story_author']}),
    #                  dict(name='div', attrs={'id':['story_author']}),
    #                  dict(name='td', attrs={'class':['story']}),
    #                  dict(name='div', attrs={'id':['story']}),
    #                  ]
