Update Folha de Sao Paolo

This commit is contained in:
Kovid Goyal 2014-10-22 08:34:56 +05:30
parent 95b884612e
commit 5674dd141e
2 changed files with 28 additions and 60 deletions

View File

@ -49,30 +49,10 @@ class FolhaOnline(BasicNewsRecipe):
cover_margins = (0,0,'white')
masthead_url = 'http://f.i.uol.com.br/fsp/furniture/images/lgo-fsp-430x50-ffffff.gif'
keep_only_tags = [dict(name='div', attrs={'id':'articleNew'})]
remove_tags = [
dict(name='div',
attrs={'id':[
'articleButton'
,'bookmarklets'
,'ad-180x150-1'
,'contextualAdsArticle'
,'articleEnd'
,'articleComments'
]})
,dict(name='div',
attrs={'class':[
'openBox adslibraryArticle'
,'toolbar'
]})
,dict(name='a')
,dict(name='iframe')
,dict(name='link')
,dict(name='script')
,dict(name='li')
keep_only_tags = [
dict(name='div', attrs={'id':'articleNew'}),
dict(name='article', id='news'),
]
remove_tags_after = dict(name='div',attrs={'id':'articleEnd'})
feeds = [
(u'Em cima da hora', u'http://feeds.folha.uol.com.br/emcimadahora/rss091.xml')

View File

@ -26,17 +26,20 @@ class FSP(BasicNewsRecipe):
# remove_tags_before = dict(name='p')
# remove_tags_before = dict(name='div', id='articleNew')
# remove_tags_after = dict(name='div', id='articleNew')
keep_only_tags = [dict(name='div', id='articleNew'), dict(name='table', attrs={'class':'articleGraphic'})]
keep_only_tags = [
dict(name='div', id='articleNew'), dict(name='table', attrs={'class':'articleGraphic'}),
dict(name='article', id='news'),
]
publication_type = 'newspaper'
simultaneous_downloads = 5
# remove_tags = [dict(name='td', attrs={'align':'center'})]
remove_attributes = ['height','width']
# fixes the problem with the section names
section_dict = {'cotidian' : 'cotidiano', 'ilustrad': 'ilustrada', \
'quadrin': 'quadrinhos' , 'opiniao' : u'opini\xE3o', \
'ciencia' : u'ci\xeancia' , 'saude' : u'sa\xfade', \
'ribeirao' : u'ribeir\xE3o' , 'equilibrio' : u'equil\xedbrio', \
'imoveis' : u'im\xf3veis', 'negocios' : u'neg\xf3cios', \
section_dict = {'cotidian' : 'cotidiano', 'ilustrad': 'ilustrada',
'quadrin': 'quadrinhos' , 'opiniao' : u'opini\xE3o',
'ciencia' : u'ci\xeancia' , 'saude' : u'sa\xfade',
'ribeirao' : u'ribeir\xE3o' , 'equilibrio' : u'equil\xedbrio',
'imoveis' : u'im\xf3veis', 'negocios' : u'neg\xf3cios',
'veiculos' : u've\xedculos', 'corrida' : 'folha corrida'}
# this solves the problem with truncated content in Kindle
@ -89,21 +92,8 @@ img { background: none !important; float: none; margin: 0px; }
br['user'] = self.username
br['pass'] = self.password
br.submit().read()
## if 'Please try again' in raw:
## raise Exception('Your username and password are incorrect')
return br
# def postprocess_html(self, soup, first_fetch):
# #Clean-up normal articles
# tags = soup.findAll('div', id='articleNew')
# if tags and tags[0]:
# return tags[0]
# #Clean-up first page
# tags = soup.findAll('div', attrs={'class':'double_column facsimile'})
# if tags and tags[0]:
# return tags[0]
# return soup
def parse_index(self):
# Searching for the index page on the HOMEPAGE
# hpsoup = self.index_to_soup(self.HOMEPAGE)
@ -174,5 +164,3 @@ img { background: none !important; float: none; margin: 0px; }
# feeds.insert(0,(u'primeira p\xe1gina', [{'title':u'Primeira p\xe1gina' , 'url':minha_capa}]))
# feeds[0][1].insert(0,{'title':u'fac-s\xedmile da capa' , 'url':self.HOMEPAGE+self.FIRSTPAGE})
return feeds