diff --git a/src/calibre/web/feeds/recipes/recipe_ars_technica.py b/src/calibre/web/feeds/recipes/recipe_ars_technica.py index 1360c6aa47..eb4e3f54f4 100644 --- a/src/calibre/web/feeds/recipes/recipe_ars_technica.py +++ b/src/calibre/web/feeds/recipes/recipe_ars_technica.py @@ -1,50 +1,60 @@ -#!/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 - language = _('English') - 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')] +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2008-2009, Darko Miletic ' +''' +arstechnica.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class ArsTechnica2(BasicNewsRecipe): + title = u'Ars Technica' + language = _('English') + __author__ = 'Darko Miletic' + description = 'The art of technology' + publisher = 'Ars Technica' + category = 'news, IT, technology' + language = _('English') + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'utf8' + remove_javascript = True + use_embedded_content = False + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' + + keep_only_tags = [dict(name='div', attrs={'id':['news-item-info','news-item']})] + + remove_tags = [ + dict(name=['object','link','embed']) + ,dict(name='div', attrs={'class':'related-stories'}) + ] + + + feeds = [ + (u'Infinite Loop (Apple content)' , u'http://feeds.arstechnica.com/arstechnica/apple/' ) + ,(u'Opposable Thumbs (Gaming content)' , u'http://feeds.arstechnica.com/arstechnica/gaming/' ) + ,(u'Gear and Gadgets' , u'http://feeds.arstechnica.com/arstechnica/gadgets/' ) + ,(u'Chipster (Hardware content)' , u'http://feeds.arstechnica.com/arstechnica/hardware/' ) + ,(u'Uptime (IT content)' , u'http://feeds.arstechnica.com/arstechnica/business/' ) + ,(u'Open Ended (Open Source content)' , u'http://feeds.arstechnica.com/arstechnica/open-source/') + ,(u'One Microsoft Way' , u'http://feeds.arstechnica.com/arstechnica/microsoft/' ) + ,(u'Nobel Intent (Science content)' , u'http://feeds.arstechnica.com/arstechnica/science/' ) + ,(u'Law & Disorder (Tech policy content)' , u'http://feeds.arstechnica.com/arstechnica/tech-policy/') + ] + + def preprocess_html(self, soup): + ftag = soup.find('div', attrs={'class':'news-item-byline'}) + if ftag: + ftag.insert(4,'

') + for item in soup.findAll(style=True): + del item['style'] + return soup