| 1 |
__license__ = 'GPL v3' |
| 2 |
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>' |
| 3 |
''' |
| 4 |
www.businessinsider.com |
| 5 |
''' |
| 6 |
|
| 7 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 8 |
|
| 9 |
|
| 10 |
class Business_insider(BasicNewsRecipe): |
| 11 |
title = 'Business Insider' |
| 12 |
__author__ = 'Darko Miletic' |
| 13 |
description = 'Noticias de Argentina y el resto del mundo' |
| 14 |
publisher = 'Business Insider, Inc.' |
| 15 |
category = 'news, politics, finances, world' |
| 16 |
oldest_article = 2 |
| 17 |
max_articles_per_feed = 200 |
| 18 |
no_stylesheets = True |
| 19 |
encoding = 'utf8' |
| 20 |
use_embedded_content = True |
| 21 |
language = 'en' |
| 22 |
remove_empty_feeds = True |
| 23 |
publication_type = 'newsportal' |
| 24 |
masthead_url = 'http://static.businessinsider.com/assets/images/logos/tbi_print.jpg' |
| 25 |
extra_css = ''' |
| 26 |
body{font-family: Arial,Helvetica,sans-serif } |
| 27 |
img{margin-bottom: 0.4em; display:block} |
| 28 |
''' |
| 29 |
|
| 30 |
conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language} |
| 31 |
|
| 32 |
remove_tags = [dict(name=['meta', 'link']), dict(attrs={'class': 'feedflare'})] |
| 33 |
remove_attributes = ['lang', 'border'] |
| 34 |
|
| 35 |
feeds = [ |
| 36 |
('Latest', 'http://feeds2.feedburner.com/businessinsider'), |
| 37 |
('Markets', 'http://feeds.feedburner.com/TheMoneyGame'), |
| 38 |
('Wall Street', 'http://feeds.feedburner.com/clusterstock'), |
| 39 |
('Tech', 'http://feeds.feedburner.com/typepad/alleyinsider/silicon_alley_insider'), |
| 40 |
('The Wire', 'http://feeds.feedburner.com/businessinsider/thewire'), |
| 41 |
('War Room', 'http://feeds.feedburner.com/businessinsider/warroom'), |
| 42 |
('Sports', 'http://feeds.feedburner.com/businessinsider/sportspage'), |
| 43 |
('Tools', 'http://feeds.feedburner.com/businessinsider/tools'), |
| 44 |
('Travel', 'http://feeds.feedburner.com/businessinsider/travel'), |
| 45 |
] |
| 46 |
|
| 47 |
def preprocess_html(self, soup): |
| 48 |
for item in soup.findAll(style=True): |
| 49 |
del item['style'] |
| 50 |
for item in soup.findAll('a'): |
| 51 |
if item['href'].startswith('http://feedads'): |
| 52 |
item.extract() |
| 53 |
elif item.string is not None: |
| 54 |
tstr = item.string |
| 55 |
item.replaceWith(tstr) |
| 56 |
for item in soup.findAll('img', alt=False): |
| 57 |
item['alt'] = 'image' |
| 58 |
return soup |