IGN:Fix #3254 (Updated recipes)

This commit is contained in:
Kovid Goyal 2009-08-22 15:48:23 -06:00
parent 94e30d312c
commit 65fbf9f343
2 changed files with 22 additions and 11 deletions

View File

@ -39,7 +39,7 @@ class GlasJavnosti(BasicNewsRecipe):
,dict(name='div', attrs={'class':'node' }) ,dict(name='div', attrs={'class':'node' })
] ]
remove_tags = [ remove_tags = [
dict(name=['object','link']) dict(name=['object','link','img'])
,dict(name='div',attrs={'class':['links','meta']}) ,dict(name='div',attrs={'class':['links','meta']})
,dict(name='div',attrs={'id':'block-block-12'}) ,dict(name='div',attrs={'id':'block-block-12'})
] ]
@ -74,7 +74,5 @@ class GlasJavnosti(BasicNewsRecipe):
,(u'Konjske Snage', u'http://www.glas-javnosti.rs/aktuelni-clanci/46') ,(u'Konjske Snage', u'http://www.glas-javnosti.rs/aktuelni-clanci/46')
] ]
def preprocess_html(self, soup): remove_attributes = ['style','width','height','font','border','align']
for item in soup.findAll(style=True):
del item['style']
return self.adeify_images(soup)

View File

@ -26,7 +26,7 @@ class MonitorCG(BasicNewsRecipe):
lang ='sr-Latn-Me' lang ='sr-Latn-Me'
INDEX = 'http://www.monitorcg.com' INDEX = 'http://www.monitorcg.com'
extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} body{font-family: serif1, serif} .article_description{font-family: sans1, sans-serif}' extra_css = ' @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{font-family: serif1, serif} '
conversion_options = { conversion_options = {
'comment' : description 'comment' : description
@ -42,15 +42,28 @@ class MonitorCG(BasicNewsRecipe):
remove_tags = [ dict(name=['object','link','embed']) remove_tags = [ dict(name=['object','link','embed'])
, dict(attrs={'class':['buttonheading','article-section']})] , dict(attrs={'class':['buttonheading','article-section']})]
remove_attributes = ['style','width','height','font','border','align']
def adeify_images2(cls, soup):
for item in soup.findAll('img'):
for attrib in ['height','width','border','align','style']:
if item.has_key(attrib):
del item[attrib]
oldParent = item.parent
if oldParent.name == 'a':
oldParent.name == 'p'
myIndex = oldParent.contents.index(item)
brtag = Tag(soup,'br')
oldParent.insert(myIndex+1,brtag)
return soup
def preprocess_html(self, soup): def preprocess_html(self, soup):
soup.html['xml:lang'] = self.lang soup.html['xml:lang'] = self.lang
soup.html['lang'] = self.lang soup.html['lang'] = self.lang
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")]) soup.html.insert(0,mlang)
soup.head.insert(0,mlang) return self.adeify_images2(soup)
soup.head.insert(1,mcharset)
return self.adeify_images(soup)
def parse_index(self): def parse_index(self):
totalfeeds = [] totalfeeds = []