From e2810c4b501a18d357558964eacd5c56ed84987c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 1 Jun 2008 21:30:09 -0700 Subject: [PATCH] Added recipe for Ars Technica (thanks to Michael Warner) --- src/calibre/gui2/images/news/ars_technica.png | Bin 0 -> 659 bytes src/calibre/utils/sftp.py | 4 +- src/calibre/web/feeds/recipes/__init__.py | 1 + src/calibre/web/feeds/recipes/ars_technica.py | 49 ++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/calibre/gui2/images/news/ars_technica.png create mode 100644 src/calibre/web/feeds/recipes/ars_technica.py diff --git a/src/calibre/gui2/images/news/ars_technica.png b/src/calibre/gui2/images/news/ars_technica.png new file mode 100644 index 0000000000000000000000000000000000000000..da88e464dc0cfa90d58a37daf5edee39362c011f GIT binary patch literal 659 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87#R0>x;TbdoL)QGFhe*|R2s*FikO-J={^luW7gJ5~sE%=k_MQrr>i6`5JEpT;VI-8RyaN zw2)o)Qcd~%!|uhrWgZ8%*UJC@e((SP`uCh`w?2zX3G|REJ=tda<)$FRq6oKpbq%6A z%FV}0Egr3E@JkBW-)wcG=_9LoTkwH(TQ|JUZF&BjwM5AH-@j>J3fdzNtuiT;+v`+e zC*<(e+E|@=NxSumI(CMct_v61rmtw$-K62NEU zfA{w8{*`%(J6h!Qi^;a1rBv@k-8A^(SMSGo_v(3$_j*>6PrO5Pl=b%Sy_WU9_TS5& zFI3#7t@!PFXw!o^PkB^{=__2QwDcnq^g#ZSk* z1|tIl3ta;mdK II;Vst09hRm{Qv*} literal 0 HcmV?d00001 diff --git a/src/calibre/utils/sftp.py b/src/calibre/utils/sftp.py index 49613991b3..84f38f3f4b 100644 --- a/src/calibre/utils/sftp.py +++ b/src/calibre/utils/sftp.py @@ -68,7 +68,7 @@ def connect_to_url(url, getpw=portable_getpass, mode='r+', bufsize=-1): raise Exception(_('Failed to negotiate SSH session: ') + str(t.get_exception())) if not agent_auth(t, username): if not password_auth(t, username, host, getpw): - raise ValueError(_('Failed to authenticate with server: %s'%url)) + raise ValueError(_('Failed to authenticate with server: %s')%url) sftp = paramiko.SFTPClient.from_transport(t) return sftp, sftp.open(path, mode=mode, bufsize=bufsize) @@ -82,4 +82,4 @@ def main(args=sys.argv): return 0 if __name__ == '__main__': - sys.exit(main()) \ No newline at end of file + sys.exit(main()) diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index ccb73215ee..6939c0a8ce 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -8,6 +8,7 @@ recipes = [ 'newsweek', 'atlantic', 'economist', 'portfolio', 'nytimes', 'usatoday', 'outlook_india', 'bbc', 'greader', 'wsj', 'wired', 'globe_and_mail', 'smh', 'espn', 'business_week', + 'ars_technica', ] import re, imp, inspect, time diff --git a/src/calibre/web/feeds/recipes/ars_technica.py b/src/calibre/web/feeds/recipes/ars_technica.py new file mode 100644 index 0000000000..b7c25e497a --- /dev/null +++ b/src/calibre/web/feeds/recipes/ars_technica.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +__license__ = 'GPL v3' +__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' +__docformat__ = 'restructuredtext en' + +''' +arstechnica.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class ArsTechnica(BasicNewsRecipe): + title = 'Ars Technica' + description = 'The art of technology' + oldest_article = 7 + no_stylesheets = True + __author__ = 'Michael Warner' + max_articles_per_feed = 100 + extra_css = """ +body { + font: normal 19px/180% Times, serif; +} + +h1, h2, h3, h4 { + font: bold 28px/100% Verdana, Arial, Helvetica, sans-serif; + margin-top: 19px +} +""" + remove_tags = [ + dict(id="Masthead"), + dict(id="Banner"), + dict(id="Nav"), + dict(name='div', attrs={'class':'ContentHeader'}), + dict(name='img'), + dict(name='div', attrs={'class':'Inset RelatedStories'}), + dict(name='div', attrs={'class':'Tags'}), + dict(name='div', attrs={'class':'PostOptions flat'}), + dict(name='div', attrs={'class':'ContentFooter'}), + dict(id="Sidebar"), + dict(id="LatestPosts"), + dict(id="Footer")] + feeds = [(u'News and Features', u'http://feeds.arstechnica.com/arstechnica/BAaf'), + (u'Nobel Intent (Science)', u'http://arstechnica.com/journals/science.rssx'), + (u'Infinite Loop (Apple)', u'http://arstechnica.com/journals/apple.rssx'), + (u'M-Dollar (Microsoft)', u'http://arstechnica.com/journals/microsoft.rssx'), + (u'Open Ended (Linux)', u'http://arstechnica.com/journals/linux.rssx'), + (u'Opposable Thumbs (Games)', u'http://arstechnica.com/journals/thumbs.rssx'), + (u'Kit (Hardware)', u'http://arstechnica.com/journals/hardware.rssx'), + (u'Journals', u'http://arstechnica.com/journals.rssx')]