| 1 |
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai |
| 2 |
from __future__ import unicode_literals |
| 3 |
|
| 4 |
from calibre.web.feeds.recipes import BasicNewsRecipe |
| 5 |
|
| 6 |
|
| 7 |
class tydenRecipe(BasicNewsRecipe): |
| 8 |
__author__ = 'bubak' |
| 9 |
title = 'Tyden.cz' |
| 10 |
publisher = '' |
| 11 |
description = '' |
| 12 |
oldest_article = 1 |
| 13 |
max_articles_per_feed = 20 |
| 14 |
|
| 15 |
feeds = [ |
| 16 |
('Domácí', 'http://www.tyden.cz/rss/rss.php?rubrika_id=6'), |
| 17 |
('Politika', 'http://www.tyden.cz/rss/rss.php?rubrika_id=173'), |
| 18 |
('Kauzy', 'http://www.tyden.cz/rss/rss.php?rubrika_id=340'), |
| 19 |
] |
| 20 |
|
| 21 |
language = 'cs' |
| 22 |
cover_url = 'http://www.tyden.cz/img/tyden-logo.png' |
| 23 |
remove_javascript = True |
| 24 |
no_stylesheets = True |
| 25 |
remove_attributes = [] |
| 26 |
remove_tags_before = dict(name='p', attrs={'id': ['breadcrumbs']}) |
| 27 |
remove_tags_after = dict(name='p', attrs={'class': ['author']}) |
| 28 |
|
| 29 |
visited_urls = {} |
| 30 |
|
| 31 |
def get_article_url(self, article): |
| 32 |
url = BasicNewsRecipe.get_article_url(self, article) |
| 33 |
if url in self.visited_urls: |
| 34 |
self.log.debug('Ignoring duplicate: ' + url) |
| 35 |
return None |
| 36 |
else: |
| 37 |
self.visited_urls[url] = True |
| 38 |
self.log.debug('Accepting: ' + url) |
| 39 |
return url |