From 92eff808a1b16d5a10541cacda291a41926a7b13 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Jan 2009 10:12:13 -0800 Subject: [PATCH] Recipe for The American Spectator by Darko Miletic --- src/calibre/gui2/images/news/amspec.png | Bin 0 -> 834 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_amspec.py | 53 ++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/amspec.png create mode 100644 src/calibre/web/feeds/recipes/recipe_amspec.py diff --git a/src/calibre/gui2/images/news/amspec.png b/src/calibre/gui2/images/news/amspec.png new file mode 100644 index 0000000000000000000000000000000000000000..9c0d13f4197e6e573cb392fb57a01096058ca140 GIT binary patch literal 834 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87?`p>T^vI!PWMiZ_7G+eX|pdc&NiNVcFyc& zmfMB&TUTn7EnLAf`I3rakH;G(w~Nj!Zcd6ehJt(taGLGPT)uY>Ud!NwMsV7(5Y|^sqtn6o> zzL$TgWB=Z@b1lD%9Ew@^&R;_dHY8Q2vg+qrk^T+>eJ z%G!-h8};|f{7-RFnY?aABSS)MoZhM@Ds?6M)E_=zR5HFa@r0DRjx44GFN$>jQ($%;VLWUZ(bZyuh-{ieV=_pm_lvY+~6GiipTRvBQh zZe1xk|N7|#7msYY+^MELdBO~dFYR0mVm&I8JUh?dZZ}h(Z9X;pqPVDl(AuLl>jfXL zm2%o5r4$roaP`W=QeT0+$=dVZ-#PmJvu?%)3m>M99b1aiH`rw+?zt}Zftm5}m;FC@ zgS8%5-tUVj0j5FK64!{5bP0l+XkK+;CGp literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 2b5652260d..71c4b71483 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -23,7 +23,7 @@ recipe_modules = ['recipe_' + r for r in ( 'spiegel_int', 'themarketticker', 'tomshardware', 'xkcd', 'ftd', 'zdnet', 'joelonsoftware', 'telepolis', 'common_dreams', 'nin', 'tomshardware_de', 'pagina12', 'infobae', 'ambito', 'elargentino', 'sueddeutsche', 'the_age', - 'laprensa', + 'laprensa', 'amspec', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_amspec.py b/src/calibre/web/feeds/recipes/recipe_amspec.py new file mode 100644 index 0000000000..b01fadee77 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_amspec.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +spectator.org +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class TheAmericanSpectator(BasicNewsRecipe): + title = 'The American Spectator' + __author__ = 'Darko Miletic' + description = 'news from USA' + oldest_article = 7 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + INDEX = 'http://spectator.org' + + html2lrf_options = [ + '--comment' , description + , '--category' , 'news, politics, USA' + , '--publisher' , title + ] + + keep_only_tags = [ + dict(name='div', attrs={'class':'post inner'}) + ,dict(name='div', attrs={'class':'author-bio'}) + ] + + remove_tags = [ + dict(name='object') + ,dict(name='div', attrs={'class':'col3' }) + ,dict(name='div', attrs={'class':'post-options' }) + ,dict(name='p' , attrs={'class':'letter-editor'}) + ,dict(name='div', attrs={'class':'social' }) + ] + + feeds = [ (u'Articles', u'http://feedproxy.google.com/amspecarticles')] + + def get_cover_url(self): + cover_url = None + soup = self.index_to_soup(self.INDEX) + link_item = soup.find('a',attrs={'class':'cover'}) + if link_item: + soup2 = self.index_to_soup(link_item['href']) + link_item2 = soup2.find('div',attrs={'class':'post inner issues'}) + cover_url = self.INDEX + link_item2.img['src'] + return cover_url + + def print_version(self, url): + return url + '/print'