mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
set of updates for Polish recipes
This commit is contained in:
parent
c56989ea1a
commit
f97f69a207
@ -9,6 +9,7 @@ class ForsalPL(BasicNewsRecipe):
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
use_embedded_content = False
|
||||
remove_empty_feeds = True
|
||||
ignore_duplicate_articles = {'title', 'url'}
|
||||
cover_url = 'http://www.bizneswnieruchomosciach.pl/wp-content/uploads/2010/07/logo_forsal.jpg'
|
||||
no_stylesheets = True
|
||||
|
@ -8,7 +8,7 @@ class Kosmonauta(BasicNewsRecipe):
|
||||
category = 'astronomy'
|
||||
language = 'pl'
|
||||
cover_url = 'http://bi.gazeta.pl/im/4/10393/z10393414X,Kosmonauta-net.jpg'
|
||||
extra_css = '.thumbnail {float:left;margin-right:5px;}'
|
||||
extra_css = '.thumb-left {float:left; margin-right:5px;} .calibre_navbar {clear: both;}'
|
||||
no_stylesheets = True
|
||||
INDEX = 'http://www.kosmonauta.net'
|
||||
oldest_article = 7
|
||||
|
@ -10,8 +10,8 @@ class recipeMagic(BasicNewsRecipe):
|
||||
title = 'National Geographic PL'
|
||||
__author__ = 'Marcin Urban 2011'
|
||||
__modified_by__ = 'fenuks'
|
||||
description = 'legenda wśród magazynów z historią sięgającą 120 lat'
|
||||
#cover_url = 'http://www.guj.pl/var/guj/storage/images/media/nasze_magazyny/national_geographic/logo/ng_logo/2606-1-pol-PL/ng_logo.jpg'
|
||||
description = 'Legenda wśród magazynów z historią sięgającą 120 lat'
|
||||
#cover_url = 'http://www.guj.pl/var/guj/storage/images/media/nasze_magazyny/national_geographic/logo/ng_logo/2606-1-pol-PL/ng_logo.jpg'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
@ -21,13 +21,14 @@ class recipeMagic(BasicNewsRecipe):
|
||||
publisher = 'G+J Gruner+Jahr Polska'
|
||||
category = 'news, PL,'
|
||||
language = 'pl'
|
||||
remove_empty_feeds = True
|
||||
publication_type = 'newsportal'
|
||||
extra_css = ''' body {font-family: verdana, arial, helvetica, geneva, sans-serif ;}
|
||||
h1{text-align: center;}
|
||||
h2{font-size: medium; font-weight: bold;}
|
||||
.authordate {font-size: small; color: #696969;}
|
||||
p.lead {font-weight: bold; text-align: center;}
|
||||
.fot{font-size: x-small; color: #666666;} '''
|
||||
h1{text-align: center;}
|
||||
h2{font-size: medium; font-weight: bold;}
|
||||
.authordate {font-size: small; color: #696969;}
|
||||
p.lead {font-weight: bold; text-align: center;}
|
||||
.fot{font-size: x-small; color: #666666;} '''
|
||||
preprocess_regexps = [(re.compile(r'<!--.*?-->', re.DOTALL), lambda m: '')]
|
||||
conversion_options = {
|
||||
'comments' : description
|
||||
@ -37,9 +38,9 @@ class recipeMagic(BasicNewsRecipe):
|
||||
,'linearize_tables': True
|
||||
}
|
||||
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'class':'add_inf'}),
|
||||
dict(name='div', attrs={'class':'add_f'}),
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'class':'add_inf'}),
|
||||
dict(name='div', attrs={'class':'add_f'}),
|
||||
]
|
||||
|
||||
remove_attributes = ['width','height']
|
||||
@ -47,14 +48,16 @@ class recipeMagic(BasicNewsRecipe):
|
||||
|
||||
def find_articles(self, url):
|
||||
articles = []
|
||||
soup=self.index_to_soup(url)
|
||||
tag=soup.find(attrs={'class':'arl'})
|
||||
art=tag.ul.findAll('li')
|
||||
soup = self.index_to_soup(url)
|
||||
tag = soup.find(attrs={'class':'arl'})
|
||||
if not tag:
|
||||
return articles
|
||||
art = tag.ul.findAll('li')
|
||||
for i in art:
|
||||
title=i.a['title']
|
||||
url=i.a['href']
|
||||
title = i.a['title']
|
||||
url = i.a['href']
|
||||
#date=soup.find(id='footer').ul.li.string[41:-1]
|
||||
desc=i.div.p.string
|
||||
desc = i.div.p.string
|
||||
articles.append({'title' : title,
|
||||
'url' : url,
|
||||
'date' : '',
|
||||
|
@ -2,7 +2,7 @@ __license__ = 'GPL v3'
|
||||
import re
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class Poltergeist(BasicNewsRecipe):
|
||||
class Polter(BasicNewsRecipe):
|
||||
title = u'Polter.pl'
|
||||
__author__ = 'fenuks'
|
||||
description = u'Największy polski serwis poświęcony ogólno pojętej fantastyce - grom fabularnym (RPG), książkom, filmowi, komiksowi, grom planszowym, karcianym i bitewnym.'
|
||||
@ -10,21 +10,26 @@ class Poltergeist(BasicNewsRecipe):
|
||||
#publication_type = ''
|
||||
language = 'pl'
|
||||
#encoding = ''
|
||||
extra_css = '.image, .floatright {float: right; margin-left: 10px;} .floatleft {float: left; margin-right: 10px;}'
|
||||
extra_css = '.image, .floatright {float: right; margin-left: 10px;} .floatleft {float: left; margin-right: 10px;} .calibre_navbar {clear: both;} .p_title {font-weight: bold;} .p_image {margin-left: auto; margin-right: auto; display: block;} .italic {font-style: italic;}'
|
||||
cover_url = 'http://static.polter.pl/sub/promo/bpromo2524.jpg'
|
||||
#masthead_url = ''
|
||||
use_embedded_content = False
|
||||
oldest_article = 7
|
||||
preprocess_regexps = [(re.compile(ur'<div[^>]*?id="pol_lista"[^>]*?>.*</body>', re.DOTALL|re.IGNORECASE), lambda match: '</body>'), (re.compile(ur'<a[^>]*?>wersja do druku</a>', re.DOTALL|re.IGNORECASE), lambda match: '')]
|
||||
preprocess_regexps = [(re.compile(ur'<div[^>]*?id="pol_lista"[^>]*?>.*</body>', re.DOTALL|re.IGNORECASE), lambda match: '</body>'),
|
||||
(re.compile(ur'<a[^>]*?>wersja do druku</a>', re.DOTALL|re.IGNORECASE), lambda match: ''),
|
||||
#(re.compile(ur'<a href="JavaScript:[^">]*">(<img ?[^>]*?/>)</a>', re.DOTALL|re.IGNORECASE), lambda match: '/1')
|
||||
(re.compile(ur'(<br ?/?>[\n\s\r]*){2,}', re.DOTALL|re.IGNORECASE), lambda match: '<br />'),
|
||||
(re.compile(ur'<span[^>]*>Zaloguj się aby wyłączyć tę reklamę</span>', re.DOTALL|re.IGNORECASE), lambda match: ''),
|
||||
]
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
remove_empty_feeds = True
|
||||
remove_javascript = True
|
||||
remove_attributes = ['style', 'font']
|
||||
remove_attributes = ['font', 'fieldset', 'onclick']
|
||||
ignore_duplicate_articles = {'title', 'url'}
|
||||
|
||||
keep_only_tags = [dict(attrs={'class':'boxcontent'})]
|
||||
remove_tags = [dict(attrs={'class':'fb-like'}), dict(attrs={'alt':'Wersja do druku'}), dict(id='pol_liczba'), dict(attrs={'scr':'http://static.polter.pl/tplimg/buttons/ceneo_140_40.gif'})]
|
||||
remove_tags = [dict(attrs={'class':'fb-like'}), dict(attrs={'alt':'Wersja do druku'}), dict(id=['pol_liczba', 'col12AdSenseLight']), dict(attrs={'scr':'http://static.polter.pl/tplimg/buttons/ceneo_140_40.gif'}), dict(name=['g:plusone', 'fb:like'])]
|
||||
remove_tags_after = dict(attrs={'class':'fb-like'})
|
||||
#remove_tags_before = dict()
|
||||
|
||||
@ -35,9 +40,24 @@ class Poltergeist(BasicNewsRecipe):
|
||||
s['class'] = 'floatleft'
|
||||
for s in soup.findAll(attrs={'style':re.compile('float: ?right')}):
|
||||
s['class'] = 'floatright'
|
||||
for s in soup.findAll(style=True):
|
||||
if 'bold;' in s['style']:
|
||||
if s.get('class', ''):
|
||||
s['class'] = s['class'] + ' p_title'
|
||||
else:
|
||||
s['class'] = 'p_title'
|
||||
if 'italic;' in s['style']:
|
||||
if s.get('class', ''):
|
||||
s['class'] = s['class'] + ' italic'
|
||||
else:
|
||||
s['class'] = 'italic'
|
||||
del s['style']
|
||||
|
||||
tag = soup.find(id='twoja_ocena')
|
||||
if tag:
|
||||
tag.parent.extract()
|
||||
for tag in soup.findAll(id='lista_chce_ile'):
|
||||
tag.parent.parent.extract()
|
||||
for r in soup.findAll(name='a', href=re.compile(r'^http://www.ceneo.pl/')):
|
||||
r.extract()
|
||||
return soup
|
File diff suppressed because one or more lines are too long
@ -14,7 +14,5 @@ class Tablety_pl(BasicNewsRecipe):
|
||||
max_articles_per_feed = 100
|
||||
preprocess_regexps = [(re.compile(ur'<p><strong>Przeczytaj także.*?</a></strong></p>', re.DOTALL), lambda match: ''), (re.compile(ur'<p><strong>Przeczytaj koniecznie.*?</a></strong></p>', re.DOTALL), lambda match: '')]
|
||||
keep_only_tags = [dict(id='news_block')]
|
||||
#remove_tags_before=dict(name="h1", attrs={'class':'entry-title'})
|
||||
#remove_tags_after=dict(name="footer", attrs={'class':'entry-footer clearfix'})
|
||||
remove_tags=[dict(attrs={'class':['comments_icon', 'wp-polls', 'entry-comments']})]
|
||||
remove_tags=[dict(attrs={'class':['comments_icon', 'wp-polls', 'entry-comments', 'wp-polls-loading', 'ts-fab-wrapper', 'entry-footer']})]
|
||||
feeds = [(u'Najnowsze posty', u'http://www.tablety.pl/feed/')]
|
Loading…
x
Reference in New Issue
Block a user