From a8bf1d329ec311c9d938a0a99db650596e3e7379 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 11 Oct 2009 20:26:59 -0600 Subject: [PATCH] New recipe For Business World India by Darko Miletic --- resources/images/news/businessworldin.png | Bin 0 -> 444 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../feeds/recipes/recipe_businessworldin.py | 77 ++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 resources/images/news/businessworldin.png create mode 100644 src/calibre/web/feeds/recipes/recipe_businessworldin.py diff --git a/resources/images/news/businessworldin.png b/resources/images/news/businessworldin.png new file mode 100644 index 0000000000000000000000000000000000000000..4dd8612fd2543c53b25e9cda89d9f3206839e5cd GIT binary patch literal 444 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*VRoTr{Hjv*GOmj*lLu^4g`fA{_;{9CO;c+W}O z35jaE?|NNUQgrI*G2{}O;PKaVk+9d2Esp|iKA$gLGV_Vuymyms^0K`PdUf|s{fj+C z^DKp4yqk0>HuD<8OmmY62BX(WdR~8)oD6N|W}c~i@;49LgRC^K^TKCx9vPgwvUrt2 zSZmh{WzHkQp;y0$GIXBKzGD1gnPZ+*#C-nv*ynvYY%FGC$u7o9w^s)+cr03U-}Z-7 zcbbBDN+R?6j+KH}_olsHZx(H_ZBg!?80|bZ!Q~C^JsE7q$L!R^o&S6{uj{2OC7#SE?>KYp88XATe8CV$^S{WPZ x8kkub80^>55<}6Do1c=IR*9^^(A>(%!phVHqG8(kWpO|a44$rjF6*2UngH;#pDzFa literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index b753886fc7..fe8ae80997 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -59,7 +59,7 @@ recipe_modules = ['recipe_' + r for r in ( 'intelligencer', 'theoldfoodie', 'hln_be', 'honvedelem', 'the_new_republic', 'philly', 'salon', 'tweakers', 'smashing', 'thestar', 'business_standard', 'lemonde_dip', 'javalobby', - 'serverside', 'infoworld', 'sanjosemercurynews', + 'serverside', 'infoworld', 'sanjosemercurynews', 'businessworldin', )] diff --git a/src/calibre/web/feeds/recipes/recipe_businessworldin.py b/src/calibre/web/feeds/recipes/recipe_businessworldin.py new file mode 100644 index 0000000000..99d56e850f --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_businessworldin.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +www.businessworld.in +''' + +from calibre import strftime +from calibre.web.feeds.news import BasicNewsRecipe + +class BusinessWorldMagazine(BasicNewsRecipe): + title = 'Business World Magazine' + __author__ = 'Darko Miletic' + description = 'News from India' + publisher = 'ABP Pvt Ltd Publication' + category = 'news, politics, finances, India, Asia' + delay = 1 + no_stylesheets = True + INDEX = 'http://www.businessworld.in/bw/Magazine_Current_Issue' + ROOT = 'http://www.businessworld.in' + use_embedded_content = False + encoding = 'utf-8' + language = 'en_IN' + + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + } + + def is_in_list(self,linklist,url): + for litem in linklist: + if litem == url: + return True + return False + + + def parse_index(self): + articles = [] + linklist = [] + soup = self.index_to_soup(self.INDEX) + + for item in soup.findAll('div', attrs={'class':'nametitle'}): + description = '' + title_prefix = '' + feed_link = item.find('a') + if feed_link and feed_link.has_key('href'): + url = self.ROOT + feed_link['href'] + if not self.is_in_list(linklist,url): + title = title_prefix + self.tag_to_string(feed_link) + date = strftime(self.timefmt) + articles.append({ + 'title' :title + ,'date' :date + ,'url' :url + ,'description':description + }) + linklist.append(url) + return [(soup.head.title.string, articles)] + + + keep_only_tags = [dict(name='div', attrs={'id':['register-panel','printwrapper']})] + remove_tags = [dict(name=['object','link'])] + + def print_version(self, url): + return url.replace('/bw/','/bw/storyContent/') + + def get_cover_url(self): + cover_url = None + soup = self.index_to_soup(self.INDEX) + cover_item = soup.find('img',attrs={'class':'toughbor'}) + if cover_item: + cover_url = self.ROOT + cover_item['src'] + return cover_url