mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
pep8
This commit is contained in:
parent
836074e37d
commit
952b95d3ad
@ -4,9 +4,7 @@ sur.infonews.com
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from calibre import strftime
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import Tag
|
|
||||||
|
|
||||||
class MiradasAlSur(BasicNewsRecipe):
|
class MiradasAlSur(BasicNewsRecipe):
|
||||||
title = 'Miradas al Sur'
|
title = 'Miradas al Sur'
|
||||||
@ -25,7 +23,7 @@ class MiradasAlSur(BasicNewsRecipe):
|
|||||||
extra_css = """
|
extra_css = """
|
||||||
body{font-family: Arial,Helvetica,sans-serif}
|
body{font-family: Arial,Helvetica,sans-serif}
|
||||||
h1{font-family: Georgia,Times,serif}
|
h1{font-family: Georgia,Times,serif}
|
||||||
.field-field-story-author{color: gray; font-size: small}
|
.field-field-story-author{color: gray; font-size: small}
|
||||||
"""
|
"""
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
'comment' : description
|
'comment' : description
|
||||||
@ -34,22 +32,22 @@ class MiradasAlSur(BasicNewsRecipe):
|
|||||||
, 'language' : language
|
, 'language' : language
|
||||||
, 'series' : title
|
, 'series' : title
|
||||||
}
|
}
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'id':['content-header', 'content-area']})]
|
keep_only_tags = [dict(name='div', attrs={'id':['content-header', 'content-area']})]
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['link','meta','iframe','embed','object']),
|
dict(name=['link','meta','iframe','embed','object']),
|
||||||
dict(name='form', attrs={'class':'fivestar-widget'}),
|
dict(name='form', attrs={'class':'fivestar-widget'}),
|
||||||
dict(attrs={'class':lambda x: x and 'terms-inline' in x.split()})
|
dict(attrs={'class':lambda x: x and 'terms-inline' in x.split()})
|
||||||
]
|
]
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Politica' , u'http://sur.infonews.com/taxonomy/term/1/0/feed' ),
|
(u'Politica' , u'http://sur.infonews.com/taxonomy/term/1/0/feed'),
|
||||||
(u'Internacional' , u'http://sur.infonews.com/taxonomy/term/2/0/feed' ),
|
(u'Internacional' , u'http://sur.infonews.com/taxonomy/term/2/0/feed'),
|
||||||
(u'Informe Especial' , u'http://sur.infonews.com/taxonomy/term/14/0/feed'),
|
(u'Informe Especial' , u'http://sur.infonews.com/taxonomy/term/14/0/feed'),
|
||||||
(u'Delitos y pesquisas', u'http://sur.infonews.com/taxonomy/term/6/0/feed' ),
|
(u'Delitos y pesquisas', u'http://sur.infonews.com/taxonomy/term/6/0/feed'),
|
||||||
(u'Lesa Humanidad' , u'http://sur.infonews.com/taxonomy/term/7/0/feed' ),
|
(u'Lesa Humanidad' , u'http://sur.infonews.com/taxonomy/term/7/0/feed'),
|
||||||
(u'Cultura' , u'http://sur.infonews.com/taxonomy/term/8/0/feed' ),
|
(u'Cultura' , u'http://sur.infonews.com/taxonomy/term/8/0/feed'),
|
||||||
(u'Deportes' , u'http://sur.infonews.com/taxonomy/term/9/0/feed' ),
|
(u'Deportes' , u'http://sur.infonews.com/taxonomy/term/9/0/feed'),
|
||||||
(u'Contratapa' , u'http://sur.infonews.com/taxonomy/term/10/0/feed'),
|
(u'Contratapa' , u'http://sur.infonews.com/taxonomy/term/10/0/feed'),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -60,10 +58,10 @@ class MiradasAlSur(BasicNewsRecipe):
|
|||||||
cdate = datetime.date.today()
|
cdate = datetime.date.today()
|
||||||
todayweekday = cdate.isoweekday()
|
todayweekday = cdate.isoweekday()
|
||||||
if (todayweekday != 7):
|
if (todayweekday != 7):
|
||||||
cdate -= datetime.timedelta(days=todayweekday)
|
cdate -= datetime.timedelta(days=todayweekday)
|
||||||
cover_page_url = cdate.strftime('http://sur.infonews.com/ediciones/%Y-%m-%d/tapa');
|
cover_page_url = cdate.strftime('http://sur.infonews.com/ediciones/%Y-%m-%d/tapa')
|
||||||
soup = self.index_to_soup(cover_page_url)
|
soup = self.index_to_soup(cover_page_url)
|
||||||
cover_item = soup.find('img', attrs={'class':lambda x: x and 'imagecache-tapa_edicion_full' in x.split()})
|
cover_item = soup.find('img', attrs={'class':lambda x: x and 'imagecache-tapa_edicion_full' in x.split()})
|
||||||
if cover_item:
|
if cover_item:
|
||||||
cover_url = cover_item['src']
|
cover_url = cover_item['src']
|
||||||
return cover_url
|
return cover_url
|
||||||
|
Loading…
x
Reference in New Issue
Block a user