From e904b4d6203a48d19f194cd2d7db87f054b05edd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 13 May 2011 14:04:46 -0600 Subject: [PATCH] Financial Sense by DM. Fixes #782368 (New recipe for financial sense) --- recipes/financialsense.recipe | 64 +++++++++++++++++++++++++++++++ recipes/icons/financialsense.png | Bin 0 -> 702 bytes 2 files changed, 64 insertions(+) create mode 100644 recipes/financialsense.recipe create mode 100644 recipes/icons/financialsense.png diff --git a/recipes/financialsense.recipe b/recipes/financialsense.recipe new file mode 100644 index 0000000000..4224396edf --- /dev/null +++ b/recipes/financialsense.recipe @@ -0,0 +1,64 @@ +__license__ = 'GPL v3' +__copyright__ = '2011, Darko Miletic ' +''' +www.financialsense.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class FinancialSense(BasicNewsRecipe): + title = 'Financial Sense' + __author__ = 'Darko Miletic' + description = 'Uncommon News & Views for the Wise Investor' + publisher = 'Financial Sense' + category = 'news, finances, politics, USA' + oldest_article = 2 + max_articles_per_feed = 200 + no_stylesheets = True + encoding = 'utf8' + use_embedded_content = False + language = 'en' + remove_empty_feeds = True + publication_type = 'newsportal' + masthead_url = 'http://www.financialsense.com/sites/default/files/logo.jpg' + extra_css = """ + body{font-family: Arial,"Helvetica Neue",Helvetica,sans-serif } + img{margin-bottom: 0.4em; display:block} + h2{color: gray} + .name{margin-right: 5em} + """ + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + } + + remove_tags =[dict(name=['meta','link','base','object','embed','iframe'])] + remove_tags_after=dict(attrs={'class':'vcard'}) + keep_only_tags =[dict(attrs={'class':['title','post-meta','content','item-title','vcard']})] + remove_attributes=['lang','type'] + + + feeds = [(u'Articles', u'http://feeds.feedburner.com/fso')] + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + for item in soup.findAll('a'): + limg = item.find('img') + if item.string is not None: + str = item.string + item.replaceWith(str) + else: + if limg: + item.name = 'div' + item.attrs = [] + else: + str = self.tag_to_string(item) + item.replaceWith(str) + for item in soup.findAll('img'): + if not item.has_key('alt'): + item['alt'] = 'image' + return soup diff --git a/recipes/icons/financialsense.png b/recipes/icons/financialsense.png new file mode 100644 index 0000000000000000000000000000000000000000..5f02e7770a6449fda934c53765ccdf700afeef48 GIT binary patch literal 702 zcmV;v0zv(WP)k<3|tKn7%%Fc>DM7pW@<@4<0^JR@G!@ z=Y0D7t&yn>!iK+p|9t=U^~d*b7mlxHVd2o!HQ&Ael%l4sw35NQ&wpl2YJB$WIf@Pc z{{HD`$dOY}v~-DieDlcMIdfL6-^(l5(uY^~S@<-$S$}W~DPK9a2dEnAq&Kf$efsj_KZo?e zt&Gc{4i85|J6nqn-~PY< z_;t&ki*H^%MoAj`_U?XgaiyA}mxQdEii*yPcj+Hm#i-7+J){&HMN7UnV9d zgocOrZ}9PQv#@d=J-k;zR^->uAMf6OF*39J^Pf#nP>7L{5k2t%lL#Xt$c4Xu|7K-n k1-kRor%wU`0%&O&0LdpR