mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-09-29 15:31:08 -04:00
65 lines
2.4 KiB
Plaintext
65 lines
2.4 KiB
Plaintext
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
class RzeczpospolitaRecipe(BasicNewsRecipe):
|
|
__license__ = 'GPL v3'
|
|
__author__ = u'kwetal and Tomasz Dlugosz'
|
|
language = 'pl'
|
|
version = 1
|
|
|
|
title = u'Rzeczpospolita OnLine'
|
|
publisher = u'Presspublica Sp.'
|
|
category = u'News'
|
|
description = u'Newspaper'
|
|
oldest_article = 1
|
|
max_articles_per_feed = 100
|
|
|
|
no_stylesheets = True
|
|
remove_javascript = True
|
|
encoding = 'utf-8'
|
|
# Seems to work best, but YMMV
|
|
simultaneous_downloads = 1
|
|
|
|
feeds = []
|
|
feeds.append(u'http://www.rp.pl/rss/2.html')
|
|
feeds.append(u'http://www.rp.pl/rss/10.html')
|
|
feeds.append(u'http://www.rp.pl/rss/11.html')
|
|
feeds.append(u'http://www.rp.pl/rss/12.html')
|
|
feeds.append(u'http://www.rp.pl/rss/4.html')
|
|
feeds.append(u'http://www.rp.pl/rss/5.html')
|
|
feeds.append(u'http://www.rp.pl/rss/6.html')
|
|
feeds.append(u'http://www.rp.pl/rss/7.html')
|
|
feeds.append(u'http://www.rp.pl/rss/8.html')
|
|
|
|
keep_only_tags =[]
|
|
keep_only_tags.append(dict(name = 'div', attrs = {'id' : 'storyp'}))
|
|
|
|
remove_tags =[]
|
|
remove_tags.append(dict(name = 'div', attrs = {'id' : 'adk_0'}))
|
|
remove_tags.append(dict(name = 'div', attrs = {'class' : 'clr'}))
|
|
remove_tags.append(dict(name = 'div', attrs = {'id' : 'share_bottom'}))
|
|
remove_tags.append(dict(name = 'div', attrs = {'id' : 'copyright_law'}))
|
|
remove_tags.append(dict(name = 'div', attrs = {'class' : 'more'}))
|
|
remove_tags.append(dict(name = 'div', attrs = {'class' : 'editorPicks'}))
|
|
|
|
extra_css = '''
|
|
body {font-family: verdana, arial, helvetica, geneva, sans-serif ;}
|
|
h1{text-align: left;}
|
|
h2{font-size: medium; font-weight: bold;}
|
|
p.lead {font-weight: bold; text-align: left;}
|
|
.authordate {font-size: small; color: #696969;}
|
|
.fot{font-size: x-small; color: #666666;}
|
|
'''
|
|
|
|
def skip_ad_pages(self, soup):
|
|
if ('advertisement' in soup.find('title').string.lower()):
|
|
href = soup.find('a').get('href')
|
|
return self.index_to_soup(href, raw=True)
|
|
else:
|
|
return None
|
|
|
|
def print_version(self, url):
|
|
start, sep, rest = url.rpartition('/')
|
|
forget, sep, index = rest.rpartition(',')
|
|
|
|
return start + '/' + index + '?print=tak'
|