| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
__license__ = 'GPL v3' |
| 4 |
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>' |
| 5 |
|
| 6 |
''' |
| 7 |
Inteligencer.ca |
| 8 |
''' |
| 9 |
|
| 10 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 11 |
|
| 12 |
|
| 13 |
class Inteligencer(BasicNewsRecipe): |
| 14 |
title = 'Intelligencer' |
| 15 |
oldest_article = 7 |
| 16 |
max_articles_per_feed = 100 |
| 17 |
encoding = 'utf-8' |
| 18 |
language = 'en' |
| 19 |
|
| 20 |
no_stylesheets = True |
| 21 |
use_embedded_content = False |
| 22 |
lang = 'en-CA' |
| 23 |
|
| 24 |
conversion_options = {'language': lang, 'pretty_print': True} |
| 25 |
|
| 26 |
remove_attributes = ['style', 'width', 'height', 'font', 'border', 'align', 'action', 'onload'] |
| 27 |
|
| 28 |
keep_only_tags = [dict(name='td', attrs={'colspan': '2'})] |
| 29 |
|
| 30 |
remove_tags = [dict(name=['object', 'link', 'embed', 'iframe']), dict(name='div', attrs={'id': 'header'})] |
| 31 |
feeds = [('Recent News', 'http://www.intelligencer.ca/rss/')] |
| 32 |
|
| 33 |
def print_version(self, url): |
| 34 |
return url.replace('/ArticleDisplay.aspx?', '/PrintArticle.aspx?') |
| 35 |
|
| 36 |
def preprocess_html(self, soup): |
| 37 |
for item in soup.findAll('td'): |
| 38 |
del item['colspan'] |
| 39 |
item.name = 'div' |
| 40 |
return soup |