Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 103 lines (93 sloc) 4.976 kB
695b7ea Initial commit based on calibre 0.8.12
tom authored
1 __license__ = 'GPL v3'
2 __copyright__ = '2008 Kovid Goyal kovid@kovidgoyal.net, 2010 Darko Miletic <darko.miletic at gmail.com>'
3 '''
4 www.businessweek.com
5 '''
6
7 from calibre.web.feeds.news import BasicNewsRecipe
8
9 class BusinessWeek(BasicNewsRecipe):
10 title = 'Business Week'
11 __author__ = 'Kovid Goyal and Darko Miletic'
12 description = 'Read the latest international business news & stock market news. Get updated company profiles, financial advice, global economy and technology news.'
13 publisher = 'Bloomberg L.P.'
14 category = 'Business, business news, stock market, stock market news, financial advice, company profiles, financial advice, global economy, technology news'
c784c8c Updated to calibre 0.8.36
Tom authored
15 oldest_article = 7
16 max_articles_per_feed = 200
695b7ea Initial commit based on calibre 0.8.12
tom authored
17 no_stylesheets = True
18 encoding = 'utf8'
19 use_embedded_content = False
20 language = 'en'
21 remove_empty_feeds = True
22 publication_type = 'magazine'
23 cover_url = 'http://images.businessweek.com/mz/covers/current_120x160.jpg'
24 masthead_url = 'http://assets.businessweek.com/images/bw-logo.png'
25 extra_css = """
26 body{font-family: Helvetica,Arial,sans-serif }
27 img{margin-bottom: 0.4em; display:block}
28 .tagline{color: gray; font-style: italic}
29 .photoCredit{font-size: small; color: gray}
30 """
31
32 conversion_options = {
33 'comment' : description
34 , 'tags' : category
35 , 'publisher' : publisher
36 , 'language' : language
37 }
38
39 remove_tags = [
40 dict(attrs={'class':'inStory'})
41 ,dict(name=['meta','link','iframe','base','embed','object','table','th','tr','td'])
42 ,dict(attrs={'id':['inset','videoDisplay']})
43 ]
44 keep_only_tags = [dict(name='div', attrs={'id':['story-body','storyBody']})]
45 remove_attributes = ['lang']
46 match_regexps = [r'http://www.businessweek.com/.*_page_[1-9].*']
47
48
49 feeds = [
50 (u'Top Stories', u'http://www.businessweek.com/topStories/rss/topStories.rss'),
51 (u'Top News' , u'http://www.businessweek.com/rss/bwdaily.rss' ),
52 (u'Asia', u'http://www.businessweek.com/rss/asia.rss'),
53 (u'Autos', u'http://www.businessweek.com/rss/autos/index.rss'),
54 (u'Classic Cars', u'http://rss.businessweek.com/bw_rss/classiccars'),
55 (u'Hybrids', u'http://rss.businessweek.com/bw_rss/hybrids'),
56 (u'Europe', u'http://www.businessweek.com/rss/europe.rss'),
57 (u'Auto Reviews', u'http://rss.businessweek.com/bw_rss/autoreviews'),
58 (u'Innovation & Design', u'http://www.businessweek.com/rss/innovate.rss'),
59 (u'Architecture', u'http://www.businessweek.com/rss/architecture.rss'),
60 (u'Brand Equity', u'http://www.businessweek.com/rss/brandequity.rss'),
61 (u'Auto Design', u'http://www.businessweek.com/rss/carbuff.rss'),
62 (u'Game Room', u'http://rss.businessweek.com/bw_rss/gameroom'),
63 (u'Technology', u'http://www.businessweek.com/rss/technology.rss'),
64 (u'Investing', u'http://rss.businessweek.com/bw_rss/investor'),
65 (u'Small Business', u'http://www.businessweek.com/rss/smallbiz.rss'),
66 (u'Careers', u'http://rss.businessweek.com/bw_rss/careers'),
67 (u'B-Schools', u'http://www.businessweek.com/rss/bschools.rss'),
68 (u'Magazine Selections', u'http://www.businessweek.com/rss/magazine.rss'),
69 (u'CEO Guide to Tech', u'http://www.businessweek.com/rss/ceo_guide_tech.rss'),
70 ]
71
72 def get_article_url(self, article):
73 url = article.get('guid', None)
74 if 'podcasts' in url:
75 return None
76 if 'surveys' in url:
77 return None
78 if 'images' in url:
79 return None
80 if 'feedroom' in url:
81 return None
82 if '/magazine/toc/' in url:
83 return None
84 rurl, sep, rest = url.rpartition('?')
85 if rurl:
86 return rurl
87 return rest
88
89 def print_version(self, url):
90 if '/news/' in url or '/blog/ in url':
91 return url
92 rurl = url.replace('http://www.businessweek.com/','http://www.businessweek.com/print/')
93 return rurl.replace('/investing/','/investor/')
94
95 def preprocess_html(self, soup):
96 for item in soup.findAll(style=True):
97 del item['style']
98 for alink in soup.findAll('a'):
99 if alink.string is not None:
100 tstr = alink.string
101 alink.replaceWith(tstr)
102 return soup
Something went wrong with that request. Please try again.