__license__   = 'GPL v3'
__copyright__ = '2009-2011, Darko Miletic <darko.miletic at gmail.com>'
'''
www.moneynews.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class MoneyNews(BasicNewsRecipe):
    title                 = 'Moneynews.com'
    __author__            = 'Darko Miletic'
    description           = 'Financial news worldwide'
    publisher             = 'Newsmax.com'
    language              = 'en'
    category              = 'news, finances, USA, business'
    oldest_article        = 2
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    encoding              = 'utf8'
    extra_css             = 'img{display: block} body{font-family: Arial, Helvetica, sans-serif}'
    
    conversion_options = {
                          'comment'   : description
                        , 'tags'      : category
                        , 'publisher' : publisher
                        , 'language'  : language
                        , 'linearize_tables' : True
                        }
    
    feeds = [
              (u'Street Talk'          , u'http://www.moneynews.com/rss/StreetTalk/8.xml'  )
             ,(u'Finance News'         , u'http://www.moneynews.com/rss/FinanceNews/4.xml' )
             ,(u'Economy'              , u'http://www.moneynews.com/rss/Economy/2.xml'     )
             ,(u'Companies'            , u'http://www.moneynews.com/rss/Companies/6.xml'   )
             ,(u'Markets'              , u'http://www.moneynews.com/rss/Markets/7.xml'     )
             ,(u'Investing & Analysis' , u'http://www.moneynews.com/rss/InvestingAnalysis/17.xml')
            ]

    keep_only_tags = [dict(name='div', attrs={'class':'copy'})]
    
    remove_tags = [
                    dict(attrs={'class':['MsoNormal', 'MsoNoSpacing']}),
                    dict(name=['object','link','embed','form','meta'])
                  ]
    
    def print_version(self, url):
        nodeid = url.rpartition('/')[2]
        return 'http://www.moneynews.com/PrintTemplate?nodeid=' + nodeid
