__license__   = 'GPL v3'
__copyright__ = '2008 Kovid Goyal kovid@kovidgoyal.net, 2010 Darko Miletic <darko.miletic at gmail.com>'
'''
www.businessweek.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class BusinessWeek(BasicNewsRecipe):
    title                 = 'Business Week'
    __author__            = 'Kovid Goyal and Darko Miletic'
    description           = 'Read the latest international business news & stock market news. Get updated company profiles, financial advice, global economy and technology news.'
    publisher             = 'Bloomberg L.P.'
    category              = 'Business, business news, stock market, stock market news, financial advice, company profiles, financial advice, global economy, technology news'
    oldest_article        = 7
    max_articles_per_feed = 200
    no_stylesheets        = True
    auto_cleanup = True
    encoding              = 'utf8'
    use_embedded_content  = False
    language              = 'en'
    remove_empty_feeds    = True
    publication_type      = 'magazine'
    cover_url             = 'http://images.businessweek.com/mz/covers/current_120x160.jpg'
    masthead_url          = 'http://assets.businessweek.com/images/bw-logo.png'
    extra_css             = """
                               body{font-family: Helvetica,Arial,sans-serif }
                               img{margin-bottom: 0.4em; display:block}
                               .tagline{color: gray; font-style: italic}
                               .photoCredit{font-size: small; color: gray}
                            """

    conversion_options = {
                          'comment'   : description
                        , 'tags'      : category
                        , 'publisher' : publisher
                        , 'language'  : language
                        }


    feeds = [
              (u'Top Stories', u'http://www.businessweek.com/feeds/most-popular.rss'),
            ]

    def print_version(self, url):
        soup = self.index_to_soup(url)
        prntver = soup.find('li', attrs={'class':'print tracked'})
        rurl = prntver.find('a', href=True)['href']
        return rurl


