| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
__license__ = 'GPL v3' |
| 4 |
|
| 5 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 6 |
|
| 7 |
|
| 8 |
class SATKurier(BasicNewsRecipe): |
| 9 |
title = 'SATKurier.pl' |
| 10 |
__author__ = 'Artur Stachecki <[email protected]>' |
| 11 |
language = 'pl' |
| 12 |
description = 'Serwis poświęcony telewizji cyfrowej' |
| 13 |
oldest_article = 7 |
| 14 |
masthead_url = 'http://satkurier.pl/img/header_sk_logo.gif' |
| 15 |
max_articles_per_feed = 100 |
| 16 |
simultaneous_downloads = 5 |
| 17 |
remove_javascript = True |
| 18 |
no_stylesheets = True |
| 19 |
|
| 20 |
keep_only_tags = [dict(name='div', attrs={'id': ['leftNewsContainer', 'content']})] |
| 21 |
|
| 22 |
remove_tags = [dict(name='div', attrs={'class': ['col-xs-20', 'coverNews', 'btn-group']})] |
| 23 |
|
| 24 |
remove_tags_after = [dict(name='div', attrs={'class': 'btn-group'})] |
| 25 |
|
| 26 |
feeds = [ |
| 27 |
('Najnowsze wiadomości', 'http://feeds.feedburner.com/satkurierpl?format=xml'), |
| 28 |
('Sport w telewizji', 'http://feeds.feedburner.com/satkurier/sport?format=xml'), |
| 29 |
('Blog', 'http://feeds.feedburner.com/satkurier/blog?format=xml'), |
| 30 |
] |
| 31 |
|
| 32 |
def preprocess_html(self, soup): |
| 33 |
image = soup.find(attrs={'id': 'news_mini_photo'}) |
| 34 |
if image: |
| 35 |
image.extract() |
| 36 |
header = soup.find('h1') |
| 37 |
header.replaceWith(header.prettify() + image.prettify()) |
| 38 |
for alink in soup.findAll('a'): |
| 39 |
if alink.string is not None: |
| 40 |
tstr = alink.string |
| 41 |
alink.replaceWith(tstr) |
| 42 |
return soup |