calibre/recipes/granma.recipe
Kovid Goyal 567040ee1e Perform PEP8 compliance checks on the entire codebase
Some bits of PEP 8 are turned off via setup.cfg
2016-07-29 21:25:17 +05:30

52 lines
1.6 KiB
Python

#!/usr/bin/env python2
__license__ = 'GPL v3'
__copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
'''
granma.cubaweb.cu
'''
from calibre.web.feeds.news import BasicNewsRecipe
class Granma(BasicNewsRecipe):
title = 'Diario Granma'
__author__ = 'Darko Miletic'
description = 'Organo oficial del Comite Central del Partido Comunista de Cuba'
publisher = 'Granma'
category = 'news, politics, Cuba'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'cp1252'
cover_url = 'http://www.granma.cubaweb.cu/imagenes/granweb229d.jpg'
language = 'es_CU'
remove_javascript = True
html2lrf_options = [
'--comment', description, '--category', category, '--publisher', publisher, '--ignore-tables'
]
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + \
description + '"\ntags="' + category + '"\nlinearize_tables=True'
keep_only_tags = [dict(name='table', attrs={'height': '466'})]
remove_tags = [dict(name=['embed', 'link', 'object'])]
feeds = [(u'Noticias', u'http://www.granma.cubaweb.cu/noticias.xml')]
def preprocess_html(self, soup):
mtag = '<meta http-equiv="Content-Language" content="es-CU"/>'
soup.head.insert(0, mtag)
for item in soup.findAll('table'):
if item.has_key('width'): # noqa
del item['width']
if item.has_key('height'): # noqa
del item['height']
for item in soup.findAll(style=True):
del item['style']
return soup