From 2bde6a326204e3fa94642f5f247815d5d5bc0882 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Aug 2009 20:20:51 -0600 Subject: [PATCH] New recipe for Esquire Magazine by Darko Miletic --- src/calibre/gui2/images/news/esquire.png | Bin 0 -> 439 bytes .../web/feeds/recipes/recipe_esquire.py | 62 ++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/calibre/gui2/images/news/esquire.png create mode 100644 src/calibre/web/feeds/recipes/recipe_esquire.py diff --git a/src/calibre/gui2/images/news/esquire.png b/src/calibre/gui2/images/news/esquire.png new file mode 100644 index 0000000000000000000000000000000000000000..56f71231a9f6516d3bc6b87461ce7cb843f2c514 GIT binary patch literal 439 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6n3BBRT^Rni_n+Ah2>S z4={E+nQaFWEGuwK2hw1@3^B*n9tLurc)B=-Xq=CoVCdECDAKZ@*YP5AM7M(BGJ!3g z>Jcp3r{^5J=62yyaz#VK)(L7|z6wv+!o&_9Qj0wxVmSZkyZLYaeNO0}dvmTi^Rb)X zFU}Ob_EN@U$!)*vCI5b9+H?8+S$9!5KX<2c({8^r8$ZPz5jeYXdhP08S~pFY+#MKH z9&umtZOMJ!`u~n~|K;BT(`~*Voq769+RH1Ov)V1D_vsey6_xoFvstog;_@GwT)#eR zp1)WccqHa`z>z1q7pFc^*7wYbQDo#;*&cXiU*^J{x+)5d=iIoe?_5xEX85I3k$#kM z`In53{5AS!552fqx3`2|ztPCxz49#>6 u%&ZIy3@#`c!ZhUOr(~v8Vrnq9GBmU@vVds#z?TmSdj?NeKbLh*2~7aT0;L52 literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/recipe_esquire.py b/src/calibre/web/feeds/recipes/recipe_esquire.py new file mode 100644 index 0000000000..366b2ddf96 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_esquire.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +www.esquire.com +''' + +from calibre import strftime +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag + +class Esquire(BasicNewsRecipe): + title = 'Esquire' + __author__ = 'Darko Miletic' + description = 'Esquire: Man at His Best' + publisher = 'Hearst Communications, Inc.' + category = 'magazine, men, women we love, style, the guide, sex, screen' + oldest_article = 30 + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'cp1250' + use_embedded_content = False + language = _('English') + lang = 'en-US' + cover_url = strftime('http://www.esquire.com/cm/esquire/cover-images/%Y_') + strftime('%m').strip('0') + '.jpg' + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : lang + , 'pretty_print' : True + } + + keep_only_tags = [dict(name='div', attrs={'id':'content'})] + + remove_tags = [dict(name=['object','link','embed','iframe'])] + + feeds = [ + (u'Style' , u'http://www.esquire.com/style/rss/' ) + ,(u'Women' , u'http://www.esquire.com/women/rss/' ) + ,(u'Features' , u'http://www.esquire.com/features/rss/' ) + ,(u'Fiction' , u'http://www.esquire.com/fiction/rss/' ) + ,(u'Frontpage', u'http://www.esquire.com/rss/' ) + ] + + + def print_version(self, url): + rest = url.rpartition('?')[0] + article = rest.rpartition('/')[2] + return 'http://www.esquire.com/print-this/' + article + + def preprocess_html(self, soup): + soup.html['xml:lang'] = self.lang + soup.html['lang'] = self.lang + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + soup.head.insert(0,mlang) + for item in soup.findAll(style=True): + del item['style'] + return soup