This commit is contained in:
Kovid Goyal 2012-05-18 10:19:12 +05:30
parent 86aebe0f15
commit 38380ac592

View File

@ -4,9 +4,8 @@ __copyright__ = '2008-2012, Darko Miletic <darko.miletic at gmail.com>'
arstechnica.com arstechnica.com
''' '''
import re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag from calibre.ebooks.BeautifulSoup import BeautifulSoup
class ArsTechnica(BasicNewsRecipe): class ArsTechnica(BasicNewsRecipe):
title = u'Ars Technica' title = u'Ars Technica'
@ -21,7 +20,7 @@ class ArsTechnica(BasicNewsRecipe):
encoding = 'utf-8' encoding = 'utf-8'
use_embedded_content = False use_embedded_content = False
remove_empty_feeds = True remove_empty_feeds = True
publication_type = 'newsportal' publication_type = 'newsportal'
extra_css = ''' extra_css = '''
body {font-family: Arial,sans-serif} body {font-family: Arial,sans-serif}
.heading{font-family: "Times New Roman",serif} .heading{font-family: "Times New Roman",serif}
@ -49,7 +48,7 @@ class ArsTechnica(BasicNewsRecipe):
] ]
remove_attributes = ['lang'] remove_attributes = ['lang']
feeds = [ feeds = [
(u'Infinite Loop (Apple content)' , u'http://feeds.arstechnica.com/arstechnica/apple/' ) (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'Opposable Thumbs (Gaming content)' , u'http://feeds.arstechnica.com/arstechnica/gaming/' )
@ -93,9 +92,9 @@ class ArsTechnica(BasicNewsRecipe):
item.replaceWith(str) item.replaceWith(str)
for item in soup.findAll('img'): for item in soup.findAll('img'):
if not item.has_key('alt'): if not item.has_key('alt'):
item['alt'] = 'image' item['alt'] = 'image'
return soup return soup
def preprocess_raw_html(self, raw, url): def preprocess_raw_html(self, raw, url):
return '<html><head>'+raw[raw.find('</head>'):] return '<html><head>'+raw[raw.find('</head>'):]