calibre/recipes/the_workingham_times.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

58 lines
1.9 KiB
Plaintext

__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
www.getwokingham.co.uk
'''
from calibre.web.feeds.recipes import BasicNewsRecipe
class TheWokinghamTimes(BasicNewsRecipe):
title = 'The Wokingham Times'
__author__ = 'Darko Miletic'
description = 'News from UK'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'utf8'
publisher = 'The Wokingham Times - S&B media'
category = 'news, UK, world'
language = 'en_GB'
publication_type = 'newsportal'
extra_css = """
body{ font-family: Arial,sans-serif }
img{display: block; margin-bottom: 0.4em}
"""
conversion_options = {
'comments': description, 'tags': category, 'language': language, 'publisher': publisher
}
keep_only_tags = [dict(name='div', attrs={'id': 'article-body'})]
remove_tags = [
dict(name='div', attrs={'class': ['ad']}), dict(name=[
'meta', 'base', 'iframe', 'embed', 'object']), dict(name='span', attrs={'class': 'caption small'})
]
remove_attributes = ['width', 'height', 'lang']
feeds = [
('Home', 'http://www.getwokingham.co.uk/rss.xml'),
('News', 'http://www.getwokingham.co.uk/news/rss.xml'),
('Entertainment', 'http://www.getwokingham.co.uk/entertainment/rss.xml'),
('Lifestyle', 'http://www.getwokingham.co.uk/lifestyle/rss.xml')
]
def preprocess_html(self, soup):
for item in soup.findAll(style=True):
del item['style']
for item in soup.findAll('a'):
if item.string is not None:
str = item.string
item.replaceWith(str)
else:
item.name = 'span'
del item['href']
return soup