mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
68 lines
3.1 KiB
Plaintext
68 lines
3.1 KiB
Plaintext
__copyright__ = '2009-2013, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
sur.infonews.com
|
|
'''
|
|
|
|
import datetime
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
class MiradasAlSur(BasicNewsRecipe):
|
|
title = 'Miradas al Sur'
|
|
__author__ = 'Darko Miletic'
|
|
description = 'Semanario Argentino'
|
|
publisher = 'ElArgentino.com'
|
|
category = 'news, politics, Argentina'
|
|
oldest_article = 7
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
encoding = 'utf-8'
|
|
language = 'es_AR'
|
|
remove_empty_feeds = True
|
|
masthead_url = 'http://sur.infonews.com/sites/default/files/www_miradas_al_sur_com_logo.gif'
|
|
extra_css = """
|
|
body{font-family: Arial,Helvetica,sans-serif}
|
|
h1{font-family: Georgia,Times,serif}
|
|
.field-field-story-author{color: gray; font-size: small}
|
|
"""
|
|
conversion_options = {
|
|
'comment' : description
|
|
, 'tags' : category
|
|
, 'publisher' : publisher
|
|
, 'language' : language
|
|
, 'series' : title
|
|
}
|
|
|
|
keep_only_tags = [dict(name='div', attrs={'id':['content-header', 'content-area']})]
|
|
remove_tags = [
|
|
dict(name=['link','meta','iframe','embed','object']),
|
|
dict(name='form', attrs={'class':'fivestar-widget'}),
|
|
dict(attrs={'class':lambda x: x and 'terms-inline' in x.split()})
|
|
]
|
|
|
|
feeds = [
|
|
(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'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'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'Deportes' , u'http://sur.infonews.com/taxonomy/term/9/0/feed'),
|
|
(u'Contratapa' , u'http://sur.infonews.com/taxonomy/term/10/0/feed'),
|
|
]
|
|
|
|
def get_cover_url(self):
|
|
# determine the series number, unfortunately not gonna happen now
|
|
#self.conversion_options.update({'series_index':seriesnr})
|
|
cover_url = None
|
|
cdate = datetime.date.today()
|
|
todayweekday = cdate.isoweekday()
|
|
if (todayweekday != 7):
|
|
cdate -= datetime.timedelta(days=todayweekday)
|
|
cover_page_url = cdate.strftime('http://sur.infonews.com/ediciones/%Y-%m-%d/tapa')
|
|
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()})
|
|
if cover_item:
|
|
cover_url = cover_item['src']
|
|
return cover_url
|