Update The Scotsman

This commit is contained in:
Kovid Goyal 2013-08-02 16:35:54 +05:30
parent c92910ea6e
commit 3c777a8154

View File

@ -17,6 +17,7 @@ class TheScotsman(BasicNewsRecipe):
max_articles_per_feed = 100 max_articles_per_feed = 100
no_stylesheets = True no_stylesheets = True
use_embedded_content = False use_embedded_content = False
auto_cleanup = True
language = 'en_GB' language = 'en_GB'
encoding = 'utf-8' encoding = 'utf-8'
publication_type = 'newspaper' publication_type = 'newspaper'
@ -25,13 +26,13 @@ class TheScotsman(BasicNewsRecipe):
extra_css = 'body{font-family: Arial,Helvetica,sans-serif}' extra_css = 'body{font-family: Arial,Helvetica,sans-serif}'
keep_only_tags = [dict(attrs={'class':'editorialSection'})] #keep_only_tags = [dict(attrs={'class':'editorialSection'})]
remove_tags_after = dict(attrs={'class':'socialBookmarkPanel'}) #remove_tags_after = dict(attrs={'class':'socialBookmarkPanel'})
remove_tags = [ #remove_tags = [
dict(name=['meta','iframe','object','embed','link']), #dict(name=['meta','iframe','object','embed','link']),
dict(attrs={'class':['secondaryArticlesNav','socialBookmarkPanel']}), #dict(attrs={'class':['secondaryArticlesNav','socialBookmarkPanel']}),
dict(attrs={'id':'relatedArticles'}) #dict(attrs={'id':'relatedArticles'})
] #]
remove_attributes = ['lang'] remove_attributes = ['lang']
conversion_options = { conversion_options = {
@ -55,10 +56,10 @@ class TheScotsman(BasicNewsRecipe):
('Opinion' , 'http://www.scotsman.com/cmlink/1.957054' ) ('Opinion' , 'http://www.scotsman.com/cmlink/1.957054' )
] ]
def preprocess_html(self, soup): #def preprocess_html(self, soup):
for item in soup.findAll(style=True): #for item in soup.findAll(style=True):
del item['style'] #del item['style']
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