Updated Ars Technica recipe

This commit is contained in:
Kovid Goyal 2009-02-11 14:50:27 -08:00
parent 2a3fe21cf7
commit b7ca8da79d

View File

@ -1,50 +1,60 @@
#!/usr/bin/env python #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __license__ = 'GPL v3'
__docformat__ = 'restructuredtext en' __copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
'''
''' arstechnica.com
arstechnica.com '''
'''
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.web.feeds.news import BasicNewsRecipe
class ArsTechnica2(BasicNewsRecipe):
class ArsTechnica(BasicNewsRecipe): title = u'Ars Technica'
title = 'Ars Technica' language = _('English')
description = 'The art of technology' __author__ = 'Darko Miletic'
oldest_article = 7 description = 'The art of technology'
language = _('English') publisher = 'Ars Technica'
no_stylesheets = True category = 'news, IT, technology'
__author__ = 'Michael Warner' language = _('English')
max_articles_per_feed = 100 oldest_article = 2
extra_css = """ max_articles_per_feed = 100
body { no_stylesheets = True
font: normal 19px/180% Times, serif; encoding = 'utf8'
} remove_javascript = True
use_embedded_content = False
h1, h2, h3, h4 {
font: bold 28px/100% Verdana, Arial, Helvetica, sans-serif; html2lrf_options = [
margin-top: 19px '--comment', description
} , '--category', category
""" , '--publisher', publisher
remove_tags = [ ]
dict(id="Masthead"),
dict(id="Banner"), html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
dict(id="Nav"),
dict(name='div', attrs={'class':'ContentHeader'}), keep_only_tags = [dict(name='div', attrs={'id':['news-item-info','news-item']})]
dict(name='img'),
dict(name='div', attrs={'class':'Inset RelatedStories'}), remove_tags = [
dict(name='div', attrs={'class':'Tags'}), dict(name=['object','link','embed'])
dict(name='div', attrs={'class':'PostOptions flat'}), ,dict(name='div', attrs={'class':'related-stories'})
dict(name='div', attrs={'class':'ContentFooter'}), ]
dict(id="Sidebar"),
dict(id="LatestPosts"),
dict(id="Footer")] feeds = [
feeds = [(u'News and Features', u'http://feeds.arstechnica.com/arstechnica/BAaf'), (u'Infinite Loop (Apple content)' , u'http://feeds.arstechnica.com/arstechnica/apple/' )
(u'Nobel Intent (Science)', u'http://arstechnica.com/journals/science.rssx'), ,(u'Opposable Thumbs (Gaming content)' , u'http://feeds.arstechnica.com/arstechnica/gaming/' )
(u'Infinite Loop (Apple)', u'http://arstechnica.com/journals/apple.rssx'), ,(u'Gear and Gadgets' , u'http://feeds.arstechnica.com/arstechnica/gadgets/' )
(u'M-Dollar (Microsoft)', u'http://arstechnica.com/journals/microsoft.rssx'), ,(u'Chipster (Hardware content)' , u'http://feeds.arstechnica.com/arstechnica/hardware/' )
(u'Open Ended (Linux)', u'http://arstechnica.com/journals/linux.rssx'), ,(u'Uptime (IT content)' , u'http://feeds.arstechnica.com/arstechnica/business/' )
(u'Opposable Thumbs (Games)', u'http://arstechnica.com/journals/thumbs.rssx'), ,(u'Open Ended (Open Source content)' , u'http://feeds.arstechnica.com/arstechnica/open-source/')
(u'Kit (Hardware)', u'http://arstechnica.com/journals/hardware.rssx'), ,(u'One Microsoft Way' , u'http://feeds.arstechnica.com/arstechnica/microsoft/' )
(u'Journals', u'http://arstechnica.com/journals.rssx')] ,(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,'<br /><br />')
for item in soup.findAll(style=True):
del item['style']
return soup