| 1 |
from calibre.web.feeds.recipes import BasicNewsRecipe |
| 2 |
|
| 3 |
|
| 4 |
class iHeuteRecipe(BasicNewsRecipe): |
| 5 |
__author__ = 'FunThomas' |
| 6 |
title = 'iDnes.cz' |
| 7 |
publisher = 'MAFRA a.s.' |
| 8 |
description = 'iDNES.cz Zprávy, Technet, Komiksy a další' |
| 9 |
oldest_article = 3 |
| 10 |
max_articles_per_feed = 2 |
| 11 |
|
| 12 |
feeds = [ |
| 13 |
('Zprávy', 'http://servis.idnes.cz/rss.asp?c=zpravodaj'), |
| 14 |
('Sport', 'http://servis.idnes.cz/rss.asp?c=sport'), |
| 15 |
('Technet', 'http://servis.idnes.cz/rss.asp?c=technet'), |
| 16 |
('Mobil', 'http://servis.idnes.cz/rss.asp?c=mobil'), |
| 17 |
('Ekonomika', 'http://servis.idnes.cz/rss.asp?c=ekonomikah'), |
| 18 |
('Cestování', 'http://servis.idnes.cz/rss.asp?c=iglobe'), |
| 19 |
('Komixy', 'http://servis.idnes.cz/rss.asp?c=komiksy'), |
| 20 |
] |
| 21 |
|
| 22 |
encoding = 'cp1250' |
| 23 |
language = 'cs' |
| 24 |
cover_url = 'http://g.idnes.cz/u/loga-n4/idnes.gif' |
| 25 |
remove_javascript = True |
| 26 |
no_stylesheets = True |
| 27 |
|
| 28 |
remove_attributes = ['width', 'height'] |
| 29 |
remove_tags = [ |
| 30 |
dict(name='div', attrs={'id': ['zooming']}), |
| 31 |
dict(name='div', attrs={'class': ['related', 'mapa-wrapper']}), |
| 32 |
dict(name='table', attrs={'id': ['opener-img', 'portal']}), |
| 33 |
dict(name='table', attrs={'class': ['video-16ku9']}), |
| 34 |
] |
| 35 |
remove_tags_after = [dict(name='div', attrs={'id': ['related', 'related2']})] |
| 36 |
|
| 37 |
keep_only_tags = [dict(name='div', attrs={'class': ['art-full adwords-text', 'dil-day', 'art-full']}), dict(name='table', attrs={'class': ['kemel-box']})] |
| 38 |
|
| 39 |
def print_version(self, url): |
| 40 |
print_url = url |
| 41 |
split_url = url.split('?') |
| 42 |
if split_url[0].rfind('dilbert.asp') != -1: # dilbert komix |
| 43 |
print_url = print_url.replace('.htm', '.gif&tisk=1') |
| 44 |
print_url = print_url.replace('.asp', '.aspx') |
| 45 |
elif split_url[0].rfind('kemel.asp') == -1: # not Kemel komix |
| 46 |
print_url = 'http://zpravy.idnes.cz/tiskni.asp?' + split_url[1] |
| 47 |
# kemel kemel print page doesn't work |
| 48 |
return print_url |
| 49 |
|
| 50 |
extra_css = ''' |
| 51 |
h1 {font-size:125%; font-weight:bold} |
| 52 |
h3 {font-size:110%; font-weight:bold} |
| 53 |
''' |