From 3e5a21ef421b4d9e13ae5b571454e874ff3df988 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Aug 2009 18:07:27 -0600 Subject: [PATCH] New recipe for Livemint by Darko Miletic --- src/calibre/gui2/images/news/livemint.png | Bin 0 -> 853 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_livemint.py | 43 ++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/livemint.png create mode 100644 src/calibre/web/feeds/recipes/recipe_livemint.py diff --git a/src/calibre/gui2/images/news/livemint.png b/src/calibre/gui2/images/news/livemint.png new file mode 100644 index 0000000000000000000000000000000000000000..5fb3cf7e89cf05bf079351c69c7fe0a9a5e22acf GIT binary patch literal 853 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87?|ojT^vI!PUlWOpB)k|bJYI(@#@O=GiQ1p zQ}H$M;{15s?d_qZCRdhf=*8^T2@zk%Dy}=DcSrb zIw9t4g7=Tz%n8~>729Rf@2e;T$RJN1UXMSxKHx1)9K4`f0~-L@4rj9v%6%H z^7Fa{@f@X+1&k#eXH*&we{N)MZ#kOkyE#@UDe>nUUbW}b%9$AY=I%cgE*{2d#r8h) z$h?&&yQ~5`N_VVyz{|U7s`Z(9JAV8W+xGSTX7xQ4CEPFnoGIDkc_+ZYw0mxJ;;#?o zCeQlb*)8*b+SQcxCC_HY8ebd1_g2rpi{+^93b|yp7nm$nOI#yLQW8s2t&)pUffR$0 zfq|v2frYM-X^5e@m8rRviHWX(nU#ToL~7zD6b-rgDVb@N2n{A+4aQccMi32&2k$xp PH86O(`njxgN@xNAauRZD literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index a214ca7fa6..7f9723063c 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -55,7 +55,7 @@ recipe_modules = ['recipe_' + r for r in ( 'eltiempo_hn', 'slate', 'tnxm', 'bbcvietnamese', 'vnexpress', 'volksrant', 'theeconomictimes_india', 'ourdailybread', 'monitor', 'republika', 'beta', 'beta_en', 'glasjavnosti', - 'esquire', + 'esquire', 'livemint', )] diff --git a/src/calibre/web/feeds/recipes/recipe_livemint.py b/src/calibre/web/feeds/recipes/recipe_livemint.py new file mode 100644 index 0000000000..5813233b86 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_livemint.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +www.livemint.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class LiveMint(BasicNewsRecipe): + title = u'Livemint' + __author__ = 'Darko Miletic' + description = 'The Wall Street Journal' + publisher = 'The Wall Street Journal' + category = 'news, games, adventure, technology' + language = _('English') + oldest_article = 15 + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + extra_css = ' #dvArtheadline{font-size: x-large} #dvArtAbstract{font-size: large} ' + + keep_only_tags = [dict(name='div', attrs={'class':'innercontent'})] + + remove_tags = [dict(name=['object','link','embed','form','iframe'])] + + feeds = [(u'Articles', u'http://www.livemint.com/SectionRssfeed.aspx?Mid=1')] + + def print_version(self, url): + link = url + try: + msoup = self.index_to_soup(link) + except: + return 'http://invalid_url_generated_by_calibre.com' + mlink = msoup.find(attrs={'id':'ctl00_bodyplaceholdercontent_cntlArtTool_printUrl'}) + if mlink: + link = 'http://www.livemint.com/Articles/' + mlink['href'].rpartition('/Articles/')[2] + return link + + def preprocess_html(self, soup): + return self.adeify_images(soup)