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
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
__license__ = 'GPL v3'
__copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
'''
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'
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
extra_css = """
body {
font: normal 19px/180% Times, serif;
}
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']})]
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')]
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,'<br /><br />')
for item in soup.findAll(style=True):
del item['style']
return soup